1
1

Compare commits

...

7671 Commits

Author SHA1 Message Date
3ce788e015 Progress on input properties, currently crashes 2023-04-12 16:48:59 -04:00
8be481fbd8 Fix missing update tag 2023-04-12 16:18:46 -04:00
a385a00821 Merge branch 'main' into node-group-operators 2023-04-12 15:58:29 -04:00
e35f971da1 Mesh: Avoid unnecessarily initializing corner topology arrays
This data should be initialized when building the mesh. If the arrays
aren't already initialized, there is already a bug. Theoretically this
could improve performance, since we can use `malloc` instead of
`calloc`. In practice I observed less than a 1% difference though.
2023-04-12 15:49:09 -04:00
a04098ebba Fix: Incorrect creation of deform mesh with no deform modifiers
Logic error in 99c630cd9c, hidden by a null check
in `BKE_id_copy_ex`.
2023-04-12 15:42:14 -04:00
16de3ba759 Fix #106845: Extrude node crash when no faces added
The non-individual face mode needs to check if there are any new faces
before accumulating their corner offsets.
2023-04-12 15:40:55 -04:00
e03da77033 Curves: Avoid unnecessary allocations in copy and move constructors
These aren't used much in current code, but currently they created
offsets on the result curves, then just freed them again when copying
from the source data. In the future it might be better to completely
avoid using the base constructor in the first place.
2023-04-12 15:32:30 -04:00
dccd42766c Cleanup: Use swap to take ownership of mesh data
Swap is commonly used to implement move assignment since it's short
and the logic is relatively simple. Use is here to avoid the need to
spell out the copying and freeing manually. The `BKE_id_free` call
at the end of the function will free whatever data was swapped.
2023-04-12 15:08:15 -04:00
642bc5546a Cleanup: Access curves offsets in RNA with C wrapper function
This simplifies the process of adding implicit sharing to the curve
offsets in the future.
2023-04-12 14:58:17 -04:00
b7e9906337 Cleanup: Remove unnecessary check when allocating mesh face offsets
The assert already checks this, but even in release builds,
doing nothing is probably worse than a memory leak here.
2023-04-12 14:56:28 -04:00
dd229a9d54 Cleanup: Slightly CurvesGeometry reorganize read function
The curve types and the runtime always have to be created when reading
the file from disk, so we might as well do that in `blend_read`, which
will help in the future when the offsets use implicit sharing.
2023-04-12 14:54:18 -04:00
87cd22f643 Cleanup: Use early return in legacy curve conversion
Return null instead of an empty curves data-block, which amounts to
the same thing in geometry nodes, with less potential for error in
the rest of the function.
2023-04-12 14:51:24 -04:00
2b6c1600cf UI: Allow Float Kerning for Text Objects
Change Text Object character `kern` member to float from int, and allow
fractional changes to kerning with Shift-Alt-arrows.

Pull Request: blender/blender#105181
2023-04-12 19:11:53 +02:00
0ee0e8c0d4 UI: Tooltips for Assets
Show tooltips for Asset Browser items.

Pull Request: blender/blender#106189
2023-04-12 18:44:47 +02:00
000aef6e5e Cleanup: Use references in mesh.cc 2023-04-12 11:49:43 -04:00
baf6892270 Cleanup: Add utility function for clearing mesh geometry
The existing utility cleared vertex group names and active attribute
names, which doesn't always make sense when the geometry is
replaced but the custom data layout remains mainly unchanged.
2023-04-12 11:49:43 -04:00
2771f53cb7 UI: Fix disconnected and non-clickable checkbox labels in popovers
For popovers, draw the checkbox in header as usual with label, but
hide the panel header label, see ed870f87b9.

Patch by Yevgeny Makarov (@jenkm) in
https://archive.blender.org/developer/D9586

Co-authored-by: Yevgeny Makarov <jenkm>
Pull Request: blender/blender#105657
2023-04-12 17:00:51 +02:00
c738d8df84 Cleanup: VSE clipboard: Remove code in blo_lib_link_restore.
This code (looking for matching new IDs to restore by name) is called
from `set_app_data` after a .blend file has been read (also in memfile
undo case).

The part handling VSE clipboard to restore ID pointers is not really
needed, since pasting VSE strips already ensures stored ID pointers are
still valid, and tries to find a new matching one otherwise.
2023-04-12 16:18:25 +02:00
c40ce3baae Cleanup: I18n: sort disambiguation contexts from BLT_translation.h
The contexts appear twice, in the list of #defines and in the
BLT_I18NCONTEXTS_DESC. Both had gotten out of alphabetical order, and
out of sync.

Pull Request: blender/blender#106718
2023-04-12 15:09:21 +02:00
5cf365554b I18n: disambiguate a few messages
- "Lens" can be a transparent object used in cameras, or specifically
  its property of focal length
- "Empty" can be an adjective meaning void, or an object type. The
  latter is already disambiguated using `ID_ID`
- "New" and "Old" are adjectives that can have agreements in some
  languages
- "Modified" is an adjective that can have agreement in some languages
- "Clipping" can be a property of a camera, or a behavior of the
  mirror modifier
- "Value" in HSV nodes, see #105113
- "Area" in the Face Area geometry node, can mean a measurement or a
  window type
- "New" is an adjective that can have agreement
- "Tab" can be a UI element or a whitespace character
- "Volume" can mean a measurement or an object type. The latter is
  already disambiguated using `ID_ID`

These changes introduce the new `BLT_I18NCONTEXT_TIME` translation
context.

They also remove `BLT_I18NCONTEXT_VIRTUAL_REALITY`, which I added at
one point but then couldn't find which messages I wanted to fix with
it.

Ref #43295

Pull Request: #106718
2023-04-12 15:09:17 +02:00
c31434a570 Cleanup: Remove setting polygon loop total from Python
This property is not editable after 7966cd16d6,
though doing so didn't seem to give an error. It doesn't have
to be set anymore, since the data is redundant with the
"loop_start" anyway.
2023-04-12 08:38:32 -04:00
30d8cb3be8 Fix #106246: Outliner: Crash on deleting the multi-level objects hierarchy.
Existing code was intrisically wrong, and also potentially very
innefficient.

Now tagging objects for deletion and removal is separated from actual
collection removal and object deletion. This makes the code safer,
simpler and more efficient.

NOTE: There is still an unsolved (already existing in original code)
issue with checks on objects that should not be deleted, noted in code.

Pull Request: blender/blender#106821
2023-04-12 14:25:40 +02:00
81815681d0 Python API: Add function to create links to virtual sockets
Links created through the normal Python API are invalid since
7026096099. Before then, one could create links to or from virtual
sockets from Python (grayed out sockets in Group Input and Group
Output nodes), as is still possible in the GUI.

This is documented as an API change, and it broke at least Node
Wrangler, see blender/blender-addons#104470. Instead of just fixing
that, let's introduce an API to make this operation simpler.

Pull Request: blender/blender#105975
2023-04-12 14:18:29 +02:00
9ffd413008 macOS/Linker: support mold and lld
If someone buys "sold", mold should work on macOS too.
With lld, Blender (700 MB) intel i5: 26s -> 17s.

Pull Request #106843
2023-04-12 17:01:53 +05:30
da75495ada Fix user add-ons not showing up with "User" filter in Preferences
Mistake in ba25023d22, updated the drawing code with the wrong function
call. So when setting the add-ons category to "User", add-ons installed
in the user paths (custom paths configured in Preferences) wouldn't show
up.
2023-04-12 13:04:54 +02:00
ac09d18e4e Fix #106840: Add-ons not loading from custom script directories
`script_paths()` wasn't updated correctly, but that was hidden by some
compabtibility logic that was in the patch earlier. Only with my last
change to the PR before merging it that was removed and the error became
quite visible.
2023-04-12 13:02:31 +02:00
3f4f975228 I18n: fix footer in the text editor when loading an external file
When loading an external file in the text editor, the footer text
stating "File: <file>" or "File: <file> (unsaved)" was not translated,
because the translation happened after string formatting, and the
message was thus not found in the po files.

Pull Request: blender/blender#106716
2023-04-12 12:19:00 +02:00
007c9e4e47 Fix #106427: Vector Math node does not appear in node search
When trying to search for the Vector Math node with a translated
interface, the node did not come up because it did not use the proper
translation context.

The Vector Math node's RNA had a translation context added in
db87e2a638, in order for the Floor operation to be disambiguated. I
made a mistake and added the context to the entire node struct instead
of just the Operation prop. This had the result that the Vector Math
was searched with an empty context in the search menu, but could not
be found.

Replacing the translation context from the struct to the property
fixes the issue, and actually allows disambiguating operations such as
Floor, which wasn't achieved previously.

Pull Request: blender/blender#106579
2023-04-12 12:01:48 +02:00
1771ded381 Fix: Call OpenImageIO correctly when creating grayscale images
The call to `channel_sum` requires that the `weights` array is at least
as large as the number of channels in the originating buffer.

Switch to use the span overload as well since the method that takes a
raw weights array is deprecated.

Thanks to @aras_p for debugging the issue.

Pull Request: blender/blender#106847
2023-04-12 10:23:34 +02:00
022652beb9 Fix #106794: Changing active camera changes other viewport local cameras
f36543c5f5 took care of syncing multiple viewport`s cameras, but wasnt
fully meeting intentions [which was to only do this if both viewports
are locked to the scene camera].

Check was only done for the viewport this was executed in (if this was
locked to the scene camera, it would change all other viewports as
well), now also check if the target viewport prefers to use its own
local camera instead and skip it in that case.

Pull Request: blender/blender#106799
2023-04-12 10:10:12 +02:00
13d9a6c929 Cleanup: improve comments for makesrna dependency workaround 2023-04-12 17:23:08 +10:00
28a8a3c086 Fix crash on startup under the RIVER Wayland compositor
Defer acting on the tag to update scale as it caused the window
to use the wrong scale on startup & exit.

GTK/KDE applications seem to postpone updating scale so use this by
default as glitches with scale tend to be caused by updating the scale
too frequently instead of not quickly enough.
2023-04-12 15:54:06 +10:00
ddb6928882 GHOST/Wayland: resize the EGL buffer & change surface scale immediately
There is no need to postpone these operations when configuring the frame
only postpone committing the surface change.

Deferring these operations caused flickering when moving windows
between monitors of different scale on both GNOME & KDE.
2023-04-12 15:54:06 +10:00
1f3949f1cf Fix building WITH_CINEON=OFF 2023-04-12 15:54:06 +10:00
aa3bdfd76a Image: Use OpenImageIO for loading and saving a variety of image formats
This checkin will use OIIO to replace the image save/load code for BMP,
DDS, DPX, HDR, PNG, TGA, and TIFF.

This simplifies our build environment, reduces binary duplication,
removes large amounts of hard to maintain code, and fixes some bugs
along the way.

It should also help reduce rare differences between Blender and Cycles
which already uses OIIO for most situations. Or potentially makes them
easier to solve once discovered.

This is a continuation of the work for #101413

Pull Request: blender/blender#105785
2023-04-12 05:22:26 +02:00
c6d6869171 GHOST/Wayland: suppress EGL_BAD_SURFACE error on exit
Freeing ContextEGL would attempt to free the context's EGLSurface,
which was already freed by the native-window, causing 2x bad-surface
errors on exit.

Suppress the warning by clearing the surface from releaseNativeHandles
when the surface was created by a native window.
2023-04-12 13:12:01 +10:00
b6457dc568 Fix #106740: VSE Image sequence can't be loaded from python
Caused by introduction of `SEQ_SINGLE_FRAME_CONTENT` flag (66eedc542b).
The flag was not updated in `SequenceElements` `append` and `pop`
functions.
2023-04-12 03:40:07 +02:00
6fa80d1e1d Cleanup: add doc-strings to upper/lowecase functions
Move detailed note into the implementation.
2023-04-12 11:24:12 +10:00
ccea39b538 Cleanup: spelling in comments 2023-04-12 11:24:10 +10:00
5df8e35da7 UI: Add slash separators to Hue/Saturation/Value
It was that names of related "combo" operations
like Hue/Saturation/Value, *Dilate/Erode*
and Brightness/Contrast should be separated
by slashes in their names.

This patch changes this for the multiple nodes
and operators concerning Hue/Saturation/Value
across Blender.

Note1: This patch should only touch UI names
which do not need versioning and should not
break scripts.

Note2: This breaks first letter fuzzy search
for "hsv". It was noted by @HooglyBoogly that
the "/" character needs to be added to the
fuzzy search split list. Note however that such
search is already broken in Main for nodes like
Brightness/Contrast and Dilate/Erode which
already use slash separators

Pull Request: blender/blender#106721
2023-04-11 23:48:05 +02:00
4170545dc5 Fix #106828: Extrude individual mode crash on mesh with no faces
Caused by 7966cd16d6
2023-04-11 15:34:03 -04:00
f8108d6dfd UI: Rename Bright/Contrast to Brightness/Contrast
Rename *Bright/Contrast* to *Brightness/Contrast* in order to avoid the use of shortened names and improve consistency within Blender and with industry conventions.

Reasoning:

The modified color characteristic is called *brightness*, not *bright*. You don't modify the *bright* of an image.

This also interferes with search in case someone searches for brightness, producing no results.

*Note: This patch should only touch UI names which do not need versioning. It leaves the actual property name in nodes for a future breaking release.*

Pull Request: blender/blender#104998
2023-04-11 21:32:29 +02:00
fd234fe1ce Fix #106745: Subdivision surface crash with more than 8 UV maps
Before 6c774feba2, the maximum number of UV maps was
enforced throughout Blender. Now it has to be enforced in the few places
that actually have the limit. In the future the limit of the subsurf
could be lifted, but that isn't done now to keep the crash fix simple.
2023-04-11 15:28:08 -04:00
99c630cd9c Fix #106802: Incorrect modifier deform evaluation result
Since the positions of the final mesh are modified rather than a
separate array after d20f992322, the final mesh has
to become the deformed mesh after the deform modifiers, rather
than the input mesh. The arrays can't be shared anymore, but that
performance loss will be solved by implicit sharing shortly.
2023-04-11 14:00:16 -04:00
1a6cfa1ae1 Fix: Incorrect mesh data used in mesh remap code
Mistake in 7966cd16d6
Related to #106671
2023-04-11 13:29:12 -04:00
c7995f3185 Fix #106366: Handle exceptions in add fur operator
Give errors in a few cases:
- The mesh has no UV map
- The faces have no area
- The applied modifier has no curve data (it may have been modified)

Use errors instead of cancelling the operator completely so the
operator can still do something useful when many meshes are
selected and only some fail.

Pull Request: blender/blender#106823
2023-04-11 19:19:41 +02:00
03c4173d81 Fix #106780: Crash with sculpt undo and poly offsets
The poly offsets need to be copied when converting a geometry
undo step into a full mesh, they were only assigned.
2023-04-11 12:35:52 -04:00
cd30bce7f1 Fix #106743: Crash writing with legacy mesh format
The new poly offsets were needed to interpolate attribute to a different
domain, but they were cleared when the legacy MPoly array was built.
Instead just clear the offsets a bit later after the other conversions.
2023-04-11 12:27:41 -04:00
90ad930a01 Fix #106778: Incomplete copy of curves radius to Cycles
The number of curves was used as a number of points by mistake.
Caused by ae017b3ab7.
2023-04-11 12:02:05 -04:00
4472717de2 Cleanup: Remove unnecessary PBVH attribute pointer
Material indices are only used when the structure is built. It's simpler
not to keep a longer-term reference available if it isn't needed.
2023-04-11 11:06:36 -04:00
b03174782e Fix #106775: File Draw Negative Width Buttons
Do not include Fake Draggable button in file lists if the space is so
constrained that they have negative widths. Avoids debug assert.

Pull Request: blender/blender#106777
2023-04-11 17:00:52 +02:00
9477ab65a4 ImageEngine: Improve Performance and Quality.
Blender 3.5 has a performance regression in the image engine
that made the image engine 3-4x slower then 3.4. The cause of
this was the new way how panning was implemented.

This PR disables the new panning for now as a short term fix.
In the future the panning and improvements we did ensured
better performance when dealing with higher resolution images.
But the regression for regular images weren't acceptable.

This fix might introduce other performance regressions on
lower end systems.

In the future we still want to improve the performance to
get back to Blender 3.0 performance, but that requires more
work and has a different priority.

Pull Request: blender/blender#106803
2023-04-11 16:20:26 +02:00
43b37fbc93 Fix #106722: Motion tracking data lost on recovering autosave
This is mistake in the refactor of the DNA storage which unified
the camera and object storage. The bit which was missed from the
initial logic is that the autosave does not use regular file
write.

Detect this in the do-versioning code and rely on the new data
format when it exists.

A candidate for 3.5.1 release.

Pull Request: blender/blender#106811
2023-04-11 15:59:39 +02:00
d299b1157f Cleanup: Update versioning code after subversion bump
Subversion was bumped in ba25023d22, so no need to execute this always
now, just do it for necessary file versions.
2023-04-11 15:34:31 +02:00
ba25023d22 Python: Support multiple custom script directories in Preferences
Makes it possible to select multiple custom script directories in Preferences >
File Paths, replacing the single Scripts path option. Each of these directories
supports the regular script directory layout with a startup file (or files?),
add-ons, modules and presets.
When installing an add-on, the script directory can be chosen.

NOTE: Deprecates the `bpy.types.PreferencesFilePaths.script_directory`
property, and replaces `bpy.utils.script_path_pref` with
`bpy.utils.script_paths_pref`.

Pull Request: blender/blender#104876
2023-04-11 15:20:52 +02:00
dc402a8b96 Core: Fix ASAN on Clang-14 / Linux
When using ASAN on Clang / Linux, the call to `find_library(... asan ...)`
works against us, as it finds GCC's `libasan.so`. To work with Clang,
we should simply not pass any explicit library, as Clang will figure things
out by itself with the `-fsanitize=xxx` options.

Furthermore, Clang is incompatible with `-fsanitize=object-size`, so that's
now also no longer passed on Linux (mimicking the Apple) configuration.

For the long run, it would be better to rewrite this entire section to
select behaviour on a per-compiler basis, rather than per platform. That's
tracked in #105956

Pull Request: blender/blender#106675
2023-04-11 14:15:34 +02:00
d07b82d16d GPU: Use Same Type in Comparisons.
Legacy drivers don't support auto type casting in comparisons.
This PR fixes some comparisons cast.

Thanks to Johannes J. for working/thinking along with the PR.

Pull Request: blender/blender#106789
2023-04-11 13:46:09 +02:00
cd5ada3f7d I18n: Updated UI translations from SVN repo (r6454). 2023-04-11 12:49:36 +02:00
bca2090724 Gitea: update bug report template for security policy 2023-04-11 12:14:01 +02:00
2884f92de1 GPU: Fix Crash Sampling in Texture Paint Mode.
Added additional check if occlude pass is created.

Fix: #106762

Pull Request: blender/blender#106791
2023-04-11 11:24:17 +02:00
28a11c007e Fix #106440: EEVEE: World lighting does not affect volumetrics
The shader was compiled without the right define, disabling the world
volume lighting.

This had nothing to do with the light path node as the lighting
was totally disabled.

Pull Request: blender/blender#106787
2023-04-11 11:08:12 +02:00
43eb3fe21a UI: enable string properties for alt-click buttons for multiple objects
This came up in #106591 which reported that changing a Light Group would
not work when alt-clicking the property field (which is the usual method
to edit a property for multiple objects at once).

This is because string properties were not supported in
`ui_selectcontext_apply` which is now done.

Similar to 1318660b04 [which added support for pointer properties].

Adding general support for string properties means this method can now
be used for many more things:
- changing all sorts of ID names (objects, meshes, ...)
- many settings in modifiers (e.g. vertexgroups)
- geometry nodes modifier properties (e.g. attribute names)
- ...

Fixes #106591

Pull Request: blender/blender#106599
2023-04-11 10:27:51 +02:00
17e2862603 Fix new windows on Hi-DPI monitors having incorrect size under Wayland
Updating the buffer scale increased the window size based on the
previous window scale. Since the previous scale (DPI) newly created
windows restored from a `.blend` file isn't known, don't scale the
window size when updating the window's scale for the first time.
2023-04-11 16:05:27 +10:00
4fe2685615 GHOST/Wayland: avoid up-scaling window content
When a window overlaps multiple outputs, always use the resolution
on the output with the highest resolution. This means Blender never
shows low resolution content up-scaled.
2023-04-11 16:00:59 +10:00
f50c319a4b GHOST/Wayland: refactor window scaling logic
Share logic between fractional & non-fractional window scaling.

This also enables fractional-scaling without scaling fixed sized buffers
for compositors without support for fractional_scale_manager_v1.
2023-04-11 16:00:56 +10:00
34f386c730 GHOST/Wayland: store API compatible fractional scaling values
Use values compatible with Wayland's fractional-scale API.

No funcitonal changes.
2023-04-11 16:00:54 +10:00
8dae058768 Fix: Crash in install_linux_packages.py script
There is a `KeyError` exception when the `install_linux_packages.py` build script is ran with `--distro-id`:

```console
$ ./build_files/build_environment/install_linux_packages.py --distro-id arch
INFO:     Distribution identifier forced by user to arch.
Traceback (most recent call last):
  File "file:///blender/./build_files/build_environment/install_linux_packages.py", line 1656, in <module>
    main()
  File "file:///blender/./build_files/build_environment/install_linux_packages.py", line 1646, in main
    distro_package_installer = PackageInstaller(settings) if settings.show_deps else get_distro_package_installer(settings)
  File "file:///blender/./build_files/build_environment/install_linux_packages.py", line 1570, in get_distro_package_installer
    return DISTRO_IDS_INSTALLERS[get_distro(settings)](settings)
KeyError: None
```

This happens because the `get_distro` function returns `None` if the distribution ID is forced with the `--distro-id` option, when it should return the provided value.

Pull Request: blender/blender#106461
2023-04-10 21:12:56 +02:00
f7029bc960 Cleanup: Incorrect assignment in previous cleanup commit 2023-04-10 14:02:32 -04:00
47ab0403f0 Cleanup: Slight improvements to Python BVH tree utility
- Reduce indentation
- Use Span instead of raw pointers in a few places
- Decrease variables scope
2023-04-10 13:48:37 -04:00
c71f66daa8 Cleanup: Remove commented code 2023-04-10 13:47:36 -04:00
0c01e0f489 Realtime Compositor: Implement Map UV node
This patch implements the Map UV node for the realtime compositor. This
is different from the CPU implementation in that it relies on the
approximate EWA filtering provided by the driver's implementation of
anisotropic filtering to displace the texture. This is easier and faster
than implementing EWA manually in the shader and has identical quality
where it matters.

Pull Request: blender/blender#106765
2023-04-10 17:29:39 +02:00
ad7e6d5e43 Fix wrong gradients in Displace node shader
This patches fixes a typo in the Displace node shader for the realtime
compositor where the vertical gradient used the horizontal table index.
2023-04-10 15:18:22 +02:00
f8c964de87 GPU: Improve the shader cache GC behavior
Improves the shader cache GC behavior, so the passes are only
deleted after being orphaned for over 1 minute.

Pull Request: blender/blender#106386
2023-04-10 11:39:00 +02:00
4bbbad49c8 Fix missing includes 2023-04-10 15:10:04 +10:00
0a460d4707 UV: refactor uv packing for readability and performance 2023-04-10 11:42:24 +12:00
cc5128f6ca Realtime Compositor: Implement Fog Glow Glare node
This patch implements the Fog Glow option in the Glare node. The
implementation does not match the existing implementation in the CPU
compositor, because it is computationally infeasible for the realtime
compositor. Instead, this implementation is similar to how Bloom is
implemented in EEVEE, based on the talk:

"Next Generation Post Processing in Call of Duty: Advanced Warfare".

This is just a temporary solution as requested by users until we either
implement an accurate implementation using FFT, provide a separate
option for EEVEE bloom, or roll out a different solution altogether.

Pull Request: blender/blender#106042
2023-04-09 15:42:20 +02:00
625ba3cb5d Realtime Compositor: Implement Displace node
This patch implements the Displace node for the realtime compositor.
This is different from the CPU implementation in that it relies on the
approximate EWA filtering provided by the driver's implementation of
anisotropic filtering to displace the texture. This is easier and faster
than implementing EWA manually in the shader and has identical quality
where it matters.

Pull Request: blender/blender#106681
2023-04-09 09:15:28 +02:00
b939b60c3f Realtime Compositor: Implement Z Combine node
This patch implements the Z Combine node for the realtime compositor.
The patch also extends the SMAA implementation to work with float
textures as a prerequisite to the Z Combine implementation. Moreover, a
mechanism for computing multi-output operations was implemented, in
which unneeded outputs will allocate a dummy 1x1 texture for a correct
shader invocation, then those dummy textures will be cleaned up by
calling a routine right after evaluation.

This is different from the CPU implementation in that the while combine
mask is anti-aliased, including the alpha mask, which is not considered
in the CPU case.

The node can be implemented as a GPU shader operation when the
anti-aliasing option is disabled, which is something we should do when
the evaluator allows nodes be executed as both standard and GPU shader
operations.

Pull Request: blender/blender#106637
2023-04-09 09:06:41 +02:00
7a267aa000 DRW: Selection Occlusion
#### Summary
Occlude edit mode selection behind objects in object mode.

#### Problem
When doing retopology, you want to be able to select your edit mesh,
but only when you can see it.
Being able to select geometry behind reference objects is not
desirable.

#### Solution
Make it so reference objects occlude selection, while the edit mesh is
pushed towards the view using retopology offset.

#### Limitations
Poly Build is not supported, because it doesn't use the depth buffer.
It behaves the same as normal, unoccluded by reference meshes.

#### Notes
Selection occlusion is not used when xray is enabled. This is
intentional.

Pull Request: blender/blender#105498
2023-04-09 08:08:01 +02:00
bc86223975 Cleanup: readability improvements in uv packer
Moved alpaca_rotate code closer to alpaca_turbo.
Improve const correctness.
Added some simple optimizations which improve readability.
2023-04-09 11:23:31 +12:00
cde565c26c PBVH: update mesh data pointers stored in pbvh
This is necessary for #106228. Without this, `PBVH` might contain pointers to
data that either does not exist anymore or that must not be edited because
it is shared.

Pull Request: blender/blender#106271
2023-04-08 13:29:37 +02:00
5cc5d6391b Cleanup: simplify customData_resize
There is no point in checking if the allocation of this relatively
small array was successful. We only do that in very few places,
but here it just adds unnecessary complexity.
2023-04-08 13:09:30 +02:00
9182851afe Cleanup: use BLO_CODE_ prefix for BHead codes
Having names like `DATA`, `TEST` and `USER` in the global namespace feels a bit wrong.

Pull Request: blender/blender#106673
2023-04-08 12:42:40 +02:00
68af6f6836 Audaspace: porting changes from upstream. 2023-04-08 10:36:40 +02:00
677273eb41 Merge branch 'main' into node-group-operators 2023-04-07 17:45:51 -04:00
e369bf4a6d UI: Text Object International Case Change
Allow Text Object operator FONT_OT_case_set to correctly transform the case
of strings written in almost all scripts that differentiate letter case.

Pull Request: blender/blender#106581
2023-04-07 23:40:42 +02:00
8906aa77cd Cleanup: Comment formatting, remove debug print
Also rename a few functions from "hair" to "curves"
2023-04-07 16:33:11 -04:00
5a86c4cc88 Fix: Cycles ignores point cloud and curves byte color attributes
Support was never added for byte color attributes, since for a while
it wasn't obvious that they were also considered "generic attributes."
2023-04-07 16:19:41 -04:00
ae017b3ab7 Cycles: Optimize Blender curves attribute extraction
Similar to 8d0920ec6d and aef0e72e5a.

In a test case with 2 million curves and 15 million points
I observed a 10x performance improvement, from 2.2s to 0.2s
to copy the data from Blender to Cycles.
2023-04-07 16:05:23 -04:00
aef0e72e5a Cycles: Optimize Blender point cloud attribute extraction
Similar to 8d0920ec6d.

In a test case with 8 million points and 3 attributes, I observed
around a 9x performance improvement, from 1.8s to 0.2s to copy
the data from Blender to Cycles. For some attribute types, using
implicit sharing could remove the need to copy entirely, but removing
the overhead from the RNA API makes sense anyway.
2023-04-07 16:04:12 -04:00
44d5a894c1 Fix #106667: Cycles: Multi-device denoise runs denoising data passes
Only use the denoised buffer for access of denoised passes, and
access the rest of the passes from the original render buffer.

This allows in-place modification of the guiding passes needed
by the denoiser without affecting the final render result pixels.

Pull Request: blender/blender#106668
2023-04-07 16:49:43 +02:00
ade103d7b8 Depsgrpah: Fix 'use after free' invalid access to stored keys names.
Stored `ComponentIDKey` and `OperationIDKey` would still use string
references (char pointers) to data in related IDs, instead of using the
already locally stored std::string name of their matching `ComponentNode`
or `OperationNode` for that.

During undo, to reduce updates and speedup undo steps, a lot of IDs get
'replaced in place', i.e. new data read from the undo memfile is moved
into the existing 'old' ID memory address. And the depsgraph is also
re-used from the old BMain.

Calling `DEG_id_tag_update` and similar on the ID could then cause
depsgraph code to access freed memory from the 'old' data.

Joint effort with @sergey and the rest of the depsgraph team, thanks!
2023-04-07 15:46:19 +02:00
abe86a6a5d Merge branch 'main' into node-group-operators 2023-04-07 08:14:34 -04:00
4ab7bb5b1f Fix : Show 'Exit group' menu entry also for non group nodes.
The Exit Group menu entry was mistakenly only whown for nodes who are
themselves also group nodes. It should be show for any node inside a
group.

Pull Request: blender/blender#106643
2023-04-07 13:09:33 +02:00
75c0e808b8 Fix #106103: Resolve texture paint selection in Metal
Issue caused by inconsistency in GPUFramebuffer viewport state
between Metal and OpenGL. The MTLFramebuffer code has been
modified such that framebuffer viewport/scissor state is retained
and only updated if attachments are modified during bind.

This is consistent with OpenGL. Previously, other updates to the
framebuffer in Metal would reset the viewport region, especially
if attachments were temporarily removed. This caused the color
picker selection to be misaligned.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#106619
2023-04-07 13:05:51 +02:00
d85520f297 Python: bl_ui_utils.layout.operator_context context manager
Introduce a context manager that temporarily overrides a UILayout's
operator context.

Instead of writing this:

```py
default_op_context = layout.context
layout.context = 'OTHER_VALUE'
layout.do_stuff()
layout.context = default_op_context
```

you can now write this:

```py
from bl_ui_utils.layout import operator_context

with operator_context(layout, 'OTHER_VALUE'):
    layout.do_stuff()
```

This is also exception-safe; it will always ensure the layout's operator
context is restored when the `with` body is exited, regardless of
whether that's done with an exception or regularly.

Idea in-the-hallway approved by @Sergey.
2023-04-07 11:34:48 +02:00
564418f6a4 UV: support for non-square bitmaps in uv packer, alpaca_rotate 2023-04-07 20:17:19 +12:00
520c112732 GHOST: comment on use of libunity for the taskbar in X11
While the DBUS API's libunity uses are still in wide use,
libunity.so it's self isn't. Note that we should use DBUS directly.
2023-04-07 13:39:19 +10:00
43476e2d71 UV: improve layout efficiency of uv packing when rotation enabled
Add rotation support to the `xatlas` strategy.
2023-04-07 13:33:58 +12:00
984da82283 Cleanup: format 2023-04-07 12:58:46 +12:00
fcd4b58427 CMake/Windows: Fix debug ONEAPI build
the debug dll does not have an _d just a regular d as postfix
issue introduced in 17800e0c03
2023-04-06 18:02:59 -06:00
dc71530d9c Core: Fix broken CustomData IO with Autosave files
Autosave files are created from memfile undo, which
doesn't save legacy mesh data. This leads to a crash
on file load.

In addition the mesh code can now add CustomData
layers when saving files, which did not work if
the original domain had no layers.  In that case
CustomData.layers is NULL and DNA has nothing to
key off of when loading the file later.

Pull Request: blender/blender#106648
2023-04-07 02:02:20 +02:00
3681ed377b Fix #106628: Use correct function to get active uv layer
CustomData_get_active_layer_index() was used by accident. But that
returns the CustomData layer index (in all layers) as opposed to
CustomData_get_active_layer(), which returns the active UV layer.

Pull Request: blender/blender#106644
2023-04-06 22:17:19 +02:00
972dad8fbf Cleanup: Add forgotten const to function parameter. 2023-04-06 21:32:41 +02:00
11ba8c6ab4 Fix #106622: Various errors filling cone/cylinder primitive faces
The change in 7966cd16d6 had a few logical mistakes.
2023-04-06 12:48:46 -04:00
a041297e54 Fix: build error after moving lightprobe.c to c++
Error introduced in 3dd24b9ae7

Pull Request: blender/blender#106635
2023-04-06 18:40:58 +02:00
3dd24b9ae7 Cleanup: Move lightprobe.c to c++
This is to allow clearner code in the new object-level lightprobe
cache. See #106449 .
2023-04-06 17:41:59 +02:00
390a63b264 Refactor: de-duplicate motion triangle vertices and normals computation
Barycentric coordinate convention was changed at some point, which is
reflected in `motion_triangle_shader.h` (1c2c468abc) but not in
`motion_triangle.h`, this is also fixed by sharing functions between the
two header files.

Pull Request: blender/blender#106629
2023-04-06 17:28:41 +02:00
65da3a3c5a Fix 106590: GPencil Paste stroke duplicates to the next selected
If the multiframe is not enabled, the loop must be not done or
the first selected frame is pasted too.

Now, the loop is only done in multiframe mode.
2023-04-06 15:30:24 +02:00
e9ec506890 Fix #106548: Repeat Last operator reuses orientation for extrusion
Check the specific case of `OP_IS_REPEAT_LAST` and recalculate
the orientation.

To that, pass the `OP_IS_REPEAT` and `OP_IS_REPEAT_LAST` flags as
inheritance to macro operators.
2023-04-06 15:17:03 +02:00
7d8740f06d Fix #103571: Force field absorption for rigid bodies
Force field absorption allows dampening of force fields by colliders, but it does not currently work when the scene only contains a rigid body simulation. It requires a particle simulation, cloth, dynamic paint, fluid sim, or softbodies for the feature to work correctly.

The reasons is that the effector function computing force field strength uses depsgraph relations to determine which colliders "absorb" the force field. If there are no dependencies between colliders and effectors registered in the depsgraph, the visibility function `eff_calc_visibility` does not add any absorption.

There is a function build_collision_relations which adds a dependency between the absorption object (the one with a collision modifier) and the forcefield object. It's currently only called by
1. Particle systems (DepsgraphRelationBuilder::add_particle_collision_relations)
2. Cloth, DynPaint, Fluid, and Softbody (DEG_add_collision_relations and indirectly through DEG_add_forcefield_relations).

The `DepsgraphRelationsBuilder` now adds the effector relations also when building rigid body relations.

Pull Request: blender/blender#106503
2023-04-06 14:49:04 +02:00
792da15d53 Fix #106394: motion triangles could have unnormalized normals 2023-04-06 13:48:45 +02:00
bd319f6561 Texture Paint: always respect edit mode hiding
Since e3801a2bd4, we would always respect
hiding for vertex paint and weight paint (drawing code and stroke based
painting), leaving an inconsistency between the different paintmodes.

To rectify this, now also always respect edit mode hiding for projection
painting as well.

Some feedback was gathered in #sculpt-paint-texture-module to ensure
this is desired behavior.

Note: this does not change the (experimental) texture painting in
sculptmode [this already respects hiding via PBVH, albeit in a manner
that bleeds into hidden faces if the brush center is over visible faces]

ref #106354

Pull Request: blender/blender#106544
2023-04-06 09:28:25 +02:00
ce9be92adf Fix 106278: Intel iGPU Crashes When Switching to Eevee
After investigating the crash logs it looked like the macro
unrolling wasn't working on Windows systems with these GPUs.

Macro unrolling was changed in order to cross compile to Metal and
in the future to Vulkan. The macro unrolling in OpenGL can be removed
by using a different naming scema.

This PR removes the macro unrolling by changing the generated GLSL
code:

**Before**
```
layout(std140) uniform _probe_block
{
  ProbeBlock probe_block;
};
```

**After**
```
layout(std140) uniform probe_block
{
  ProbeBlock _probe_block;
};
```

Some tweaks had to be done to the Eevee-shaders to make sure that
the macro unrolling is done correctly and could be compiled using
legacy opengl drivers.

Fix: #106278
Fix: #106555
(and others)

Pull Request: blender/blender#106535
2023-04-06 08:03:25 +02:00
Jon Denning
bbf756ddf1 Text Editor: update syntax highlighting for different Python strings
Python has several different string types [0], each using a prefix to
indicate the type. Presently Blender's Text Editor / syntax highlighting
does not include the prefix as part of the string, which makes the
prefix appear as a syntax error. This patch looks for these prefixes,
and includes them with the string highlighting.

Note: prefixes can appear in either case (ex: f and F mean the same
thing), and some prefixes can be combined (ex: fr is a raw f-string).

[0]: https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals

Ref D14739
2023-04-06 14:01:54 +10:00
68092297ca Cleanup: Remove unused DerivedMesh edges/corners code
The edge hash is only needed for the corner edge array,
and the mloop_index variable is unused.
2023-04-05 22:35:26 -04:00
d727f64ad2 PyAPI DocS: Fix source code link markup
FIxes blender/blender#106212#
2023-04-05 22:27:51 -04:00
a2b259aa2c Fix: Wrong attribute name used for corner edges array
My regex to check for this didn't catch the mistake because
the repetition was split between two lines.
2023-04-05 22:18:30 -04:00
63c0e1be31 UV: paste-uvs will return OPERATOR_CANCELLED if uvs were unchanged 2023-04-06 13:48:29 +12:00
6e1c048250 Fix #106314: warn user when paste-uvs fails to find a match
Pull Request: blender/blender#106606
2023-04-06 03:36:57 +02:00
2e878690e5 WM: include the GHOST backend in bug report when non-default
It wasn't possible to know if users were running X11/Wayland.
The field is omitted for WIN32 & APPLE.
2023-04-06 10:29:44 +10:00
d34abea26a Cleanup: format 2023-04-06 11:02:47 +12:00
b626f1fd18 Cleanup: use ".cc" & ".hh" extensions for intern/ghost 2023-04-06 08:29:57 +10:00
d1bbb32cb4 Fix #106602: Cyclic link in versioning code
Fix link from capture_node to node.

Pull Request: blender/blender#106605
2023-04-06 00:11:12 +02:00
9e01c4f69e List groups in menu, some crash fixes 2023-04-05 17:07:56 -04:00
302e858273 Fix #104507: Show Splash if New Version
Show Splash screen if there are no Preferences found even if we are
launched with a filename, so that users can migrate old settings.

Pull Request: blender/blender#105863
2023-04-05 22:35:05 +02:00
7212f52457 Progress 2023-04-05 16:33:47 -04:00
8f8548e964 Fix libs harvesting for Embree as a dynamic library
libembree4.so was missing from make deps target location.
2023-04-05 22:13:02 +02:00
70edef1311 Cycles: Fix Metal use-after-free bug
`entryPoint` was being used unsafely following its release.

Pull Request: blender/blender#106572
2023-04-05 21:50:14 +02:00
92c9c1d400 Fix #106568: Overlay: Resolve motion path rendering in Metal
Resolve small indexing issue in Metal implementation
of motion path line rendering.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#106595
2023-04-05 20:55:14 +02:00
51d48bdcdb Merge branch 'main' into node-group-operators 2023-04-05 14:14:42 -04:00
6cb5b14f16 Fix #106598: Cone primitive crash after MPoly removal
The sizes of the bottom faces weren't filled.
2023-04-05 14:11:18 -04:00
b288c4004e Cleanup: fix various Cycles compilar warnings
Mainly for the build configuration of the Hydra render delegate and
standalone repo.
2023-04-05 19:48:19 +02:00
920ffd3253 Cleanup: fix clang 10 compiler warning 2023-04-05 19:48:19 +02:00
a10ae5cf05 Progress 2023-04-05 13:34:31 -04:00
19051b863e Merge branch 'main' into node-group-operators 2023-04-05 11:55:48 -04:00
42a9c62bff Fix #106584: Active/default UV map legacy conversion with name conflict
The legacy conversion from MLoopUV to generic attributes used the
active and default layer names to copy the active/render status to the
new layers. But sometimes the names can change, and they weren't
updated in that case. Instead, store the active status with an index
into the names array (use an array instead of Vector for clarity).
2023-04-05 11:46:35 -04:00
18ad154cf9 Fix CUdeviceptr and hipDeviceptr_t build error on ppc64le architecture
Pull Request: blender/blender#106575
2023-04-05 17:42:01 +02:00
892f985227 Fix mismatch in Sequencer preview region versioning
Make the versioning for the sequencer preview region match the state of
new sequencers, the zooming range would be different.
2023-04-05 17:21:11 +02:00
56640440f0 Fix crash loading pre 2.5 test file (Cycles test failure)
fa0f295b53 exposed that there was a region missing because of some
faulty versioning.

The `fluid_motion_blur.blend` Cycles test file was crashing. Seems like
this is a pre 2.5 file that was resaved in newer versions, but the
preview region for the Sequencer was missing. Before mentioned commit,
the region would be broken when activating the preview view mode in the
Sequencer, now it would crash even on startup.

Ensure the region exists, as expected.
2023-04-05 16:57:56 +02:00
68ec019a40 Fix: Typos, grammar, writing style in UI messages
Issues reported by Joan Pujolar:

See the pull request for a full list of reasoning.

Pull Request: blender/blender#106580
2023-04-05 16:40:16 +02:00
4c66e0fe61 Fix windows tests failing due to comparison with NaN
which returns false on other platforms but true on windows with fast math
2023-04-05 16:00:03 +02:00
d17b1da572 Fix FindEmbree.cmake
When EMBREE_INCLUDE_DIR was cached, it ended up wrongly assuming it
was Embree 4.
2023-04-05 15:53:20 +02:00
8f0829f2a0 Cleanup: Remove accidentally committed TODO comment
Committed in fa0f295b53 but not necessary anymore. The regions are
creating in versioning already now.
2023-04-05 15:46:25 +02:00
ad031029cf Fix #106467: Crash when loading files with custom node groups
Loading a blend file containing custom material node groups crashed Blender.
See #106467 for more information.

Pull Request: blender/blender#106559
2023-04-05 15:36:24 +02:00
fa0f295b53 UI: Region polling support
Introduces *ARegionType.poll()* as a way to dynamically add/remove a region. The region is still there internally, but is not accessible to the user.

Previously editors would to this manually, by either removing/adding regions altogether, or hiding them, unsetting their alignment (so no AZones are added I assume) and removing their event handlers. Polling makes this much simpler.

We plan to use this in #102879.

This patch refactors multiple editors to use region polling:
- File Browser
- Sequencer
- Clip Editor
- Preferences

Notes:
- Previously, editors would lazy-create some of the regions. Versioning is added here to ensure they are always there. Could be a separate patch.
- Some editors reuse a region in different display modes, and so additional work needs to be done to reinit regions they become available or the mode changes. Typically `V2D_IS_INIT` is unset for that, which isn't great. Could be improved, but not a new issue.

Behavior change:
- When the Preferences are opened as a regular editor, the "execution" region in the preferences that displays the *Save Preferences* button would still be there, but empty with a scrollbar.
  This patch makes it disappear entirely.

## Implementation

- Introduces `ARegionType.poll()`
- Before a window is drawn, all contained regions have their poll checked, and the result is stored in a flag (`RGN_FLAG_POLL_FAILED` - runtime-only flag).
- If the result of the poll changes, the area is re-initialized and event handlers are added/removed.
- UI code checks the flag as needed.

Pull Request: blender/blender#105088
2023-04-05 15:30:32 +02:00
075d92184b Cleanup: correct comment, quiet warnings 2023-04-05 20:11:08 +10:00
a76bf65c9d Cycles: Refactored GPU denoising code
To prepare for OIDN2 with GPU support, some of the code that was exclusive to the OptiXDenoiser is being moved to the DenoiserGPU superclass.

Co-authored-by: Stefan Werner <stefan.werner@intel.com>
Pull Request: blender/blender#106496
2023-04-05 11:19:15 +02:00
9e9baa9085 Cycles: Upgrade to new Embree 4 while staying compatible with Embree 3
For more information about Embree 3->4 API changes:
https://github.com/embree/embree/blob/master/doc/src/api.md#upgrading-from-embree-3-to-embree-4

This is not yet enabling HW RT on Arc GPUs using Embree, which is worked on in blender/blender#106266

Co-authored-by: Nikita Sirgienko <nikita.sirgienko@intel.com>
Co-authored-by: Stefan Werner <stefan.werner@intel.com>
Pull Request: blender/blender#105974
2023-04-05 11:03:06 +02:00
2c446d2de3 Cleanup: use bool for render pipeline & related API's
Also add doc-string for RenderEngine::reports.
2023-04-05 17:52:28 +10:00
7e99470a85 Fix headless render silently failing when called from Python
Any errors from calling `bpy.ops.render.render(write_still=True)` would
be suppressed, making it impossible to know what went wrong.

Now the operator now reports errors when run via `exec` which mainly
occurs when the operator is called from scripts.

Interactively rendering via `invoke` is left as-is since users can see
the error in the UI and showing a popup error is disruptive.
2023-04-05 17:42:19 +10:00
a245e294a3 Fix missing assets in the source archive
The assets are required to build proper Blender release, so they can not be
skipped from packing.

The packing ignores the `working` directory as it seems to be big and sounds
that it is not needed for the release.

The assets are bundled under the `release/datafiles/assets` folder in the
blender sources. This is where they will reside after switch to the Git LFS.

Pull Request: blender/blender#106536
2023-04-05 09:27:42 +02:00
440cccecdc Cleanup: spelling in comments 2023-04-05 14:39:51 +10:00
d683665095 Cleanup: compiler warnings 2023-04-05 14:23:54 +10:00
8216623e25 Build: bump wayland to v1.22
Use the latest Wayland version, resolves inverted track-pad scroll
direction #104272 by adding support for physical scroll direction.
Updates to GHOST/Wayland have already been made.
2023-04-05 14:04:18 +10:00
1ad98ac65e Merge branch 'main' into node-group-operators 2023-04-04 18:02:37 -04:00
dec9c593cb Cleanup: Use generic index copying utility for normals 2023-04-04 17:22:14 -04:00
f594e951e0 Cleanup: Use generic mesh corner to poly map utility 2023-04-04 17:01:19 -04:00
e785d956c4 Fix: Crash loading autosave/last session file after MPoly removal
We need to check CustomData for the MPoly layer rather
than the deprecated mesh customdata pointer.
2023-04-04 16:13:39 -04:00
4b2ea18ec9 Cleanup: Deduplicate OffsetIndices utility for meshes and curves
The "reverse map" of corners to faces and points to curves is the same
for meshes and curves now. Move it to the offset indices header to
reflect this.

This unification can go further in the future, but I'd rather wait
until the design is clearer for now.

Pull Request: blender/blender#106570
2023-04-04 22:12:17 +02:00
8d0920ec6d Cycles: Optimize extraction of Blender attributes
Similar to 4bcd59d644. This probably got worse recently with
the generic attribute refactors for `Mesh`, but the final performance is
probably much better than older versions too.

Timings extracting attributes from a 16 million vertex grid (seconds):
- Corner float attribute: 0.72 -> 0.19
- Face float attribute: 0.60 -> 0.07
- UV map: 3.18 -> 0.05
2023-04-04 15:38:12 -04:00
6652d2ee9b Cleanup: Remove unused DerivedMesh vert normals calculation 2023-04-04 14:52:41 -04:00
2887557907 Cleanup: Remove unused DerivedMesh functions
Unused after 7adea7ee15.
2023-04-04 14:52:02 -04:00
6f2263bc79 Cleanup: Remove unused DerivedMesh variables
`needsFree` was always set to `true`, and same with `deformedOnly`,
but it was also never even used.
2023-04-04 14:47:39 -04:00
7966cd16d6 Mesh: Replace MPoly struct with offset indices
Implements #95967.

Currently the `MPoly` struct is 12 bytes, and stores the index of a
face's first corner and the number of corners/verts/edges. Polygons
and corners are always created in order by Blender, meaning each
face's corners will be after the previous face's corners. We can take
advantage of this fact and eliminate the redundancy in mesh face
storage by only storing a single integer corner offset for each face.
The size of the face is then encoded by the offset of the next face.
The size of a single integer is 4 bytes, so this reduces memory
usage by 3 times.

The same method is used for `CurvesGeometry`, so Blender already has
an abstraction to simplify using these offsets called `OffsetIndices`.
This class is used to easily retrieve a range of corner indices for
each face. This also gives the opportunity for sharing some logic with
curves.

Another benefit of the change is that the offsets and sizes stored in
`MPoly` can no longer disagree with each other. Storing faces in the
order of their corners can simplify some code too.

Face/polygon variables now use the `IndexRange` type, which comes with
quite a few utilities that can simplify code.

Some:
- The offset integer array has to be one longer than the face count to
  avoid a branch for every face, which means the data is no longer part
  of the mesh's `CustomData`.
- We lose the ability to "reference" an original mesh's offset array
  until more reusable CoW from #104478 is committed. That will be added
  in a separate commit.
- Since they aren't part of `CustomData`, poly offsets often have to be
  copied manually.
- To simplify using `OffsetIndices` in many places, some functions and
  structs in headers were moved to only compile in C++.
- All meshes created by Blender use the same order for faces and face
  corners, but just in case, meshes with mismatched order are fixed by
  versioning code.
- `MeshPolygon.totloop` is no longer editable in RNA. This API break is
  necessary here unfortunately. It should be worth it in 3.6, since
  that's the best way to allow loading meshes from 4.0, which is
  important for an LTS version.

Pull Request: blender/blender#105938
2023-04-04 20:39:28 +02:00
17800e0c03 CMake/Win: use manifest for PLATFORM_BUNDLED_LIBRARIES
`PLATFORM_BUNDLED_LIBRARIES` was installing right next to the blender
executable rather than the `blender.shared` folder,
`PLATFORM_BUNDLED_LIBRARIES` wasn't used very much on windows, just
by the ONEAPI code which likely wasn't aware this plumbing was
still missing.

This diff adds support for using `PLATFORM_BUNDLED_LIBRARIES` on
windows in both debug and release configurations.

You can differentiate between a .dll being installed for debug/release
or all configurations, by prefixing the library with either `DEBUG`,
`RELEASE` or `All`, if no prefix is given `ALL` is assumed.

Pull Request: blender/blender#106348
2023-04-04 20:10:06 +02:00
4b15f2158f Cleanup: Cycles: LightTree: Fix warning about unused variables 2023-04-04 20:01:55 +02:00
1ae54bb4fd Fix MSVC C1001 error after texture sampler refactor
This patch fixes the MSVC C1001 error that was introduced after
ff3b2226fb.

Pull Request: blender/blender#106554
2023-04-04 18:20:44 +02:00
412b6a8f65 Fix #106430: Index the right UVmap in BMesh
When accessing UVmaps from python in BMesh, the UVmap name/index was ignored
and the active UVmap always used. This fixes this by passing the layer index
to the underlying CustomData function.

Pull Request: blender/blender#106537
2023-04-04 18:10:11 +02:00
7adea7ee15 Cleanup: Removed DerivedMesh triangle cache
This was only used in a single place, multires baking, where it's simple
to just retrieve the looptris from the temporary `Mesh` that we already
create to simplify accessing normals. This allows removing a bunch of
complexity from `DerivedMesh`, to help progress towards its complete
removal at some point in the future.

Also use `Span` more instead of raw pointers in multires baking,
and pass around the spans instead of the low-resolution DerivedMesh.
2023-04-04 11:26:14 -04:00
85bd64ece4 Fix: Crash and broken multires baking
Caused by 16fbadde36. The first mistake was passing a pointer
to a poly to what was meant to be the pointer to the start of the array.
Use Span instead to avoid that confusion. The second was a logic error
in CCGDerivedMesh's lazy initialization of corner data. The data was
copied when the mesh is created so it wasn't initialized.
2023-04-04 11:16:04 -04:00
547f0d5dab Cleanup: Use const arguments for DerivedMesh functions 2023-04-04 11:11:54 -04:00
87cbdcbe7c Refactor: move part of light tree logic from #LightManager to #LightTree 2023-04-04 16:24:21 +02:00
e58a05ca68 Refactor: renaming a few light-tree-related variables
primitives -> emitters, `index` -> `node_index`
2023-04-04 16:24:21 +02:00
6f60b09f51 Vulkan: Enable Step-by-Step Debugging in Renderdoc.
This PR adds debug information inside the spir-v assembly to enable
step-by-step debugging of Shaders using renderdoc. The debugging
information can be fairly large so are only generated when used
with the `--debug-gpu-renderdoc` feature.

During debugging shader optimizations are turned off.

Pull Request: blender/blender#106546
2023-04-04 15:58:41 +02:00
f94599c095 Fix #106478: Missing xray check in snapping
Regression caused by 98bfa8d458

The `XRAY_ENABLED(v3d)` check was lost during a modification to
`transform_snap_context_project_view3d_mixed_impl` function.

This caused vertex snapping in solid shading to jump between visible
and occluded faces.

Pull Request: blender/blender#106495
2023-04-04 15:40:48 +02:00
ff3b2226fb GPU: Refactor texture samplers
This patch refactors the texture samples code by mainly splitting the
eGPUSamplerState enum into multiple smaller enums and packing them
inside a GPUSamplerState struct. This was done because many members of
the enum were mutually exclusive, which was worked around during setting
up the samplers in the various backends, and additionally made the API
confusing, like the GPU_texture_wrap_mode function, which had two
mutually exclusive parameters.

The new structure also improved and clarified the backend sampler cache,
reducing the cache size from 514 samplers to just 130 samplers, which
also slightly improved the initialization time. Further, the
GPU_SAMPLER_MAX signal value was naturally incorporated into the
structure using the GPU_SAMPLER_STATE_TYPE_INTERNAL type.

The only expected functional change is in the realtime compositor, which
now supports per-axis repetition control, utilizing new API functions
for that purpose.

This patch is loosely based on an older patch D14366 by Ethan Hall.

Pull Request: blender/blender#105642
2023-04-04 15:16:07 +02:00
d0604a1bb2 Fix #106530: Don't try to move unmovable node socket values
Missing checkings for unsupported cases.

Pull Request: blender/blender#106545
2023-04-04 14:23:40 +02:00
96c8fcde0f Vulkan: Reduce Macro Unrolling In GLSL.
Related to #106535 where a similar fix was done for OpenGL. A small
cleanup that might reduce the complexity during GLSL shader compilation.

Pull Request: blender/blender#106538
2023-04-04 14:04:09 +02:00
09effd579b Renderdoc: Use Main Context Workaround.
Renderdoc requires all calls/updates to originate from the same
context. It also doesn't support multithreading. For now we
enable main context workaround.
2023-04-04 13:27:41 +02:00
fc46d6408f GPU: Use --debug-gpu-renderdoc For Renderdoc Integration.
The renderdoc integration used to be behind the `--debug-gpu`
command line option. When using `--debug-gpu` outside renderdoc
error messages where displayed that aren't relevant.

This PR adds a specific command line option for the renderdoc
integration. This option will also enable `--debug-gpu`.

Pull Request: blender/blender#106541
2023-04-04 12:46:47 +02:00
d872240983 Fix #106528: light tree nodes could have a NaN axis
Caused by collinear vectors not detected due to numerical issue.
2023-04-04 12:40:28 +02:00
d030d12d7b Vulkan: Fix Compilation Error on Windows Platforms.
Automatically conversion not working. Replacing `begin` with
`data` would solve this issue.

Pull Request: blender/blender#106539
2023-04-04 12:13:01 +02:00
58c54b5859 Fix #106396: UV stitch crash with hidden faces
This was the case with hidden faces and `Sync Selection` turned ON.

Caused by 8f543a73ab.

Since 8f543a73ab, the UV element map
respects the hidden state of geometry, but stitching [which also
respected this on its own even prior to the culprit commit in its
calculation of connectivity] did this differently [it only skipped
hidden geo when UV_SYNC_SELECTION was OFF -- even though UVs would not
be visible which is probably the real error here, I believe there is
this principle that we "dont act on stuff we dont see"].

To fix this, also skip hidden geo (even with UV_SYNC_SELECTION = ON) in
the stitch calculation of connectivity, just as
`BM_uv_element_map_create` does it.

Should go into 3.3 LTS as well.

Pull Request: blender/blender#106493
2023-04-04 12:10:30 +02:00
f2f8884f95 CMake: reset WAYLAND_PROTOCOLS_DIR when it's missing the reference XML
Depending on newer API's could cause build failure for existing
builds using wayland-protocols outside of Blender's 'lib' directory.
Now the existence of the most recent XML file is checked on each CMake
execution, resetting the cache when not found so the protocols in
`../lib/linux_x86_64_glibc_228/` will be used instead.
2023-04-04 19:15:00 +10:00
cf9f3919a8 I18n: fix add-on extraction when UI code appears in __init__.py
The function which collects files to process in add-on extraction
returned only files that did not start with '_', in the case where the
add-on was a module in a directory. This excluded __init__.py, which
may very well contain UI code, so an exception is added for this case.

This change currently allows the extraction of 42 new messages.
2023-04-04 10:07:02 +02:00
648417bfff GHOST/Wayland: improve internal fractional scaling behavior
Logic for the recently included fractional scaling support [0] was
difficult to reason about as it depended on two different callbacks
one that listened to a preferred scale, another that tracked which
physical displays the window overlapped.
Checking if fractional scaling was in used depended on the order
the callbacks ran - which is undefined.

In practice - mixing non-fractional and fractional displays would
flicker when the window was moved between monitors.

Resolve this problem with the following changes:

- When the fractional-scale manager is supported,
  only respond to the scale from it's preferred_scale callback.
- When no fractional-scale manager is available,
  set the scale based on the scale of overlapping outputs.
- Add support for postponing the buffers commit call to prevent
  flickering when changing the windows scale.

Other changes:

- Use a lock before setting the pending frame state from
  wp_fractional_scale_handle_preferred_scale.
- Ensure pending actions that themselves trigger pending actions
  run in the time gwl_window_pending_actions_handle is called.
- Rename GWL_Window::scale -> GWL_WindowFrame::buffer_scale.

[0]: cde99075e8
2023-04-04 17:35:42 +10:00
95ffc4ba3a GHOST/Wayland: remove fractional-scale ifdef's
Depend on fractional-scale when searching for wayland-protocols

This will impact builders that don't use Blender's `../lib/` and
have wayland-protocols older than v1.31.
2023-04-04 17:26:37 +10:00
d2ad00d0f5 Cleanup: remove unused RenderData::stereomode 2023-04-04 17:26:37 +10:00
ececd71fb2 Cleanup: remove references to the Blender Game Engine Player 2023-04-04 17:26:37 +10:00
b5a7724262 Fix #105268: Avoid creating redundant dependencies for the lattice modifier
For some reason, lattice modifier always depend on self object transform.
This fix just move extra dependencies in to if case statement, also some
cleaning of this code area.

Pull Request: blender/blender#105293
2023-04-04 09:25:51 +02:00
b1bf1db656 Fix source_archive ignoring addons
Caused by the changes in the submodules configuration.

Can no longer rely on the `git submodule` command to
show list of external references to be packed.

Needs to be backported to 3.5.1.

Pull Request: blender/blender#106502
2023-04-04 09:14:58 +02:00
e952083652 Fix #105989: Outliner: Make Single User duplicates data
This happens even though there is only one user.

The Outliner only implements this `Make Single User` for worlds
(`singleuser_world_fn`) and actions (`singleuser_action_fn`) [it is
questionable if the whole functionality could be removed really, but
this is for another report] and it uses `id_single_user` to do so --
this function does not check if we even have more than one user though,
so data gets duplicated resulting in duplicate worlds or actions even if
they only have one user and shouldnt be touched.

Now let `id_single_user` check usercount and only act if we have more
than one real users.

Pull Request: blender/blender#105991
2023-04-04 09:12:37 +02:00
14b112ef82 Fix #106422: Mesh Data Attributes Using tip_ for iface_
pgettext_tip incorrectly imported as iface_ instead of importing
pgettext_iface. These leads to incorrectly translated attribute text
shown when the user elects to translate only tooltips.

Pull Request: blender/blender#106507
2023-04-03 20:55:22 +02:00
3e8f85c743 Fix: VSE Channels region unhides when changing font
Caused by filebrowser calling space `refresh` function. The intention of
refresh function was mainly to hide channels when view type is changed.
Unhiding channels when view is changed back seems logical, but this
causes issues when region is too thin, which results in hiding side
panel, which is more important.
2023-04-03 19:46:10 +02:00
9726e4a0ad Nodes: Move data-block default values with link drag search
When creating nodes by dragging a link, it can be convenient to
transfer values from input socket. For reference values, like images,
this may be necessary to avoid unnecessary data-block users. This
patch starts adding such a system. At this moment this only makes sense
for one node (Image Input), but this can be extended to work with other
reference types, different non-reference types and support auto-casting
(if a float is transferred to the Integer Input node).

See task: blender/blender#102854
Original patch: https://archive.blender.org/developer/D16735

Pull Request: blender/blender#105972
2023-04-03 19:33:39 +02:00
e7f395dd20 Nodes: Add dropdown to select group socket subtype
Previously the only way to control the subtype was to remove the group
input or output and create it again. This commit adds a dropdown to
change an existing socket, for supported socket types.

Based on a patch by Angus Stanton: https://developer.blender.org/D15715

It was necessary to fix the UI code slightly; the layout's context
wasn't being used in calls to an operator's enum items callback.

Pull Request: blender/blender#105614
2023-04-03 18:23:30 +02:00
4cb670e68f Fix #105148: Cycles Metal memory leak on AMD GPU
After NanoVDB support from 02c2970982, this line should not have been
removed.
2023-04-03 18:18:01 +02:00
7a1ec82af4 Cleanup: Remove poly normal writing
The potential optimization in the normal edit modifier when flipping
faces isn't worth the "API impurity" and complexity introduced by
adding poly normal editing as part of the API. This change simplifies
future changes to the ownership of poly normals with a shared cache,
which can prevent recomputing poly normals completely.
2023-04-03 12:11:21 -04:00
e76f4d9f9a Mesh: Use more efficient update tag when flipping faces
Vertex positions and faces aren't changed, so most caches shouldn't
need to be tagged. This removes unnecessary re-computation of bounds,
triangulation, loose edges, etc.

Pull Request: blender/blender#106250
2023-04-03 18:01:16 +02:00
da6dfc2b43 VSE: Clarify why frame range is drawn differently than in other editors. 2023-04-03 17:44:04 +02:00
45f7e2b6ba Fix Snap package error on startup in older Linux version
With the new glibc requirement, the core version needs to be increased.
2023-04-03 17:32:35 +02:00
dbf1049d41 Cycles: bump version to 3.6.0 2023-04-03 17:32:35 +02:00
861debcb10 Fix Cycles standalone and Hydra build issues in some configurations
Bring the build in sync with the Cycles standalone repo.
2023-04-03 17:32:35 +02:00
Alex Fuller
4f0092c1ff Refactor: add native Cycles Normalize option on lights for Hydra
Make it a native Cycles light option instead of counter-acting the inverse
area calculation in Hydra.

Differential Revision: https://developer.blender.org/D16838
2023-04-03 17:23:46 +02:00
Alex Fuller
945579c203 Fix Cycles build issue with USD 23.02
HdRenderDelegate got a change with the interface, adding gpuSupported. It
currently is just a dummy implementation without checking for anything
GPU-related.

Differential Revision: https://developer.blender.org/D17207
2023-04-03 17:23:46 +02:00
Alex Fuller
cbf3bd0efc Fix Cycles missing geometry header in object header, causing crashes
The problem is that `set_geometry()` otherwise ends up implicitly
casting `Geometry*` to bool. In Blender this worked because the
geometry header was always included before the object header.

Differential Revision: https://developer.blender.org/D16737
2023-04-03 17:23:46 +02:00
8833f5dbf9 Animation: Allow NLA strips to be horizontally shuffled
Allows NLA strips to horizontally translated over each other. If a strip is dropped when translating, it'll cause the strip to shuffle into place.

---

Abstracted large conditional branch in `recalcData_nla` into it's own `nlastrip_fix_overlapping` method for increased readability. No logical changes were made.

---
[Archived Phabricator Patch](https://archive.blender.org/developer/D10102)

Pull Request: blender/blender#105532
2023-04-03 17:10:37 +02:00
4bcd59d644 Cycles: Avoid overhead from RNA when extracting mesh data
Use raw Blender structs and mesh data rather than using the RNA API.
There isn't any benefit from using the RNA when Cycles is compiled
with Blender anyway, and a profile showed that the majority of time
was spent in Blender RNA API functions.

This gives a significant improvement in performance when ingesting
meshes. Here are some tests of the runtime of the `create_mesh`
function (in seconds):

|                           | Before | After |
| ------------------------- | ------ | ----- |
| Grid                      | 0.66   | 0.11  |
| Many realized cubes       | 2.60   | 0.48  |
| Large curve to mesh setup | 4.18   | 1.14  |

Also change to resizing the arrays and filling them by index rather
than appending. This makes the parallel aspect of the logic clearer,
and makes the loops easier to parallelize in the future, and makes
it easier to have a performance benefit when an attribute like
`sharp_face` doesn't exist.

Pull Request: blender/blender#106275
2023-04-03 17:04:58 +02:00
1380ee74ff Overlay: use edge-connected polygons to calculate wireframe factor
Use the dot product of the normal of the two polygons connected to the
edge to calculate the edge factor.

This fixes #90641 and #102545 and ensures more predictable results for
boundary and non-manifold edges.

Co-authored-by: Germano Cavalcante <mano-wii>
Pull Request: blender/blender#105352
2023-04-03 16:22:41 +02:00
d1fe11c79f DRW: remove edges hidden by Optimal Display in IBO creation
No functional changes.

Edges hidden by Optimal Display are hidden by edge factor Shader.
But there is not much advantage in doing this, as the number of edges
hidden by the Optimal Display is usually much higher than the number of
visible edges.

And the lines extractor does not include invisible edges due to other
factors.

So this change makes:
- Visibility test more consistent with what is actually seen.
- Smaller buffer for IBO sent to GPU
- consistency with GPU Subdivision that already considers Optimal Display
- Allows possible improvement in the "Edge Factor" extraction by making
it unnecessary to check the Optimal Display (except for optimization).

Co-authored-by: Germano Cavalcante <mano-wii>
Pull Request: blender/blender#106402
2023-04-03 15:59:41 +02:00
d1ec8a2ae5 I18n: translate popover descriptions
Popover menu buttons had their labels translated but not their
descriptions, although they were properly extracted.

This commit fixes that using the `TIP_()` macro.
2023-04-03 15:55:48 +02:00
da764ee357 I18n: translate viewport grid unit
This information is displayed in the top left of the 3D Viewport with
other text info. The units of the grid are already extracted, but they
were not translated in the drawing code.
2023-04-03 15:28:16 +02:00
e4cd7d2fed Updated translations from SVN trunk (r6419). 2023-04-03 12:58:50 +02:00
e05010b2f2 Cleanup: make format on new install_linux_packages py script.
Also some minor fixes to generator for version numbers of packages.
2023-04-03 12:00:13 +02:00
f692010ae1 Cleanup: remove redundant call to #free() for light tree arrays 2023-04-03 11:48:09 +02:00
b81472d20f Cleanup: remove useless comments
Remove comments from `eBConstraint_Types` that
- were used long ago during a big refactor effort, but are no longer
  necessary, or
- just repeated the name of the enum constant.

No functional changes.
2023-04-03 11:24:39 +02:00
1205111fe9 Refactor: move #object_usable_as_light() from #LightManager class to #Object
so that the function can also be used by other classes.
Also change `!bounds.valid()` to `!is_traceable()` so zero-sized objects
are skipped.
2023-04-03 11:16:00 +02:00
4aed240b02 CMake: Disable Options Depending on OpenEXR Dependecies
OpenEXR has some dependecies that other other modules in Blender
requires. When disabling OpenEXR these dependecies could not match
and building blender would fail.

This PR disables the next options when `WITH_IMAGE_OPENEXR=Off`

- `WITH_OPENVDB`
- `WITH_ALEMBIC`
- `WITH_VULKAN_BACKEND`
- `WITH_CYCLES_OSL`

Additionally windows stores the IMath libraries in `IMATH_LIBRARIES`
Linux and Mac stored the IMath libraries in `IMATH_LIBRARY`. This
change will also adds `IMATH_LIBRARIES` variable to all platforms.

Pull Request: blender/blender#106209
2023-04-03 09:50:50 +02:00
8954df63ef Fix #106431: Resolve Metal workload dependency
Splitting workload dependency chains such that they
only exist within the context of a single frame.
Dependencies are required to ensure sequential
command buffer submissions execute in order,
but the additional dependencies between frames
could incur GPU timeouts, if a signal was delayed.

This could be triggered by both CPU/GPU cycles
texture updates and Viewport Compositor operations.

Should also resolve #106401

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#106443
2023-04-03 08:53:42 +02:00
682cb6ecd3 Metal: Optimize SSR shader for Apple Silicon
Reduce register spill to global memory in raytrace_resolve
function. Results in a 20% uplift for this particular shader on
Apple Silicon GPUs. Contributing to 3-5% uplift for scenes
which have SSR enabled. This is achieved via reducing
memory pressure using a packed data type for the sampling
kernel.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#106231
2023-04-03 08:37:24 +02:00
dc63f75837 Fix #106414: Handle mat==None case in GPencil Change Active Material operator
Some material slots could be empty, the operator could encounter a python
exception. Now fixed.

Pull Request: blender/blender#106418
2023-04-02 17:08:50 +02:00
45104ddd14 Cleanup: Remove code asserted as unreachable,
This piece of code has been assserted as unreachable for 3 years now,
time to clean it up.
2023-04-01 20:17:26 +02:00
8a364ef72c Fix (unreported) misisng handling of XR data object pointer in foreach_id.
Very sadge to see this kind of mistakes still exist in 2023 code...

While in theory this commit could be backported to (LTS) releases, would
rather only do it if/when proven it actually fixes user-facing issues.
Fixing such issues so deep in ID management code can have completely
unexpected side effects.
2023-04-01 20:10:48 +02:00
7592ec35d3 GPU: Fix compilation with option WITH_GPU_BUILDTIME_SHADER_BUILDER
Breakage caused by 84c93f3a06
2023-04-01 17:16:54 +02:00
e652d0002b GPU: FrameBuffer: Fix empty framebuffer update
The framebuffer default size was only set during the first bind. This
is because the `dirty_attachments_ tag` wasn't set and thus the
framebuffer size was never passed down to the GL.

Split to `default_size_set()` to not affect other code paths that use
`size_set()`.
2023-04-01 13:24:48 +02:00
897a735151 BLI: Rotation: Add CartesianBasis transform_point and invert 2023-04-01 13:24:35 +02:00
957ac41237 Fix #78396: Pack UVs to original bounding box
Adds the ability to pack UVs back into the original bounding box.

Choose UV Editor > Menu > UV > Pack Islands

Then change "Pack To" to "Original bounding box"
2023-04-01 21:13:58 +13:00
531f99ffbd UV: simplify uv packing api and simplify uv packing
Fix #invert_m2_m2 with repeated arguments.

Change UV Packing to use {pivot, half_diagonal} representation.
2023-04-01 11:35:07 +13:00
6778460e53 Fix #106323: Snap to Face Nearest not working
Face Nearest only works with individual projection, so always set the
`SCE_SNAP_PROJECT` flag in this case.

Also gray out the `Project Individual Elements` option in the UI if
`Face Nearest` is enabled.

And change the description to indicate that `Project Individual Elements`
is always enabled with the `Face Nearest` option.

(I feel a better design for this option needs to be considered).
2023-03-31 17:30:26 -03:00
f898c22349 Fix #106363: snap toggle affecting operators not set to 'Affect'
Regression due 88e2542398.

Although the "Non-Affect" operators continue to use incremental,
this snapping should not be enabled by default.
2023-03-31 16:32:53 -03:00
389025bee2 Cleanup: Use consistent type in function definition 2023-03-31 14:24:23 -04:00
1a956ce196 Cleanup: Mode most of MOD_nodes.cc to the blender namespace
Avoid introducing another `::modifiers` namespace for now, since it's
not clear if we'll want that long term. This just avoids a bunch of
boilerplate and makes things easier to read.
2023-03-31 13:19:37 -04:00
60cac27ccc Cleanup: Use helper function to create AttributeFieldInput 2023-03-31 13:00:51 -04:00
1113a25d1f Cleanup: Make geometry nodes execution functions more reusable
Use the node group and the properties as arguments instead of
the modifier. This may help to allow reusing the functions outside
of the modifier execution context.
2023-03-31 12:53:21 -04:00
96e8f8a002 Some progress 2023-03-31 12:32:59 -04:00
4c19994c11 Merge branch 'main' into node-group-operators 2023-03-31 11:58:07 -04:00
7d548b5735 Refactor: Cleaning up NLA Draws Non_solo boolean option
Refactor: Clean up boolean logic naming in nla_draw to be more readable.
Pull Request: blender/blender#106119
2023-03-31 17:49:26 +02:00
0187943a3d Animation: Weight Paint select more/less for faces
This adds the select more/less operators to the weight paint mode face selection.

Just like in edit mode, press `CTRL`+`Numpad Plus/Minus` to use them.
They have also been added to the `Select` menu.

Pull Request: blender/blender#105607
2023-03-31 14:53:00 +02:00
0d1a0cb453 Animation: Weight Paint select more/less for vertices
This adds the select more/less operators to the weight paint mode vertex selection.

Just like in edit mode, press CTRL+Numpad Plus/Minus to use them.
They have also been added to the Select menu.

Pull Request: blender/blender#105633
2023-03-31 14:47:57 +02:00
0face8bd22 Fix #105912: Texture paint removes evaluated mesh attributes
When retrieving the evaluated mesh to paint on, it can be reevalauted,
where a smaller set of attributes are requested than for regular
evaluated meshes. That reevaluation should be completely removed
(see #106186), but a simple fix in the meantime is to manually
request that data.
2023-03-31 08:15:58 -04:00
7775fecb14 Animation: Graph Editor - grey out area outside of normalization range
When normalization is enabled in the Graph Editor,
the area outside the -1/1 range on the y axis isn't meaningful.
To visually represent that this patch greys out that area
just as it does with anything outside the current frame range.

Pull Request: blender/blender#106302
2023-03-31 13:54:32 +02:00
324ba509b5 Fix: don't access 4th element of float3
The issue here is that `float3` implicitely casts to `float *`
which is then passed into the `float4` constructor.
2023-03-31 11:41:05 +02:00
ca0ec55d59 Update license document. 2023-03-31 11:39:39 +02:00
b73ae802fb Fix OBJ test expectations after fast_float.h update 2023-03-31 11:36:25 +03:00
e1426e6319 Externals/IO: update fast_float.h to latest version
fast_float.h currently is only used by OBJ, STL and PLY I/O importers.
Update it to the latest release from upstream (from 3.4.0 2020 Nov to
4.0.0 2023 Mar).

No behavior changes, but they have optimized the performance a bit.
Importing a 6-level subdivided Suzanne OBJ file (330MB) goes from 3.5sec
down to 3.2sec on Win10, Ryzen 5950X, VS2022 build.
2023-03-31 11:03:13 +03:00
cde99075e8 GHOST/Wayland: add fractional-scale interface support
Previously, fractional scaling was detected but set an integer buffer
scale which the compositor would down-scale causing blurry output.

Now the fractional scaling interface is used when available to set the
DPI and set the internal buffers size & viewport transformation to
ensure 1:1 pixels from Blender to the Wayland output.

Tested to work with multiple monitors with mixed
fractional/non-fractional scale.

Note that this change causes a regression for when fractional scaling
is set on a compositor without support for fractional-scale-v1.
Supporting fractional scaling in both cases is possible but overly
complicated. This case already wasn't working so well - with blurry
output due to image scaling, now the DPI wont be accurate in this case
although Blender is still usable.
2023-03-31 13:03:50 +11:00
75127f9b09 Build: upgrade wayland protocols to 1.31
Needed for fractional-scale-v1 protocol.
2023-03-31 13:02:54 +11:00
a9d15ee8a0 Cleanup: pass rect as a constant pointer 2023-03-31 13:02:53 +11:00
7c67f8c719 Progress 2023-03-30 19:17:05 -04:00
cf77874cdb Merge branch 'main' into node-group-operators 2023-03-30 18:52:25 -04:00
498287bca0 Cleanup: Geometry Nodes: Split modifier property update function
It's a bit easier to follow this way, and we can make better use of
const. It's also more reusable in case we have to use it elsewhere
too (for node group operators?).
2023-03-30 18:51:33 -04:00
3d5ba79050 Cleanup: Use const arguments for IDProperty functions 2023-03-30 18:51:33 -04:00
7e748413f9 Add no-op operator base 2023-03-30 18:38:33 -04:00
ed0e4f4043 UV: refactor uv packing, reduce usage of #BoxPack
No functional changes.
2023-03-31 10:09:48 +13:00
41c5490137 Merge branch 'main' into node-group-operators 2023-03-30 16:34:46 -04:00
cbb813886c Geometry Nodes: Simplify retrieval of node dependencies
Use checks for certain node types with better algorithmic complexity.
They should perform better in some edge case with a lot of nodes or
node group nesting. They're now a bit more similar to each other too.
2023-03-30 16:30:23 -04:00
76e0ca6b91 Build: suppress CMake warnings about newer Boost versions
This is the only package that warns about this type of thing, and gets in the
way of actual warnigns on build logs. This requires CMake 3.19+ to take effect,
older versions still show the warnings.
2023-03-30 22:29:14 +02:00
40f050aadc UV: simplify packing usage of #BoxPack
No functional changes.
2023-03-31 09:02:01 +13:00
f6e89233a3 Workbench: Optimize texture usage flags
Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#106229
2023-03-30 21:49:41 +02:00
ec94b1da58 Metal: Optimize texture usage in glutil
Ensure compression is enabled by using shader_read
flag only. Also ensure that MTLTexture contents
remain in optimal layout for reading after any
data modifications.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#106234
2023-03-30 21:45:45 +02:00
338db40df9 Merge branch 'main' into node-group-operators 2023-03-30 15:25:08 -04:00
1658b8ab46 Fix Cycles Metal failing when run in parallel, always run serial
The command buffer fails to execute, the cause is unknown. It does not
appear to be related to the binary archive cache as disabling that does
not prevent the issue.

Pull Request: blender/blender#106328
2023-03-30 19:46:49 +02:00
55d642ba2f Fix non-deterministic behavior of mask compositor node
The issue was caused by uninitialized offset used for the scale
variable.

Follow the rest of the usages of the operation which initialize
it explicitly. This makes it very safe and easy fix to backport
to any LTS or corrective release.

Ideally should probably initialize all members in the class
itself, to avoid such situations in the future.

Pull Request: blender/blender#106325
2023-03-30 18:57:22 +02:00
a145d1563a Cleanup: move flip faces code from nodes to geometry module 2023-03-30 18:44:11 +02:00
55d473ee40 Cleanup: use better default name for unknown parameter
The `<` and `>` don't work well when the name is inserted into a .dot graph.
2023-03-30 18:44:11 +02:00
bdc3f1581d Fix #106261: When geometry output is viewed the cycling operator picks wrong sockets.
The cycling method for the viewer connection starts searching from the next socket
after the last current connection. If a geometry socket is is the last connected
output this caused the method to jump to the next socket after the geometry,
potentially skipping over valid data sockets that are not viewed yet.

The solution is to ignore the geometry sockets in the cycling entirely and only
consider data sockets (i.e. non-geometry sockets).

Pull Request: blender/blender#106318
2023-03-30 16:56:56 +02:00
8785862ee4 Replace install-deps bash script by a python one, and only handle distro packages.
This tool now only supports installing packages, it won't build any
dependency anymore. This implies that on most distributions, it wont
make a complete Blender build possible, some features will likely be
misisng.

By default, it only install basic dev environment to enable building
Blender with the precompiled libraries (which is the recommended way).

Passing the `--all` option will make it try to install all known
dependencies from distro packages. This is a development option,
regular Blender build should be done with the precompiled libraries.

Tested on Debian Testing, Arch, Fedora and Suse Tumbleweed.

With the new design, it should be fairly trivial to add more
distributions if desired, and maintenance should also be way simpler.

NOTE: side effect is that a working python3 interpreter is expected on
system running this script. In practice this should not be an issue,
since Python3 is installed by default in almost all regular desktop
linux installations.
2023-03-30 16:30:45 +02:00
be733c240e Animation: Insert Keyframe only on active FCurve
The insert key operator allowed to insert a keyframe on all selected FCurves
and on the Active FCurve at cursor value.
But it didn't allow to insert a keyframe only on the active FCurve.

This patch adds that. It is available in the redo panel and under Key->Insert Keyframes (which can also be called with the I hotkey)

Pull Request: blender/blender#106307
2023-03-30 16:29:50 +02:00
12b001ebce Fix OBJ tests using release folder
This change aimed to solve the following issues:

- Possible threading issue of two tests writing to the same
  file, depending on how the ctest is invoked

- Test using the release directory, and potentially leaving
  temp file behind on test failure, breaking code sign on
  macOS.

Pull Request: blender/blender#106311
2023-03-30 15:55:01 +02:00
8f1925c2f6 Cleanup: make format 2023-03-30 15:28:21 +02:00
f9b9430982 Fix: Crash when loading 3.4 autosave file
The MVert to float3 vertex position conversion was skipped using
the wrong case, mesh->mvert wasn't always set when writing
apparently.
2023-03-30 08:37:05 -04:00
80319035e6 Fix: Debug assert extracting multiple UV maps in edit mode 2023-03-30 08:24:29 -04:00
7eda8e5367 Fix: unnecessary edge pan updates
Found together with a fix for #106043.

Edge panning (in Node Editors, Outliner and VSE) does unnecessary
updates when the view has not changed at all. This includes adding
`MOUSEMOVE` events (even if you dont move the mouse at all).

Adding `MOUSEMOVE` events results in the transform system constantly running (even if you dont move the mouse) which we certainly want to avoid.

Rectify this by only calling these updates when the view changes.

Pull Request: blender/blender#106301
2023-03-30 14:08:57 +02:00
2a6f177e8e Fix #106043: Moving frame node jittering while cursor is still
The fix for #105363 (6d3ce8273a) made the transform system respect
(Frame) nodes `offsetx`/`offsety`.

Now Node Editors run the transform system even if the mouse is still (due to edge panning -- unnecessarily, see PR #106301 for fixing this). And due to the way `frame_node_prepare_for_draw` recalculates these offsets (based on
on updated positions and `node.runtime->totr` [which in turn gets rounded in `node_update_basis` -- so subpixel precision is lost there, see [1]]), this can lead to slight imprecisions/noise/jitter during transform (if we use float offsets, see the PR for more info).

So to counter this, use rounded offsets now [which will keep the whole circle stable].

NOTE: PR #106301 would fix this already for having the cursor still, but this patch still improves slight jitter when moving, so will commit separately.

[1] comment from `node_update_basis`
> /* Round the node origin because text contents are always pixel-aligned. */

Pull Request: blender/blender#106096
2023-03-30 14:02:45 +02:00
d90795bc3c Asset System: New "weak" asset reference for storing in .blend files
No user visible changes expected.

For brush assets, we need a way to store a reference to a brush in .blend files, so that the last active brush can be restored from the file. See #101908. It seems like a generally useful thing to have.

Adds a new DNA struct to store a "weak" asset reference, that is, a reference that can break under a number of circumstances, but should work reliably enough under normal usage. There's no way to reliably reference an asset currently, so this works on a "best effort" basis. It can break when assets are moved inside the asset library, asset libraries are unregistered from the Preferences, or a file is opened on a different machine with different Preferences, for example. It can also break currently if an asset library is renamed.
It contains:
- Information to identify the asset library the asset can be found in.
- A relative "identifier" (currently a relative path) for the asset within the asset library.

There's further code to resolve a weak reference to file paths and Blender library paths.

Part of #101908.

Co-authored-by: Bastien Montagne <bastien@blender.org>

Pull Request: blender/blender#105603
2023-03-30 12:25:42 +02:00
a12a8a71bb Remove "All Rights Reserved" from Blender Foundation copyright code
The goal is to solve confusion of the "All rights reserved" for licensing
code under an open-source license.

The phrase "All rights reserved" comes from a historical convention that
required this phrase for the copyright protection to apply. This convention
is no longer relevant.

However, even though the phrase has no meaning in establishing the copyright
it has not lost meaning in terms of licensing.

This change makes it so code under the Blender Foundation copyright does
not use "all rights reserved". This is also how the GPL license itself
states how to apply it to the source code:

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software ...

This change does not change copyright notice in cases when the copyright
is dual (BF and an author), or just an author of the code. It also does
mot change copyright which is inherited from NaN Holding BV as it needs
some further investigation about what is the proper way to handle it.
2023-03-30 10:51:59 +02:00
7e940f184f Animation: Auto frame curves Y extents when hitting normalize
When hitting the "normalize" button in the graph editor, set the y extents of the view to the extents of the `FCurves`.
Previously you had to search for your curves after pressing that button.

Pull Request: blender/blender#105857
2023-03-30 10:01:12 +02:00
d9de76f5d1 Cleanup: PLY exporter headers cleanup
Move private functions out of headers, cleanup unnecessary includes,
forward declarations instead of includes where possible, avoid global
variables.
2023-03-30 09:56:23 +03:00
0fcecc5c1e Cleanup: use methods to convert to/from window scale
Simplifies adding support for the fractional-scale protocol which
requires events to be fractially scaled.
2023-03-30 17:36:31 +11:00
3cfc3eab93 UV: fix unreported, bad uv packing with convex shape_method.
Pivot wasn't set with convex shape_method when an island has only one triangle.

Regression from 86b1e5e3b6
2023-03-30 12:35:45 +13:00
9ea6771d10 Cleanup: simplify sorting during uv packing
Prevent double-sorting during uv packing with bounding-box packing.

Slight speed improvement, slight packing efficiency improvement.
2023-03-30 12:23:49 +13:00
a62f6c8290 Fix out-of-bounds array access when building with GHOST_OPENGL_ALPHA
While this is off by default, best replace hard coded sizes to avoid
out of bounds access if the enum is expanded.
2023-03-30 09:51:44 +11:00
abb879175e Fix #106283: several uv operations producing missing uvs
Uninitialized memory, regression from in p_flush_uvs [0]

[0] 8ac67a798b
2023-03-30 10:28:41 +13:00
7b94e86dd9 PLY: improve UV values merging in the exporter
Similar to recent OBJ UV values merging commit (05a63e3705) - build
mapping of (vertex, UV) by going over the face loops directly, instead
of using BKE_mesh_uv_vert_map_get_vert and then having an additional
map on top. Provide the mapping into ready to use flat arrays, instead
of building a map and then building arrays out of that in a separate
pass.

While at it, avoid the extra cost of building all this complicated
mapping when we don't have or are not exporting UVs.

Timing tests on exporting several models into binary PLY file
(Win10, Ryzen 5950X):

- Suzanne subdivided to level 6 (2.1M verts): 0.93s -> 0.68s
- Rungholt Minecraft level (9.7M verts): 3.3s -> 2.3s
- Stanford Lucy 3D scan (14.0M verts, no UVs): 5.2s -> 1.5s
2023-03-29 23:00:06 +03:00
5f61eca7af Cycles: Exploit non-uniform threadgroup sizes on Metal
This patch replaces `dispatchThreadgroups` with `dispatchThreads` which takes care of non-uniform threadgroup bounds. This allows us to remove the bounds guards in the integrator kernel entry points.

Pull Request: blender/blender#106217
2023-03-29 21:46:11 +02:00
8eb9d5342f Fix build error on Ubuntu 20.04 with Wayland after recent changes
The system wayland-protocols version is too old, and xdg-activation-v1.xml
is a more recent addition than xdg-decoration-unstable-v1.xml so check for
that.
2023-03-29 20:28:37 +02:00
944a5854c6 Cycles: Fix MetalRT shadow all hit bug
This patch fixes a MetalRT issue where viable shadow hits are discounted based on the false assumption that hits are ordered by distance. With this patch, the following unit tests now pass:

- openvdb smoke
- shadow catcher pt transparent lamp only 0.8
- shadow catcher pt transparent lamp only 1.0

Pull Request: blender/blender#106276
2023-03-29 20:20:07 +02:00
8ce3bb6e05 Fix: Curves: crash when requesting write access for attribute from multiple threads
This is preparation for #106228, the crash does not happen in `main` currently.
The issue was `positions_for_write` might make a copy of the data if it was
shared. This operation is not thread safe on a single mesh. The solution is to
get write-access to the positions only once before threading starts.
2023-03-29 18:40:13 +02:00
84c93f3a06 Cleanup: use eCustomDataType instead of int
This makes the APIs more correct and simplifies debugging, because
some debuggers can now show the enum name instead of the integer.

Pull Request: blender/blender#106268
2023-03-29 17:10:49 +02:00
431d9858c5 Cleanup: Retrieve const custom data layers 2023-03-29 11:09:14 -04:00
5efa39096c Fix #106134: Broken triangulation without cached face normals
Logic broken in 16fbadde36
2023-03-29 11:09:14 -04:00
d32d787f5f Clang-Format: Allow empty functions to be single-line
For example

```
OIIOOutputDriver::~OIIOOutputDriver()
{
}
```

becomes

```
OIIOOutputDriver::~OIIOOutputDriver() {}
```

Saves quite some vertical space, which is especially handy for
constructors.

Pull Request: blender/blender#105594
2023-03-29 16:50:54 +02:00
cc7634f2ea Cleanup: deduplicate code 2023-03-29 09:47:41 -03:00
bb2c89b20d Fix #106251: "Shift to extend" doesn't work in 3D View Collections panel
Regression in [0], use shift to initialize the extend option when unset.

[0]: d7dd7403a8
2023-03-29 20:05:44 +11:00
c0a252b833 Fix #105895: UI scaled down with 125% fractional scaling on Wayland
The DPI returned by the GHOST/Wayland didn't account the buffer being
rendered at a higher (non-fractional) resolution, then scaled down.

This caused the software cursor and UI to rendered very small.
A fractional scale of 101% would show the UI just over 50% of the size
(making the UI to be close to half the scale it should have been).

Resolve by accounting for down-scaling of the buffer to it's
fractional size.
2023-03-29 17:48:53 +11:00
68d146d57d Fix error in WM_capabilities_flag (all capabilities were set)
Mistake in [0] caused the flag not to be reset.

[0]: 4e51008a82
2023-03-29 17:33:38 +11:00
86b1e5e3b6 Cleanup: simplify uv packing api 2023-03-29 17:09:36 +13:00
2bc331981d Cleanup: function style casts, remove UNUSED(..) & use nullptr in C++ 2023-03-29 14:37:53 +11:00
1ddbe7cadd Cleanup: move doc-strings into headers, remove duplicates
In some cases move implementation details into the function body.
2023-03-29 14:37:34 +11:00
ce659dbc4e Cleanup: use doxygen sections 2023-03-29 14:17:32 +11:00
35f770a689 Cleanup: duplicate words in comments 2023-03-29 14:17:32 +11:00
43f6df853f Merge branch 'blender-v3.5-release' 2023-03-28 22:52:27 -04:00
7d0251ed9a Fix #105855: Crash with node add menu assets and keyboard navigation
The UI needs persistent pointers to catalog paths that it can pass
around via context. It was trying to manage this in own storage, but
this didn't work. Not entirely sure why - the menus get redrawn
continuously while assets load, and the root menu rebuilds the mentioned
storage every time. Maybe the submenus redraw a bit later, or the
keyboard navigation handling still accessed data from a previous redraw
somehow.

Either way, instead of managing own catalog path storage, point into the
asset system, which already has persistent storage for the catalog
paths.

Pull Request: blender/blender#106237
2023-03-28 22:36:30 -04:00
df824e2015 Cleanup: use function style casts
Missed in 901a804f9e.
2023-03-28 23:10:11 -03:00
901a804f9e Cleanup: convert 'view3d_navigate.c' to C++
Anticipate porting this file as changes are planned to it and we are
gradually porting files to C++.
2023-03-29 04:02:16 +02:00
8d16e8f726 Merge branch 'blender-v3.5-release' 2023-03-28 16:33:34 +02:00
6e51f8d202 Fix Python Module build on Windows
Don't install libraries in blender.shared and don't generate manifest
as it's not working and not important to have a clean directory here.

Always detect MSVC_REDIST_DIR as it is used by oneAPI. The way
InstallRequiredSystemLibraries is called it already only sets some
variables and doesn't install anything by itself.

Pull Request: blender/blender#105999
2023-03-28 16:32:25 +02:00
Sebastian Herholz
ac0ed09735 Fix #104329 viewport render with path guiding crashes
This is a workaround fix for Open PGL 0.4.1 when the first volume
samples are collected in a later training iteration.

The problem is fixed in Open PGL > 0.5.0 and the workaround
can be removed after upgrading Open PGL.
2023-03-28 14:45:35 +02:00
a58c951c98 Merge branch 'blender-v3.5-release' 2023-03-28 14:30:12 +02:00
45c16f43ad Fix #105953: division by zero in quadriflow leads to crash
The bug was found by ASAN when running the file from #105953. It's not
entirely clear what the root issue for the division by zero is, but
at least now the result is more predictable.

Pull Request: blender/blender#106165
2023-03-28 14:25:19 +02:00
d81d743537 BLI: support == and != for Set
This makes it more convenient to check if two sets contain the same keys.
2023-03-28 14:16:57 +02:00
fbcddfcd68 BLI: add core types for supporting implicit-sharing
The overall goal is to use implicit-sharing in many places in Blender
that currently do unnecessary copies. See #95845 for more details.

This commit only adds the base data structures in blenlib and uses those
in `GeometrySet` and `AnonymousAttributeID`, which used a more ad-hoc
version of implicit sharing already. #105994 lists some more places where
support for implicit sharing can be added (most notably: custom data layers).

Pull Request: blender/blender#105994
2023-03-28 13:57:51 +02:00
1987cbb12a Merge branch 'blender-v3.5-release' 2023-03-28 13:41:43 +02:00
aa7293f555 Update license doc for OIIO lib update. 2023-03-28 13:40:39 +02:00
3d49d738b7 Fix references to some nodegroups from new essentials staying around.
Previous fix/hack a60f651502  made it so that all 'Fake User' linked
IDs are considered as directly linked, so that some IDs (like linked
Text) references are not lost on file save becaus they are not
effectively used.

However, this created unwanted references to all linked assets data,
because an asset always has its fake user set. This ended up keeping
lots of references to sub-assets when appending from the new Essentials
node groups.

NOTE: This is adding another hack to the collection, the whole handling
of 'which unused linked data reference to keep on file save' needs to be
reworked for Blender 3.6.
2023-03-28 13:29:03 +02:00
57712d7b18 Fix #106177: modal operator does not work from Node menu
This was an issue with the `operator_context`. It's a bit confusing because it
looks like every `uiLayout` has its own, but in `uiLayoutSetOperatorContext`
you can see that the `operator_context` is always set on the root layout for
some reason.

The fix is to set `INVOKE_REGION_WIN` as the operator context after it has been
set to something else (I found this to be the default by printing the operator
context before it was changed).

Pull Request: blender/blender#106213
2023-03-28 13:13:30 +02:00
0256bfd309 UI: Support minimum row count for tree views
No user visible changes expected.

With this, empty rows will be added to the tree view so that the
background box is at least a few lines high (like with UI lists). If the
view is used as a drop target, data can be dropped on these empty rows
too then.
This was requested for the Cycles light linking project.
2023-03-28 12:39:24 +02:00
3ea5a8fbb9 Fix #105590: Compositor: Masks don't consider anamorphic aspect ratio
This PR adds support for anamorphic aspect rations when using
masks. As viewport compositor doesn't support masks yet, this
has not been added yet.

Pull Request: blender/blender#106121
2023-03-28 12:36:14 +02:00
aa69ec7f80 Vulkan: Clearing Framebuffer + Scissors
This PR adds support for clearing framebuffers and scissor testing.
Tweaks had to be made to VKTexture to keep track of its layout
on the device. Based on the actual call the layout can switch
to a more optimum layout.

For example during upload of a texture the texture will be converted
to a transfer destination optimized layout. When reading from the
texture it will be converted to a transfer source optimized layout.

The order of the attachments in the framebuffer follows the next rules

- When only color attachments are there the color attachments will
  be placed in the slot they are defined. This way it will match
  the ShaderCreateInfo binding location.
- When a stencil/depth attachment is added it will be placed
  right after the color attachments. When there isn't a color
  attachment it will be the first attachment.

Pull Request: blender/blender#106044
2023-03-28 11:51:32 +02:00
eb9ab4fae4 Refactor: draw code for anim channel widget
A few small refactors of the `draw_setting_widget()` function for drawing
animation channel widgets (like 'modifier mute', etc.)

- Use `const` where appropriate.
- Move some variable declarations to their actual use, to clarify their
  scope and make it possible to use `const`.
- Return earlier where possible, which should improve performance as some
  unnecessary code gets skipped.

No functional changes.
2023-03-28 11:19:30 +02:00
a64877f045 Vulkan: Added prerequisite checks for using VK_Layer_Validation
This PR adds pre-checks when enabling validation layers.

For validation layers to work some platforms require that
the Vulkan SDK is installed. Validation layers are activated
when running blender with `--debug-gpu`.

Sometimes we expect users to run with `--debug-gpu` for
narrowing down an issue and we cannot expect them to have
the Vulkan SDK installed.

This patch will check if the `VK_LAYER_PATH` is available
and that the configuration file of the validation layer is
present. If this isn't the case we don't activate the
requested validation layer.

Pull Request: blender/blender#105922
2023-03-28 10:45:44 +02:00
f8e190aac5 Cleanup: Silence Compilation Warnings
In recent Vulkan changes.

Pull Request: blender/blender#106204
2023-03-28 08:53:56 +02:00
a88c77eaac Cleanup: use struct comments for gwl_registry_handlers declaration 2023-03-28 17:05:25 +11:00
1cf2ad8e15 Fix #106203: Memory leak with dynamics enabled in particle edit mode
particle_batch_cache_init was called with allocated memory in
ParticleBatchCache. Now particle_batch_cache_clear frees all allocated
memory.
2023-03-28 16:58:50 +11:00
3071ec486b GHOST/Wayland: support window activation
Calling render (for example) with an existing window open now activates
the window on Wayland. Tested to work on GNOME & KDE.

Use the xdg-activation protocol which typically brings the
window to the foreground.

Partially resolves #102985.
2023-03-28 16:08:10 +11:00
8132b4a927 GHOST/Wayland: GWL_Seat::data_source_serial when modifiers are set
All keyboard/cursor events should set the data_source_serial,
also update doc-string.
2023-03-28 16:05:32 +11:00
4ee705ca4f Cleanup: use a system method to access the APP_ID
Move the app-id out window initialization code.
Make it possible for other methods to access the APP_ID.
2023-03-28 16:05:31 +11:00
10b03e66b9 Cleanup: remove unreachable code 2023-03-28 15:57:48 +11:00
4bead379c6 Cleanup: remove redundant (void) in C++ function declarations 2023-03-28 15:57:48 +11:00
2ec4ce18ae Cleanup: use 'override' specifier for GHOST: X11, SDL & None with CLANG
Clang would warn about failure to use 'override' when a single
method was added that used 'override' when none of the other methods
did.

This meant a single correct use of override caused noisy compiler
warnings (for CLANG but not GCC).
Avoid this by using 'override' where appropriate.
2023-03-28 15:57:48 +11:00
47e065f165 Cleanup: quiet unused but set warnings with CLANG 2023-03-28 15:57:48 +11:00
bbcfdb844c Cleanup: quiet strict-prototypes warning with CLANG 2023-03-28 15:57:48 +11:00
1b0816929f Cleanup: quiet unreachable-code-generic-assoc warnings with CLANG
Duplicate types in type checking macros caused many warnings.
2023-03-28 15:57:48 +11:00
5379c0aa00 Fix particle system creating over-sized KD-tree
Particles were counted but the result was ignored.
2023-03-28 15:57:48 +11:00
55f6c97185 Fix redundant memcmp in BLI_array_store, correct assertion
Assert failed in BLI_array_store_test, failing to compare chunks
caused an unnecessary memcmp call in rare cases.
2023-03-28 15:57:48 +11:00
8ac67a798b Cleanup: Simplify aspect ratio usage in uv unwrapper
Replace `aspx` and `aspy` with `aspect_y`.

No functional changes.
2023-03-28 15:52:34 +13:00
ceaaf7f0ca Cleanup: format 2023-03-28 15:05:54 +13:00
16576beb22 Fix: Mistake in mesh vertex normal dirty tag in previous commit
The "clear dirty" call was removed, that shouldn't happen (yet!).
2023-03-27 19:56:21 -04:00
9bb6f92fe0 Cleanup: Use Vector for metaball tessellation vertex data
Avoid manually reallocating arrays here, and simplify future changes
to the ownership and assignment of mesh vertex normals.
2023-03-27 19:48:04 -04:00
b828641a93 UV: Add alpaca_rotate variant for improved packing efficiency
Improvements to packing efficiency and updating UV packing API.

* Add #pack_islands_alpaca_rotate, the fast alpaca-style packer with rotation.

* Update heuristic for sorting islands based on longest edge.
(Improves pack efficiency when rotation is enabled.)

* Add `aspect_y` to UV Packing API, to support non-square materials in the future.

Pull Request: blender/blender#105977
2023-03-28 00:35:27 +02:00
00bb30c0e9 Geometry Nodes: Copy cached no loose edge status in realize instances
When all of the input meshes have no loose edges, the output won't have
any either, but finding that out for the output is much more expensive.
Copy this tag to the output mesh to save processing time when drawing.
In my test creating 1 million instances of a 16 face mesh, this changed
the time for the draw cache loose geometry extraction from 220 ms to
131 ms.

For now, only do this when the loose edges of the inputs are already
cached (primitive nodes, for example). This avoids paying the cost of
calculation when we don't know it will be necessary.
2023-03-27 16:40:04 -04:00
63689e4756 Geometry Nodes: Tag no loose edges after curve to mesh node
It doesn't take much time to know whether all of the curves have more
than a single point, and if that's the case, we know for sure there are
no loose edges in the mesh. This can save time when creating the mesh
draw cache. The time for finding loose geometry goes from 180 ms to
104 ms for a large molecular nodes test file.
2023-03-27 16:39:33 -04:00
52eced3eef Geometry Nodes: Slightly improve curve to mesh performance
For the single-threaded part of the curve to mesh conversion, avoid
writing to two logically separate arrays in the same loop. Instead
run the calculation on two separate threads if the output is large.

Timing for `calculate_result_offsets` when processing 1 million curves:
Before: Average: 10.4 ms, Min: 9.4 ms
After: Average: 9.2 ms, Min: 7.7 ms
2023-03-27 15:53:34 -04:00
de5ec852f3 Merge branch 'blender-v3.5-release' 2023-03-27 14:52:51 -04:00
ba4442ef41 Fix #105965: Add fur modifier properties missing UI data
Currently assigning values to IDProperties clears their UI data.
That is fixed by #106161, but that is too risky for 3.5. Instead,
work around the issue by triggering `MOD_nodes_update_interface`
function which recreates the UI data of the modifier properties.

Pull Request: blender/blender#106190
2023-03-27 20:51:35 +02:00
59c0e19db2 Geometry: Skip recomputing bounds after translation
Now that mesh primitive nodes calculate their bounds in constant time,
it's worth updating the bounds eagerly when translating a geometry
since doing so should be very cheap and might save a more significant
amount of time if they're needed later.

Also slightly unify the translation functions for the different types.

Pull Request: blender/blender#106159
2023-03-27 20:51:01 +02:00
05a63e3705 OBJ: improve UV values merging in the exporter
Previous code was using BKE_mesh_uv_vert_map_get_vert to somewhat
detect identical UV values on mesh vertices. But this was not
handling the case when separate mesh vertices still use the same UV
values (e.g. cube with all six faces mapped to whole image).

Replace usage of BKE_mesh_uv_vert_map_get_vert with a simple "unique UV
value" map, very similar to how OBJ normals are calculated for export.

Measurements on a somewhat extreme case: exporting "Rungholt" Minecraft
level from https://casual-effects.com/data time (Win10, Ryzen 5950X)
goes 2.9sec -> 2.2sec, and resulting file size 486MB -> 231MB. This
particular model has a lot of mesh faces mapping to the same places
in UV map.

On less extreme cases the timings are similar between old and new
code, with a tiny speedup in most tests I've tried.
2023-03-27 21:39:13 +03:00
8ad0935ed6 Fix #106108: Allow Arrow Increment on Sequence Values
Allow clicking the "up" and "down" arrows to increment/decrement by a
frame for Video Sequencer strip Frame Start, Strip Offset Start, and
Strip Offset End.

Pull Request: blender/blender#106117
2023-03-27 20:26:56 +02:00
2215ee9358 UI: Noto Emoji Font with Unicode 15.0 Updates
Updated version of our monochrome Noto Emoji (variable) font with 31
new emojis that were released as part of Unicode 15.0

Pull Request: blender/blender#106142
2023-03-27 20:05:44 +02:00
bb67d4c298 Transform: expose hardcoded 'Rotate Normals' key
"Rotate Normals" is a changeable operation like any other and does not
need to be hardcoded.

An advantage of exposing this modal is that the shortcut key now
appears in the header when rotating an edited mesh.
2023-03-27 14:38:47 -03:00
040ea1637d Cleanup: deduplicate code that changes transform mode
Avoid calling `restoreTransObjects`, `resetTransModal`,
`resetTransRestrictions` and `initSnapping` for each change.

Also bring `applyMouseInput` close to the rest of the code.
2023-03-27 14:05:59 -03:00
7af13f0ae9 Cleanup: remove unnecessary code
Since `t->values_final` was created, `t->values` is no longer changed
by the mode, so the solution in dfaf26412d is no longer needed.
2023-03-27 14:05:59 -03:00
195c2b77ae Transform: modify constants for improved readability
No functional changes.

The lack of organization in the values of the constants that indicate
the properties was prone to errors.

One error that can be noticed is that the values of
`P_ORIENT_AXIS_ORTHO` and `P_VIEW2D_EDGE_PAN` were the same.
(not really a problem though)
2023-03-27 14:05:59 -03:00
6cfc43fd76 Merge branch 'blender-v3.5-release' 2023-03-27 18:49:43 +02:00
3ea5006416 Updated from SVN trunk (r6409). 2023-03-27 18:49:00 +02:00
2bbb483b5c Merge branch 'blender-v3.5-release' 2023-03-27 19:35:01 +03:00
14efe70004 Fix #106128: OBJ exporter crash when a mesh only has loose vertices
UV attribute refactor in 6c774feb has changed the logic from "UV data does not exist" to "there's no active UV layer". The repro mesh has a UV layer, but not UV data due to the mesh being only a point cloud.

Pull Request: blender/blender#106185
2023-03-27 18:31:53 +02:00
fea567651b Fix building Blender with some versions of gcc.
Seems like quadriflow was missing a header, which somehow made the build
fails on Suse Tumbleweed (gcc 13).
2023-03-27 18:29:39 +02:00
1af3c16962 Cleanup: Use const pointers for evaluated meshes
Helps with the fix to #105912
2023-03-27 11:48:10 -04:00
efda95840d Cleanup: Remove unused variable 2023-03-27 11:42:23 -04:00
b27ffee8f3 Fix #105917: Correct compositing map range clamp tooltip
The tooltip of the map range node in the compositing section was displaying that the output value was between 0.0 and 1.0 whereas it is between To Min and To Max value so I just changed the string.

Pull Request: blender/blender#105924
2023-03-27 16:20:30 +02:00
39dfa015a0 Geometry Nodes: Add node editor option to edit "Operator" node groups
This functions as a way to avoid having the context affect which node
groups are displayed. This is necessary since there is no concept of an
active operator and most node groups could be used as an operator.

It was considered to make this a more general "No Context" option for
the node editor. That still might happen eventually, but we want to
encourage users to use the modifier context since it allows the
various inspection features to work properly.
2023-03-27 10:02:15 -04:00
0a4b5eb73e Fix: Compiling Shader Builder.
IMath is required for building with vulkan. This patch adds
dependencies to shader_builder for now.

Currently there is a difference between windows and other OS's in
which variable the library is stored. Might be because imath isn't
a direct dependecy. As this is a compilation error I did the quickest
solution and check with platform module what would be the best solution.

Pull Request: blender/blender#106180
2023-03-27 15:53:20 +02:00
ad7ca08e0a Merge remote-tracking branch 'origin/blender-v3.5-release' into main 2023-03-27 10:28:22 -03:00
1bd4a3c9f3 Fix #106141: crash when duplicating a node
Regression introduced at 19b63b932d

The crash happened in `gizmogroup_xform_find` because
`t->region->gizmo_map` was `nullptr`.

The `T_NO_GIZMO` flag was supposed to prevent the
`gizmogroup_xform_find` function from being called, but it was being
removed with `t->flag = t->flag & ~T_PROP_EDIT_ALL;`.

This is because 19b63b932d missed updating the maximum enum value in
`ENUM_OPERATORS`.

The fix is simply to set the correct maximum value in `ENUM_OPERATORS`.
But for more safety, `gizmogroup_xform_find` now returns early when the
region does not have `gizmo_map`.

Co-authored-by: Germano Cavalcante <germano.costa@ig.com.br>
Pull Request: blender/blender#106174
2023-03-27 14:51:40 +02:00
6b67b81de4 Fix #106131: invalid selection after select random curves operator
The order of the arguments to `VArray::ForSingle` was reversed.

Pull Request: blender/blender#106172
2023-03-27 13:38:33 +02:00
7a1f2fd680 Timeline: draw cache in overlay so that it stays in sync with actually cached data
Before this, when the animation is playing and the set of cached frames
changes the timeline is out-of-date which can be confusing.

Now the cached frames are redrawn whenever the current-frame indicator is
redrawn. This fixes the issue but also causes redraws when they are not necessary.
Currently, that does not seem to be an issue,

Pull Request: blender/blender#105986
2023-03-27 11:00:42 +02:00
3b4725fb62 Fix #106094: Snap curves to surface operator does not update geometry
Snapping changes positions, but these were not tagged for update.

Pull Request: blender/blender#106104
2023-03-27 09:37:57 +02:00
3d06905ac4 Realtime Compositor: Use luminance coefficients in SMAA
This patch utilizes luminance coefficients in the SMAA edge detection
phase to match the existing implementation in the CPU compositor.
2023-03-27 09:10:51 +02:00
c42370d577 Fix: Glare has an offset on low quality settings
When using the Low or Medium settings on the Glare node, the generated
glare has an offset toward the lower left corner of the image. That's
because the shader erroneously has logic that assumes non-normalized
coordinates, so its offsets are in the pixel space of the original
image. To fix this, we just use a fixed 0.5 offset in the output pixel
space to evaluate at the center of pixels.

In the future, we might look into using a more advanced downsampling
scheme to avoid temporal instability, which is a new requirement due to
the viewport compositor.
2023-03-27 08:51:02 +02:00
bb2dc141f2 Cleanup: spelling in comments 2023-03-27 12:08:14 +11:00
99d7816d06 Cleanup: suppress clang-tidy warnings in GHOST_Types.h 2023-03-27 11:07:27 +11:00
4e51008a82 GHOST: replace multiple functions with a single capabilities flag
Adding checks for platform capabilities involved adding functions
to multiple classes and was too involved.

Replace this with a single GHOST_System::getCapabilities() function.
2023-03-27 11:01:20 +11:00
2f4a7d67b7 Realtime Compositor: Implement Anti-Aliasing node
This patch implements the Anti-Aliasing node by porting SMAA from
Workbench into a generic library that can be used by the realtime
compositor and potentially other users. SMAA was encapsulated in an
algorithm to prepare it for use by other nodes that require SMAA
support.

Pull Request: blender/blender#106114
2023-03-26 16:59:13 +02:00
8c1090aeb0 Merge branch 'blender-v3.5-release' 2023-03-25 14:20:43 -07:00
16cb13b8a0 Fix: Vertex paint filter operators broken undo
Vertex paint's filter operators were not properly going through the SculptSession API.
Undo didn't work; sometimes the operators would do nothing or produce corrupted colors.

The `transform_active_color` helper function now handles all of this.  It ensures a valid
SculptSession exists and executes an undo push.

Reviewed By: Hans Goudey
Pull Request: blender/blender#106136
2023-03-25 22:10:10 +01:00
847bc5c2fd Cleanup: DRW: Utility defines for retopology overlay
Move some retopology overlay logic to defines which can be reused
elsewhere.

Pull Request: blender/blender#106129
2023-03-25 15:34:09 +01:00
9678e6e7e5 Fix: Variable size blur implicitly works with Fast Gaussian
If the variable size option of the Blur node was previously set to true
and the type of blur was later set to Fast Gaussian, variable size blur
will take effect, even though the option is not visible to the user.

This patch fixes the issue by disabling variable size blur when the blur
type is set to Fast Gaussian.
2023-03-25 11:41:22 +02:00
51bc44420b Cleanup: format 2023-03-25 11:22:36 +13:00
c685d1935a Fix #106041: fix uv packing performance on aligned quads
More improvements to the xatlas "witness" mechanism.
2023-03-25 11:20:27 +13:00
18232af3ee Transform: Improve workaround used in #40241
Prefer `invoke` over `modal` to initialize a value that doesn't need to
be computed again.

Also avoid repeated `source_operation` checks.
2023-03-24 17:06:33 -03:00
1d84216c09 Fix #105891: Faster Font Fallback Finding
An improved strategy for finding glyphs within our font fallback stack.

Pull Request: blender/blender#106011
2023-03-24 19:55:28 +01:00
9c8cb823a0 BLI: Fix compilation when importing BLI_math_rotation.hh
It worked until now because `<iostream>` was included by other headers
before the rotation ones. But this didn't work in all cases. This commit
make sure all rotation type headers include it.
2023-03-24 17:42:34 +01:00
4eb24a4da3 Cleanup: Graph Editor "Gauss" to "Gaussian" 2023-03-24 16:18:09 +01:00
c4832af274 Fix: paintface_mouse_select not calling finish()
Every time you selected a face in weight paint mode
it would give a warning.
2023-03-24 15:37:53 +01:00
7eefdad051 Merge branch 'blender-v3.5-release' 2023-03-24 15:14:52 +01:00
08466a93e3 Fix security warning generated by std::tmpnam
Effectively replicate the behavior of the function in the manner
which is used for autosave file.

There might be better a solution which is cross-platform and does
not suffer from the time of check, time of use (TOCTOU) vector of
attack. This seems to be a bigger project to figure out, so until
then silence the warning: it is fine since the directory is only
used to chdir to, so worst case an external attacker can introduce
is a test failure.
2023-03-24 14:52:43 +01:00
9266469117 Refactor: Use utility function from BLI for temp directory
Should be no functional changes as the utility is based on the
code from the where_is_temp().
2023-03-24 14:52:43 +01:00
8c38d29feb BLI: Add utility to access system-wide temporary directory
It provides path to a directory suitable for storing temporary files
which satisfies the following conditions:

- The directory exists.
- The return path has trailing directory separator.

It is based on the code used in the appdir.c to get the temporary
directory.

For the C++ people: this is similar to the temp_directory_path()
from the std::filesystem.

No functional changes expected as it is a new code which is planned
to be used on other places as a followup development.
2023-03-24 14:52:43 +01:00
d5d8246441 Fix #106095: FCurves not drawn when Extrapolation is disabled
Bug introduced by c2c6707919
Fixing it by undoing the changes to the if statements
at the start of the FCurve drawing functions.

This keeps the intended behavior of the previous path, while fixing the drawing

Pull Request: blender/blender#106100
2023-03-24 14:18:00 +01:00
18a15bafe8 Fix blender_test not re-linked on macOS after changes
The Linux worked due to the libraries provided as a dependency
via `EXTRA_LIBS "${TEST_LIBS}"` with extra whole archive.

While on Windows and macOS the whole-archive is not needed the
dependency from the library to the blender_test is still needed.

Solves the issue when modifying asset_catalog_test.cc on macOS
does not make blender_test to be relinked.

Pull Request: blender/blender#106051
2023-03-24 14:11:46 +01:00
d78550634a Fix: Crash when trying to get FCurve segments of baked curve
When using the slider operators in the Graph Editor
the code would try to access `FCurve.bezt` without checking that exists.
When the curve is baked that is a null pointer.

Pull Request: blender/blender#106102
2023-03-24 13:52:54 +01:00
cef82a1d39 Cleanup: Grammar: "it's" vs "its" 2023-03-24 08:34:21 -04:00
22a3eb47ec Fix #106097: Don't offset child nodes when pasting
Nodes inside of frames where pasted with an offset from the cursor.
Since the location of nodes is in parent space, child nodes don't need
to be offset separately.

Pull Request: blender/blender#106099
2023-03-24 12:47:54 +01:00
03cfa75bcc Merge branch 'blender-v3.5-release' 2023-03-24 22:42:33 +11:00
cb4f7cac24 Fix #106040: pasting long text fails in Gnome-Shell/Wayland
Workaround gnome-shell including uninitialized memory when pasting
from the clipboard. Where `read` would not write data into the range
return by the length.

Reading from the pipe into a power-of-two buffer
works around the problem.

It's not clear why this only impacts gnome-shell - as there is no
significant down-side to changing the buffer size, apply a workaround.

Ref !106091.
2023-03-24 22:25:26 +11:00
5d5027db03 Animation: Gaussian Smooth operator for Graph Editor
Add a Gaussian smoothing operator to supersede the current
smoothing operator in the graph editor.

Advantage over the current implementation:
* Supports modal operations
* Is independent of key density
* More options in the redo panel
* More predictable Impulse Response

Option in the redo panel to change

Filter Width: How far out on each side of a key the code checks
to average key values

Sigma: The shape of the bell curve, lower values make a sharper bell curve
reducing the smoothing effect.
Too High values will make the code behave like an average filter as the
curve in the -1/1 range will almost be flat.

On a technical note, the operator needs to store additional data when running in modal
to avoid allocating/deallocating data on every modal run.
For that reason the `tGraphSliderOp` struct has been extended with
`void *operator_data` and `void (*free_operator_data)(void *operator_data)`.
The former is the data and the latter is a function responsible for freeing that data.

Pull Request: blender/blender#105635
2023-03-24 12:11:20 +01:00
8069b01c28 Cleanup: Make drop target creation functions non const
These often want to store a non-const reference to its owner, i.e. the
object that created them. I don't really like removing const here, but
it makes sense to enable this use case.
2023-03-24 11:53:49 +01:00
64f3afb267 Fix UI view drag target not using correct boundaries with panels
Initial idea was to calculate the view boundaries when finishing the
`uiBlock`, after layout code and such ran. But the panel code applies an
offset later, which breaks this. The view boundaries would be off by
something like 100px.
2023-03-24 11:40:09 +01:00
2fba27e6d8 Fix #105325: crash calling asset_generate_preview() in backgound mode
`.asset_generate_preview()` internally calls `UI_icon_render_id` as a
job -- as opposed to `.preview_ensure()` [which internally also calls
`UI_icon_render_id`, but not as a job] leading to crashes in background
mode.

This might be due to the fact that OpenGL context is not set up
correctly (so there might be other ways to fix this), but there seems to
be other places/comments indicating that icon handling is only for main
thread (see e.g. 13beeb5892).
And while this does not fully explain why doing this with jobs works fine
from the UI, the patch certainly fixes the crashes in background mode for
now (by not using jobs).

Pull Request: blender/blender#106046
2023-03-24 09:17:00 +01:00
08a6361b3f Vulkan: Texture Data Conversions
This PR adds basic support for texture update, read back and clearing
for Vulkan. In Vulkan we need to convert each data type ourselves as
vulkan buffers are untyped. Therefore this change mostly is about data
conversions.

Considerations:
- Use a compute shader to do the conversions:
  - Leads to performance regression as compute pipeline can stall
    graphics pipeline
  - Lead to additional memory usage as two staging buffers are needed
    one to hold the CPU data, and one to hold the converted data.
- Do inline conversion when sending the data to Vulkan using `eGPUDataFormat`
  - Additional CPU cycles required and not easy to optimize as it the
    implementation requires many branches.
- Do inline conversion when sending the data to Vulkan (optimized for CPU)

For this solution it was chosen to implement the 3rd option as it is fast
and doesn't require additional memory what the other options do.

**Use Imath/half.h**
This patch uses `Imath/half.h` (dependency of OpenEXR) similar to
alembic. But this makes vulkan dependent of the availability of
OpenEXR. For now this isn't checked, but when we are closer to
a working Vulkan backend we have to make a decision how to cope with
this dependency.

**Missing Features**

*Framebuffer textures*
This doesn't include all possible data transformations. Some of those
transformation can only be tested after the VKFramebuffer has been
implemented. Some texture types are only available when created for a
framebuffer. These include the depth and stencil variations.

*Component format*
Is more relevant when implementing VKVertexBuffer.

*SRGB textures*
SRGB encoded textures aren't natively supported on all platforms, in
all usages and might require workarounds. This should be done in a
separate PR in a later stage when we are required to use SRGB textures.

**Test cases**
The added test cases gives an overview of the missing bits and pieces of
the patch. When the implementation/direction is accepted more test cases
can be enabled/implemented.

Some of these test cases will skip depending on the actual support of
platform the tests are running on. For example OpenGL/NVidia will skip
the next test as it doesn't support the texture format on OpenGL, although
it does support it on Vulkan.

```
[ RUN      ] GPUOpenGLTest.texture_roundtrip__GPU_DATA_2_10_10_10_REV__GPU_RGB10_A2UI
[  SKIPPED ] GPUOpenGLTest.texture_roundtrip__GPU_DATA_2_10_10_10_REV__GPU_RGB10_A2UI [ RUN      ] GPUVulkanTest.texture_roundtrip__GPU_DATA_2_10_10_10_REV__GPU_RGB10_A2UI
[       OK ] GPUVulkanTest.texture_roundtrip__GPU_DATA_2_10_10_10_REV__GPU_RGB10_A2UI
```

Pull Request: blender/blender#105762
2023-03-24 08:09:19 +01:00
d5df77199b Vulkan: Resource Submission Tracking
In Vulkan multiple commands can be in flight simultaneously.

These commands can share resources like descriptor sets or push
constants. When between commands these resources are updated
a new version of the resources should be created.

When a resource is updated it should check the submission id of the
command buffer. If this is different than last known by the resources,
the previous resources should be freed.
If the submission id is the same than previously it has to create a
new version of the resource to not intervene with other commands that
uses the resource before the update.
When the resource wasn't updated between multiple usages in the same
submission id it could reuse the previous resource.

This PR introduces a `ResourceTracker` and a `SubmissionTracker`.
A submission tracker can check if the command buffer is submitted.
In this case all resources of the resource tracker should be freed.
Unmodified resources in the same submission can be shared.

A resource tracker will keep track of all resources that are in
flight. After the resources are used (submission + execution) have
finished the resources can be cleared.

Pull Request: blender/blender#105183
2023-03-24 07:47:50 +01:00
1588f57602 Fix: Targa with Palette Shows Grayscale in Viewport.
Viewport assumes that when the number of planes of the image
buffer is less or equal to 8 it is a gray scale image. In that
case it will optimize the texture to be stored as a grayscale
image on the GPU.

When using a targa file with a palette, the bitplanes were not
extracted from the actual colors, but from the number of colors
that were present in the palette.

Image buffers don't support palettes so that doesn't make sense.
This PR uses the bitdepth of the actual colors inside the palette
to identify the number of planes to use in the image buffer.

Pull Request: blender/blender#106047
2023-03-24 07:46:33 +01:00
a016d142e8 Fix #106040: pasting long text fails in Gnome-Shell/Wayland
Workaround gnome-shell including uninitialized memory when pasting
from the clipboard. Where `read` woud

Reading from the pipe into a power-of-two buffer
works around the problem.

It's not clear why this only impacts gnome-shell - as there is no
significant down-side to changing the buffer size, apply a workaround.
2023-03-24 17:12:02 +11:00
3dcd4df70c UI: support the primary clipboard for console & 3D text selection
Only the text editor supported the primary clipboard & only for modal
selection. Now selecting text in the console & 3D text editing also
sets the primary clipboard under X11 & Wayland.

Notes:

- Pasting from the primary clipboard isn't yet exposed in the key-map
  so in practice it's only useful for pasting text outside of Blender.
- Use skip-save option when pasting from the primary selection
  so this is never used by the regular paste shortcut.
- This commit adds a primary-clipboard flag to WM_capabilities_flag() so
  creating the the copy-buffer is only performed when necessary.
2023-03-24 17:09:39 +11:00
c971adfeef Separate ColorRamp node name into Color Ramp
Node names should be properly separated for easy searching and reading
and for consistency with other (color) nodes.

This commit should only touch UI names which do not need versioning and does not break node setups or py scripts.
2023-03-24 05:00:02 +01:00
3fe7e1f03b Update RNA to User manual mappings 2023-03-23 21:58:53 -04:00
6caccf6b9f Update RNA to User manual mappings 2023-03-23 21:57:56 -04:00
058a0187f8 Fix #106029: Crash sculpting with dynamic topology
The pbvh->mesh pointer isn't set when dyntopo is enabled.
2023-03-23 21:57:55 -04:00
f7946b486b Fix #106041: fix uv packing performance on aligned quads
AABB aligned quads would defeat the "witness" accelerator when
using the xatlas packing strategy.

This change reorders the search to allow use of the "witness" technique.
2023-03-24 12:11:00 +13:00
8a5c9f1f6e Fix #105058: fix UV ABF++ bounds check on large angles
Previous code had a faulty do-while-loop which only checked
bounds on one angle instead of all three.
2023-03-24 11:47:15 +13:00
1111ce3472 Fix rotate around zero vector in #OrientationBounds 2023-03-23 18:42:39 +01:00
b57b22388c BLI: Fix drawdata leak on Scene IDs
A call to `DRW_drawdata_free` must be present for all ids that can hold
draw data. The Scene ID was missing one and was leaking data on
EEVEE-Next.
2023-03-23 16:43:50 +01:00
fda65ad5ca GPU: Renderdoc Frame Capturing
This PR uses renderdoc for frame capturing when enabled.
It enabled an easier workflow for frame capturing.

- Capture GPU API calls from test cases
- Capture GPU API calls from background threads
- Capture GPU API calls from background rendering.

Renderdoc is an important GPU debugger used by the Eevee/
Viewport module. Previously we needed to change code in
order to record background rendering, that could on its own
lead to other side-effects.

The integration with renderdoc can be enabled using
`WITH_RENDERDOC=On` compiler option. `GPU_debug_capture_begin`
and `GPU_debug_capture_end` can be added to the section
of the code you want to debug. When running Blender inside
renderdoc this part will automatically be captured.

All GPU test cases are now guarded by these calls. In order
to capture the test cases you need to start the test cases
from renderdoc and the captured GPU API calls will appear
where each capture is a single test case.

Pull Request: blender/blender#105921
2023-03-23 16:37:52 +01:00
0efb7a202e Fix #105954: RIGIDBODY_REBUILD failure on rendering
Happens if a scene has a PointerProperty of type collection which
is set to a collection containing rigid bodies.

The error is printed by the builder of the render pipeline graph,
which contains very minimal subset of the view layer: it includes
custom properties (which gets recursed into), but not the rigid
body simulation.

This fix is mainly suppressing the error print, without changing
the apparent behavior of the graph.

Pull Request: blender/blender#106045
2023-03-23 15:51:29 +01:00
a2827af0aa Cleanup: NLA, remove FIXME and other unnecessary comment 2023-03-23 15:08:26 +01:00
831060a2c5 Cleanup: remove no-longer-relevant FIXME
"double check whether ANIMFILTER_LIST_VISIBLE is needed" above code that
doesn't actually use that flag.

No functional changes.
2023-03-23 13:02:16 +01:00
e84ae56621 Refactor: remove enum eAnimFilterFlags
Remove `enum eAnimFilterFlags` from `ED_keyframing.h`, the function
parameters that pass them around, and the code that uses them to filter
things.

Only one of the enum values was actually used, `ANIMFILTER_KEYS_LOCAL`.
It indicates whether to only consider keys on the datablock itself (when
set), or in the case of objects, also consider keys on its materials or
shapekeys (when cleared). However, this flag was *always* set, making it
possible to remove the code that handled it.

Finally there was only one function that received a `filters` parameter
that could be different across calls: it would either have value
`ANIMFILTER_KEYS_LOCAL` or `0`. However, the only flag it actually tested
for was `ANIMFILTER_KEYS_MUTED`, which was never actually set. So all of
that could be removed as well.

Just for grepping-through-history sake, these are the flags that were
removed:

- `ANIMFILTER_KEYS_LOCAL`
- `ANIMFILTER_KEYS_MUTED`
- `ANIMFILTER_KEYS_ACTIVE`
- `ANIMFILTER_KEYS_NOMAT`
- `ANIMFILTER_KEYS_NOSKEY`

Note: this is NOT about the flags defined in `ED_anim_api.h`, in `enum
eAnimFilter_Flags`. Note the different names, the one that's removed
doesn't have an `_`.

No functional changes.

Pull Request: blender/blender#106028
2023-03-23 13:00:56 +01:00
9c6b0daad5 Python: Limit BGL deprecation messages.
This PR change the number of displayed BGL deprecation messages
from 100 to 10.

Fix: #105997
Pull Request: blender/blender#106032
2023-03-23 12:38:36 +01:00
e77b666ae9 Fix normalize zero vector in light tree #OrientationBounds
was assuming such cases are already handled before this function is
called, but seems to be broken on windows and linux. Do
`safe_normalize()` so the tests pass, will check the problem afterwards.
2023-03-23 12:38:25 +01:00
e38ef6aca1 Refactor: Move static functions to the top
No functional changes.
A set of functions to get the bounds of a channel was created
for the `ANIM_OT_channels_view_selected` operator.
Theses functions will be used by other functions in this file,
so they need to move to the top.
2023-03-23 11:55:21 +01:00
791f35e2c0 Fix rotation axis not normalized in light tree #OrientationBounds 2023-03-23 11:11:54 +01:00
84e170c563 Animation: Add duration display to frame range settings
This patch adds an option to the Status Bar: `Scene Duration`

This shows the duration of the current scene in frames and timecode
`Duration: <timecode> (Frame <current frame>/<total frames>)`
The timecode follows the formatting defined in the user preferences.

Pull Request: blender/blender#104882
2023-03-23 10:18:38 +01:00
b77e6aaa0f Fix warnings in Cycles graph test output
Harmless, but is quite noisy and easy to avoid.

Pull Request: blender/blender#105985
2023-03-23 09:55:54 +01:00
e203e858ec Python: Limit BGL deprecation messages.
This PR change the number of displayed BGL deprecation messages
from 100 to 10.

Fix: 105997

Pull Request: blender/blender#106018
2023-03-23 07:53:16 +01:00
846ed20ad6 Cleanup: remove unused argument signified from used arguments in Python
Also simplify import for `_bpy._utils_previews`.
2023-03-23 15:31:14 +11:00
ebd7298594 Cleanup: avoid repeating defaults for pointer scroll under Wayland 2023-03-23 15:19:00 +11:00
80dfb885d7 License headers: add missing license identifiers 2023-03-23 15:12:09 +11:00
da0a832f74 Cleanup: remove confusingly named variable OperatorType::srna
This was assigned a variable named `func`, remove and follow the
convention used by other operators to access this from the operator-type.
2023-03-23 14:35:37 +11:00
684570ce57 Cleanup: use function style casts 2023-03-23 14:29:46 +11:00
d7de8bcf0d Cleanup: format 2023-03-23 14:28:50 +11:00
e39b358a2f Guarded allocator: print memory-in-use as a size_t, not uint
There is no reason to cast to a smaller value which could overflow.
2023-03-23 14:20:14 +11:00
eeb21fc8c3 CustomData: validate layer indices, assert assigned values are valid
Mesh.validate(..) now corrects invalid layer indices.
Add assertion to prevent invalid values being set #105860.
2023-03-23 13:55:51 +11:00
eaec2175ad Fix #105860: Out of bounds active layer index caused crashes elsewhere
Setting a negative active layer index was possible, causing a crash
when adding new layers (for example).

Clamp the active index when assigning from RNA.
2023-03-23 13:37:34 +11:00
2de2db0f79 Cleanup: BLI_array_store comments, use const variables 2023-03-23 10:52:40 +11:00
274c554f4c BLI_array_store: avoid unnecessary memcmp when detecting duplicates
Memory chunks that were in the same hashed bucket but had different keys
were comparing memory unnecessary.

In practice this didn't happen all that often in my tests so the
performance improvement isn't significant.

Follow up to 4f10800094.
2023-03-23 10:52:38 +11:00
a3241fc003 Merge branch 'blender-v3.5-release' 2023-03-22 23:22:13 +01:00
dcd000b354 Release cycle: Blender 3.5 goes Bcon4. 2023-03-22 23:18:54 +01:00
6addd195fa Fix: Unused variables mistake from previous commit 2023-03-22 17:58:06 -04:00
73d0531f50 Cleanup: Remove mesh poly macros, simplify loops
These `ME_POLY_LOOP_PREV` are redundant, since they're similar to
the `poly_corner_prev` inline functions. They were also confusing,
since they took an index into the poly and returned an index into
the entire corner range. Instead structure code to use the function
version, and simplify some loops in the process.
2023-03-22 17:48:07 -04:00
ce140c1b15 Cleanup: Remove unused polys variable 2023-03-22 17:15:30 -04:00
5c3f4195b6 Cleanup: Move poly topology lookup functions to C++ header
Standardize naming, use spans and references for input parameters,
and improve documentation. Now the functions expect the lookups to
succeed as well, they will fail and assert otherwise.

The functions are also simple enough that it likely makes sense to keep
them all inlined
2023-03-22 17:11:41 -04:00
59050f3fdd Cleanup: Make SculptSession a C++ only type
This allows adding spans, arrays, etc. directly to SculptSession, which
simplifies accessing mesh data, especially in #105938. A few files
aren't moved to C++ yes, so I had to add three C accessor functions.
2023-03-22 17:11:41 -04:00
a2d0f7049a UI: Generalize drop target API, support drop targets for UI views
Previously UI view items would support custom drop controllers (so they
could react to data being dragged over them and dropped). This is now
more generalized so the views themselves can do this as well.

Main changes:
- Support calculating a bounding box for the view, so this can be used
  for recognizing mouse hovering.
- Rename "drop controller" to "drop target", this is more clear, less
  abstract naming.
- Generalize drop controllers/targets. There is a new
  `ui::DropTargetInterface` now.
- Add support for drop targets in the `ui::AbstractView` base class, so
  custom views can use this.

Pull Request: blender/blender#105963
2023-03-22 18:45:35 +01:00
15c673175d Merge branch 'blender-v3.5-release' 2023-03-22 18:20:40 +01:00
689b0ed1c2 Fix macOS x86_64 clean deps build cmake errors with numpy
We no longer need to get numpy from pip, the current numpy version no
longer uses the buggy Accelerate framework by default.
2023-03-22 18:11:48 +01:00
b0045cc797 Fix #106002: crash when passing field into Switch node when it doesn't support it
Pull Request: blender/blender#106006
2023-03-22 17:54:27 +01:00
8b2d959344 Cleanup: Remove references to Blender 3.7.
Blender 3.7 is skipped. Update references to this release
to Blender 4.0.

Pull Request: blender/blender#106003
2023-03-22 16:24:26 +01:00
16b93486ca Fix Cycles CUDA compiler warnings with if constexpr 2023-03-22 15:57:06 +01:00
410ef5342e Fix Cycles build warning on Windows with unused argument 2023-03-22 15:57:06 +01:00
807e41e415 Merge branch 'blender-v3.5-release' 2023-03-22 15:54:41 +01:00
6cf19b2f79 Update freedesktop file for Blender 3.5. 2023-03-22 15:53:57 +01:00
35b69c578c Merge branch 'blender-v3.5-release' 2023-03-23 01:12:18 +11:00
4f10800094 Mesh: optimize edit-mesh undo with selection (address #105205)
BLI_array_store still performed poorly for boolean arrays or any arrays
where many memory chunks had identical contents since the temporary hash
had many collisions, making lookups slow.

Resolve by ensuring duplicate chunks aren't added to the hash table.

Also increase the memory chunk size for edit-mesh undo to 64kb
which performs well with high poly meshes as it reduces the overhead of
having to manage many small memory chunks.

Notes:

- Before this change performance was quite bad (10-20x worse than v3.3).
- Performance from the test in #105046 is roughly the same as before.
- Performance of #105205 compared with v3.3 is close, even faster at
  times but varies much more (likely caused by threading).
2023-03-23 01:09:35 +11:00
a36841af13 Merge branch 'blender-v3.5-release' into main 2023-03-22 14:21:28 +01:00
0e6cc4f86a Build: changes needed to build on FreeBSD
* Fix SDL not finding Xlib.h
* Link to clangSupport library for newer LLVM versions
* Add FreeBSD essential symbols to symbols_unix.map

Pull Request: blender/blender#105892
2023-03-22 14:15:46 +01:00
40bd35c9c4 BLI: Add dirty and cached checks to shared cache
While these aren't needed that often, it can be helpful to avoid
using a cache if it isn't necessary and it doesn't already exist.
2023-03-22 08:50:27 -04:00
95a4049633 Cleanup: Unused private fields
Pull Request: blender/blender#105988
2023-03-22 12:44:11 +01:00
7c952d6d15 Cleanup: Avoid unused includes in EnumerableThreadSpecific header 2023-03-22 07:43:26 -04:00
ad96939a66 Fix warning in points to volume node
Strict compiler was generating possible-uninitialized warning.

Added an explicit initialization and asserts to solve the noisy
output and catch possible errors early on.

Pull Request: blender/blender#105990
2023-03-22 12:35:19 +01:00
c21b534680 Build: skip installing .gitea files, deduplicate code
* With the move to gitea, .gitea doesn't need to be copied into installs.
* Add .github and .gitignore in more places for future proofing.
* Deduplicate ìnstall_dir macro.

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: blender/blender#105980
2023-03-22 12:29:26 +01:00
69ba34fa21 Merge branch 'blender-v3.5-release' 2023-03-22 10:55:46 +01:00
caaf97ed95 Build: upgrade OpenImageIO to 2.4.9.0
Fix #105955: Cycles crash loading multiple PNG, TIFF and other image textures
concurrently. This OpenImageIO version includes a fix for this problem.

Ref #99618

Pull Request: blender/blender#105958
2023-03-22 10:53:48 +01:00
f73d1ddce4 Fix #104266: Metal AMD refractions
Workaround for compiler issue on AMD
platforms resulting in the erroneous
discarding of valid rays in fragment
raytracing.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#105967
2023-03-22 09:57:30 +01:00
466cad8bfb Python API: Add deprecation warning to MeshUVLoop
Add ui_text to the MeshUVLoop python struct definition containing a
deprecation warning.

Pull Request: blender/blender#105970
2023-03-22 09:11:44 +01:00
e4300bbf2d Cleanup: quiet warnings by using system-includes for ./extern/
extern/json & extern/fmtlib reported warnings with GCC 12.2.1.
As these libraries aren't maintained as part of Blender, treat them as
system-includes.
2023-03-22 14:18:14 +11:00
3afe88b6c7 Cleanup: cmake indentation 2023-03-22 14:14:15 +11:00
ca08de5de4 PyAPI: raise an exception when removing an AOV which is not found
This is in keeping with how other remove functions behave.
2023-03-22 14:08:09 +11:00
Alexander Revkov
a1f52a02a8 Mesh: Set bounds eagerly for spherical and cylindrical primitive nodes
Eager bounds calculation for cylindrical and spherical primitive nodes,
implemented in constant time rather than as a loop over all positions.
Takes into account the segments count of the circle from which they
are constructed. Solution of the task #105551.

Pull Request: blender/blender#105743
2023-03-21 22:38:40 -04:00
d3bab78d05 Merge branch 'blender-v3.5-release' 2023-03-22 12:25:26 +11:00
2ba1556e69 Cleanup: spelling in comments, use doxygen syntax 2023-03-22 12:22:55 +11:00
99ecd6a900 Cleanup: Skip copying data between C++ and C
No functional changes.
2023-03-22 14:11:54 +13:00
075baf895e Fix building in debug mode 2023-03-22 12:04:38 +11:00
cf82e5fe57 Fix incorrect cursor size on Wayland with the RIVER compositor
Use XCURSOR_THEME & XCURSOR_SIZE environment variables for Wayland.
While this isn't an official part of the spec, many Wayland compositors
& applications use these variables.
2023-03-22 11:17:24 +11:00
d2b502f213 Cleanup: Following naming convention and more const
Adding "_" suffix on private member variables.
Add const qualifier where possible.

No functional changes.
2023-03-22 13:06:27 +13:00
64ef514ec9 Cleanup: format 2023-03-22 12:48:04 +13:00
dd7e1a3574 Fix: Hide corner vert and edge attributes in UI
These are meant to be like other low-level attributes--
hidden from the UI, at least by default. This was just
missing from the initial commit that added these
because seeing them was useful for debugging.
2023-03-21 18:30:51 -04:00
45379d9b59 Fix (unreported): Snap not enabled if Ctrl is pressed before operation
Regression introduced by 88e2542398.

The transform operator has a special way of detecting when the snap
modifier is pressed before the modal.
2023-03-21 19:17:25 -03:00
dab0ab673e BLI: Add a default constructor to OffsetIndices
Though it's not common, sometimes it is necessary to declare this class
without immediately assigning a value, and `Span` already supports this.
2023-03-21 16:53:57 -04:00
45a05d351d Python API: Add deprecation warning to MeshUVLoop
Add ui_text to the MeshUVLoop python struct definition containing a
deprecation warning.

Pull Request: blender/blender#105970
2023-03-21 21:05:24 +01:00
5bb4d733a6 Fix (unreported) potential invalid memory access in BKE_main_collection_sync_remap.
After remapping there is no guarantee that collections' parent pointers
are still valid, so using these to free the object cache of all the
collections' ancestors is potentially accessing invalid memory.

Further more, it is noticiably inefficient, as a same collection may be
processed many times.

So instead, introduce (and use in resync case) a new
`BKE_main_collections_object_cache_free`, which iterates over all
collections of given Main and only free their own cache.
2023-03-21 18:38:04 +01:00
e858be84fa Cleanup: move space_action folder to c++
I'm doing this because I want to work on the timeline integration for
simulation nodes caching. Also see #103343 for more info regarding moving
files to C++.

Pull Request: blender/blender#105962
2023-03-21 17:49:23 +01:00
ed7c90c13b Cycles: fix build failure due to lack of std:: specifier 2023-03-21 18:15:45 +02:00
711a830ede Fix #105949: Uninitialized array used when counting material triangles
Mistake in 5256b2ca62. Return the array by value so the
caller doesn't have to know about the need for zero initialization.
2023-03-21 12:04:51 -04:00
1d5cf734a8 Merge branch 'blender-v3.5-release' 2023-03-21 16:19:55 +01:00
dd0d572935 Update license doc for Blender 3.5. 2023-03-21 16:19:13 +01:00
45c1deac4f Bone relation lines: optionally draw between bone heads
Add control over how bone relation lines are drawn. Instead of always
drawing from the head of the child to the tail of the parent, give users
a choice for the parent side of the line. This can now be toggled
between the head and the tail of the bone, where the tail is Blender's
original behaviour and is retained as default value.

Pull request: blender/blender#105427
2023-03-21 15:16:13 +01:00
04d128f545 Fix: Realtime compositor outputs wrong EXR passes
The Image node in the realtime compositor will output wrong passes if multiple passes are used at the same time. This is because images can only store a single layer, pass, and view at a time. Furthermore, they rely on operators and RNA callbacks to invalidate the cache when a different layer, pass, or view is requested. In effect, when the image node requests multiple passes at the same time without any kind of cache invalidation, wrong passes are output.

While a proper fix is to allow caching of multiple layers, passes, and views at the same time. This patch implements a temporary workaround by explicitly ensuring an up-to-date cache through a call to BKE_image_ensure_gpu_texture() when before requesting a GPU texture.

Pull Request: blender/blender#105547
2023-03-21 14:57:12 +01:00
1d43beab84 I18n: Extract asset catalog and asset names and descriptions
The asset catalogs are used in Geometry nodes Add Node menu to
generate the hierarchy of submenus.

The assets themselves are used to generate the operator names in the
same menu, and their descriptions.

This commits enables extraction of this data by parsing the catalog
sidecar file, as well as opening each asset blend file to search for
assets.
2023-03-21 12:41:10 +01:00
2ce23b069e I18n: Translate Node Add menus generated from asset files
The Node Add menu can have special submenus containing node assets.
These submenus are generated by parsing the asset blend files from
release/datafiles/assets, and the interface drawing is specific to
these menus.

This commit enables the translation of these dynamic menus, including
their names and the description of the operators.
2023-03-21 12:41:10 +01:00
c73ae00cfc I18n: translate painting error message
An error message in paint mode is built out of several possible
components, depending on what is missing in the context for the
painting operation to work.

The main message was properly extracted, but not its individual
possible components.

Although such composite messages should generally not be used, in this
case I'm not sure it's worth it writing 15 different messages with all
possible combinations.
2023-03-21 11:40:21 +01:00
17c8e0d309 Refactor Light Tree to improve readability and efficiency
* Group bounding box, bounding cone and energy to a struct called `LightTreePrimitivesMeasure`
* Add utility functions to add primitives to nodes or buckets
* Precompute the split bucket cost to improve efficiency (about 1.4x expected)

Pull Request: blender/blender#105931
2023-03-21 11:06:41 +01:00
79a6fd57bc UV: Reduce round-off error during UV Packing in Geometry Nodes
Migrate #mul_v2_m2_add_v2v2 to `blender::geometry::`
2023-03-21 21:56:49 +13:00
31147c90c4 code_clean: restrict 'use_function_style_cast' edits to C++
Allows running multiple edits at once on C & C++ files without
C++ edits being attempted on C source.
2023-03-21 19:50:46 +11:00
db762d5508 Cleanup: various C/C++ code cleanups, use utility macros 2023-03-21 19:47:21 +11:00
e0d05da826 UV: Add option to Pack UVs using the xatlas strategy
Loosely based on the "xatlas" algorithm.
See https://github.com/jpcy/xatlas

Adds `shape_method` with ED_UVPACK_SHAPE_AABB, ED_UVPACK_SHAPE_CONVEX
and ED_UVPACK_SHAPE_CONCAVE

Ref #68889, #105680

Pull Request: blender/blender#105821
2023-03-21 09:15:06 +01:00
16275ca1de Cleanup: Remove unused const. 2023-03-21 08:43:41 +01:00
242dfbcd75 Code-style formatting. 2023-03-21 08:27:48 +01:00
8bfe34b285 Fullframe compositor: support backdrop offset for viewer node
Translating an image in fullframe compositor now also translates
the backdrop image for the viewer node.

Attached gif shows the behavior. Notice how gizmo moves with correct
values with the image but the frame stays to indicate what will get
rendered.

Note: This patch is a continuation of [D12750]
(https://archive.blender.org/developer/D12750). In a previous patch,
display offset on screen was not computed correctly. This has now
been fixed.

Pull Request: blender/blender#105677
2023-03-21 08:27:05 +01:00
439beb20c3 UI: Clicking camera icon while rendering should open render window
During rendering, clicking on the Camera icon of the jobs panel
should focus or open a Render Window.

Pull Request: blender/blender#105765
2023-03-21 07:53:31 +01:00
f54af343f1 Merge branch 'blender-v3.5-release' 2023-03-21 12:57:20 +11:00
5332537fc5 Cleanup: add struct comments for GHOST/Wayland 2023-03-21 12:54:19 +11:00
5404841421 Merge branch 'blender-v3.5-release' 2023-03-21 11:53:44 +11:00
98272e5bb2 Fix #104272: Inverted (natural) option ignored on Wayland
Detect axis inversion, depends on the upcoming Wayland v1.22 release
which will need Linux libs to be upgraded too.
2023-03-21 11:47:10 +11:00
0323f8d1d9 Fix #105926: Sharp edge attribute removed when all edges are sharp
When converting a BMesh to a Mesh, the attribute would be removed if
all values were true, since BMesh stores the data in a reversed flag.
The check worked the same way for the sharp face attribute already.
2023-03-20 20:30:13 -04:00
88e2542398 Transform: reduce overhead when checking if snapping is active
No functional changes.

The code previously contained redundant and complex checks for
different snapping scenarios, which involved combinations of multiple
snapping flags and modes on each mouse interaction. This resulted in
unnecessary code duplication and overhead.

To address this issue, the code has been simplified and micro-optimized
by moving these checks to the initialization of the snapping parameters.

This results in a more streamlined and efficient codebase.
2023-03-20 20:13:28 -03:00
4de247eb94 Cleanup: deduplicate snapping parameters
The members `align`, `project`, `peel` and `use_backface_culling`
already have a corresponding value in `TransSnap::flag`.

Keeping values that represent the same thing is error prone.
2023-03-20 20:13:28 -03:00
5256b2ca62 Cleanup: Reorder mesh draw cache functions to avoid prototypes
This bit of code is easier to read if you can scan it vertically with
the typical "entry point at the bottom, lower level code on top" order.
2023-03-20 23:16:50 +01:00
85066f3748 Cleanup: Rename variables in BMesh loose element extraction
Use simpler wording that's more readable and avoid confusing
"ids" with the simple indices from these loops.
2023-03-20 23:16:50 +01:00
aa1fc6102f Cleanup: Avoid contractions for loose geometry variables
Saving five characters for these names doesn't have much benefit,
and using the full word avoids readers wondering what "l" is supposed
to mean.
2023-03-20 23:16:50 +01:00
638709b0ed Cleanup: Use Array and Span for mesh draw buffer cache data
Use C++ types for more automatic memory management, simpler code,
and easier potential performance improvements. Also document each
item in the cache and access a named struct by pointer for the "poly
sorted" instead of using an identical unnamed struct.
2023-03-20 23:16:50 +01:00
21e3b4483f Cleanup: Pass UV offset in UV edit code
As part of #105779, the active status of UV maps won't be stored in
CustomData anymore, so it has to be retrieved from a higher level.
The best way to do that is to retrieve it once and pass around the BMesh
custom data offset as a "key" to the data. This should also decrease
function call overhead in this code (not that it was a bottleneck).

Pull Request: blender/blender#105904
2023-03-20 21:09:53 +01:00
309553fc07 BLI: Simplify and extend OffsetIndices class
Add `index_range()` and `is_empty()` functions, rename `ranges_num()`
to `size()` (clarifying the final extra integer as an implementation
detail). Also remove the `size(index)` function which gave almost the
same assembly as `[index].size()` (https://godbolt.org/z/PYzqYs3Kr).
2023-03-20 13:34:14 -04:00
23c5e06932 Cycles: build Light Tree in parallel
Push a task to `TaskPool` when more than `MIN_PRIMS_PER_THREAD` primitives are to be processed. The nodes are rearranged in a depth-first order when copied to the device.
Tested with the scene in #105550 on an Apple M1 Ultra (20 cores), about 11x speedup.

Pull Request: blender/blender#105862
2023-03-20 18:02:11 +01:00
006bc603f8 I18n: translate error messages generated with WM_report() and family
Many error messages were translated when using `BKE_report()` or
`BKE_reportf()`, directly, but others were missing because they used
`WM_report()` or `WM_reportf()`.

This commit adds these two functions to the list of functions used in
the message extraction regex.

In addition, `WM_reportf()` is modified so that the format string is
translated before formatting actually occurs.
2023-03-20 17:17:56 +01:00
3af5d2f0a8 Merge branch 'blender-v3.5-release' 2023-03-20 17:08:15 +01:00
e9db83a7b0 USD import fix: set active mesh color.
Fixed a bug where the active color wasn't being set
on imported meshes, resulting in no colors displaying
in the viewport.

This bug has been in the code for a long time. However,
the colors have been displaying correctly until recently,
so this issue wasn't previously apparent.

Also, changed custom color data name from "displayColors"
to "displayColor", to match the actual USD primvar name.
(This was a typo in the original code.)

Note that pull request

blender/blender#104542

addresses other issues in the color import code (e.g.,
converting all color primvars and not just "displayColor",
avoiding hard-coding of attribute names, handling all
iterpolation types, etc.).

However, the current commit is meant as a short term fix
to a regression, where the "displayColor" attribute does
not render in the viewport at all, until the above pull
can be merged.
2023-03-20 16:50:59 +01:00
16fbadde36 Mesh: Replace MLoop struct with generic attributes
Implements #102359.

Split the `MLoop` struct into two separate integer arrays called
`corner_verts` and `corner_edges`, referring to the vertex each corner
is attached to and the next edge around the face at each corner. These
arrays can be sliced to give access to the edges or vertices in a face.
Then they are often referred to as "poly_verts" or "poly_edges".

The main benefits are halving the necessary memory bandwidth when only
one array is used and simplifications from using regular integer indices
instead of a special-purpose struct.

The commit also starts a renaming from "loop" to "corner" in mesh code.

Like the other mesh struct of array refactors, forward compatibility is
kept by writing files with the older format. This will be done until 4.0
to ease the transition process.

Looking at a small portion of the patch should give a good impression
for the rest of the changes. I tried to make the changes as small as
possible so it's easy to tell the correctness from the diff. Though I
found Blender developers have been very inventive over the last decade
when finding different ways to loop over the corners in a face.

For performance, nearly every piece of code that deals with `Mesh` is
slightly impacted. Any algorithm that is memory bottle-necked should
see an improvement. For example, here is a comparison of interpolating
a vertex float attribute to face corners (Ryzen 3700x):

**Before** (Average: 3.7 ms, Min: 3.4 ms)
```
threading::parallel_for(loops.index_range(), 4096, [&](IndexRange range) {
  for (const int64_t i : range) {
    dst[i] = src[loops[i].v];
  }
});
```

**After** (Average: 2.9 ms, Min: 2.6 ms)
```
array_utils::gather(src, corner_verts, dst);
```

That's an improvement of 28% to the average timings, and it's also a
simplification, since an index-based routine can be used instead.
For more examples using the new arrays, see the design task.

Pull Request: blender/blender#104424
2023-03-20 15:55:13 +01:00
a2600e0a76 Merge branch 'blender-v3.5-release' 2023-03-20 15:30:14 +01:00
a60f651502 Address #105786: How to handle linked data with 'fake user' set.
133dde41bb changed how 'fake user' flag is handled with linked data.

Previous behavior was a bug/inconsistency, in that the 'directly linked'
tag would be 'over-set' and never cleared, forcing saving references to
a lot of unused linked data.
Note that ideally, 'Fake user' flag should be ignored, and the only way
to decide whether to keep or not a linked ID should be whether it's
actually used by some local data.

However, #103867 and #105687 show that this is causing issues in some cases,
where users wrongly relied on the linked data's pre-defined 'Fake user' flag
to keep their linked data in their production files, even if said data had no
real user.

While not ideal, for now we should consider 'fake user' flag for linked data
as a real usage case. A better handling of this edge-case is related to
wider designs aboud handling of 'non used' data on file save, whether
linked IDs should keep track of being explicitly or implicitly linked by
the user, etc.
2023-03-20 15:29:24 +01:00
4bb9006089 UI: align tab labels towards panels
Align the labels on the tabs so that when you read them, your head is tilted
towards the content, instead of away.

When tabs are drawn to the right of panels in the sidebar, the labels are read
from bottom to top, which may suggest that this tab does not belong to the area.

This change does it like this:
* Sidebar on the right: the text is read from top to bottom.
* Sidebar on the left: the text keeps reading from bottom to top.

Pull Request: blender/blender#105835
2023-03-20 15:20:39 +01:00
3f88ffb770 Fix #100574: Failure to key Quaternions in NLA's full stack tweak mode
The NLA's behaviour of always forcing a full set of keys (XYZW) is now
done in both 'Combine' and 'Replace' mode (previously only the former).

This fixes the bug where quaternions could not be properly keyed in 'full
stack tweak mode' under certain conditions.

Pull Request: blender/blender#105604
2023-03-20 15:07:50 +01:00
5316cdb26d Merge branch 'blender-v3.5-release' 2023-03-20 14:48:17 +01:00
41d421885d Updated from SVN trunk (r6393). 2023-03-20 14:46:54 +01:00
7484a1504d Cleanup: rename function
The name #ensure_valid_reflection seems to indicate that the resulted
reflection must be valid, whereas in the reality it only ensure validity
for specular reflections. The new name matches the behavior better.
2023-03-20 14:35:02 +01:00
dfe7b839bc Cycles: only apply function #ensure_valid_reflection to glossy materials
This function checks if the shading normal would result in an invalid reflection into the lower hemisphere; if it is the case, the function raises the shading normal just enough so that the specular reflection lies above the surface. This is a trick to prevent dark regions at grazing angles caused by normal/bump maps. However, the specular direction is not a good representation for a diffuse material, applying this function sometimes brightens the result too much and causes unexpected results. This patch applies the function to only glossy materials instead.

Pull Request: #105776
2023-03-20 14:35:02 +01:00
70f3382c45 Refactor: simplify computations in function #ensure_valid_reflection
Actually both potential roots lie in the interval [0, 1], so the
function ended up checking both roots all the time.
The new implementation explains why only one of the roots is valid; it
saves two square roots and a bunch of other computations.
2023-03-20 14:35:02 +01:00
4784ee852c Merge branch 'blender-v3.5-release' 2023-03-20 14:09:52 +01:00
3962d9b931 Fix #105397: Support cycling through sockets after a geometry output is linked.
The `NODE_OT_link_viewer` operator has some complicated logic that was
intended to stop cycling through geometry nodes to make it work better
with nodes that have multiple geometry and data outputs (group nodes).
This logic failed when geometry was not the first socket and it would
just stop connecting data sockets altogether after the geometry socket.

The reason is that the `determine_socket_to_view` function stops looking
for already-viewed outputs after the first geometry, and then simply
reconnects that geometry.

This patch changes the behavior slightly so that, if a geometry output
is found, the node skips over all subsequent geometry outputs, but still
considers data sockets for viewing. Viewing a node with multiple geometry
outputs will connect the first geometry output it encounters and then
keep cycling through data outputs on repeated execution.

Pull Request: #105836
2023-03-20 14:06:56 +01:00
8f6415418e Cleanup: Refactor UI tree & grid view building API
The Cycles light linking branch is using the tree view UI but it seemed
to use the "wrong" layout. It wasn't clear that the layout has to be
reactivated before building the view.

Make it harder to use the API wrong now by requiring the layout as
argument, so the building can ensure it's active.
2023-03-20 11:35:45 +01:00
5584c1cb53 IO: add PLY export test coverage for loose edges and loose vertices
The input file contains a partial cube, with two regular faces, two
loose edges and one loose vertex. This checks whether the loose vertex
for example is included into the output when exporting with UVs
(loose verts do not have UVs in Blender, so they should get (0,0) UV
in PLY).
2023-03-20 09:31:07 +02:00
4c70d9e11a Merge branch 'blender-v3.5-release' 2023-03-19 23:25:38 -04:00
de49d18af5 Fix: Invalid custom data read during legacy mesh format conversion
In a previous step of the mesh writing process, the loop `totlayer` was
replaced and a temporary vector is used for layer data instead. Use this
temporary vector to find the UV sub-layers, since the vector and the
CustomData struct in the mesh don't necessarily match. Also use a
local variable for mesh loop count to make it clearer that the mesh
isn't used except at the end.

Thanks to Campbell for finding the source of this error.
2023-03-19 23:24:52 -04:00
7cda559d7c Cleanup: format, spelling, struct member comment 2023-03-20 11:12:34 +11:00
bb593e5416 BLI: Math: Fix function description
No functional change.
2023-03-19 21:12:15 +01:00
0c2299e6b1 DRW: View: Allow the possibility to disable the visibility test
This is useful when we know that everything will be inside the view
frustum.
2023-03-19 21:12:15 +01:00
65b2aed14b EEVEE-Next: Spherical Harmonics Library
Implement spherical harmonics to be used for irradiance caching.
2023-03-19 21:12:15 +01:00
21b6f6f1f6 Cleanup: Use spans for mesh data in texture margin code
Avoid retrieving data from a DerivedMesh or a Mesh in the
same function.
2023-03-19 11:42:49 -04:00
63a44e29ac Mesh: Parallelize extraction of UV maps
Since UVs are now stored as 2D vectors in meshes, they can be copied
directly to the vertex buffers. Somewhat surprisingly, multithreading
the copying into the vertex buffer provides a good speedup-- on a CPU
with many cores at least.

Here is a test uploading two UV maps created in geometry
nodes with a 1 million quad mesh, with a Ryzen 7950x:
|         | Before  | After  | Speedup |
| ------- | ------- | ------ | ------- |
| Average | 24.3 ms | 7.5 ms | 3.2x    |
| Min     | 17.6 ms | 7.0 ms | 2.5x    |

I added the copying utilities to the array utils header, since the
need for them has come up in a few different places already, and the
existing function with a selection argument didn't make sense here.

Pull Request: blender/blender#105793
2023-03-19 16:18:19 +01:00
f149d7625d Cleanup: Use more specific variable names for color attributes
The "active_index" and "default_index" could easily apply to different
attribute subsets, better to make the naming specific here.
2023-03-19 10:31:14 -04:00
35bb942ae3 Cleanup: Use better check for UV map attribute
Also check the domain in addition to the type, to avoid processing
any associated layers unnecessarily. And remove an unnecessary
comment too.
2023-03-19 10:10:04 -04:00
37889015f3 Cleanup: Use C++ attribute API
When deleting UV UI attributes it isn't necessary to use the higher
level C attribute API, since we already know we aren't working with
the edit mesh here.
2023-03-19 10:07:54 -04:00
fbdeb0434c Merge branch 'blender-v3.5-release' 2023-03-19 10:03:11 -04:00
f23e3c7f04 Fix: Various issues with attribute removal
There were logic errors and use-after-free errors with the attribute
removal function. Because the custom data layers are reallocated,
we can't reuse the name pointer after removing an attribute. And
we can't return early on the first domain to fail for the edit mode
implementation, because another domain might have the attribute.

Also reorganize some of the code to make the logic clearer: only remove
sub-attribuutes and change attribute names after actually removing the
attribute,and  assert if the attribute isn't removed after it is found.
2023-03-19 10:02:29 -04:00
4b30b5c57f Nodes: SDF Volume nodes milestone 1
Geometry Nodes: SDF Volume nodes milestone 1

Adds initial support for SDF volume creation and manipulation.
`SDF volume` is Blender's name of an OpenVDB grid of type Level Set.
See the discussion about naming in #91668.

The new nodes are:
- Mesh to SDF Volume: Converts a mesh to an SDF Volume
- Points to SDF Volume: Converts points to an SDF Volume
- Mean Filter SDF Volume: Applies a Mean Filter to an SDF
- Offset SDF Volume: Applies an offset to an SDF
- SDF Volume Sphere: Creates an SDF Volume in the shape of a sphere

For now an experimental option `New Volume Nodes` needs to be
enabled in Blender preferences for the nodes to be visible.

See the current work plan for Volume Nodes in #103248.

Pull Request: blender/blender#105090
2023-03-19 11:21:08 +01:00
e13ae37e8b Fix #105885: toolbar items overlapping, after recent refactor
The RNA property was not mapped to the right new DNA member.
2023-03-19 10:07:39 +01:00
d8a439ebaf Merge branch 'blender-v3.5-release' 2023-03-19 07:59:54 +01:00
f4416e36b9 Cleanup: remove unused variable 2023-03-19 07:57:43 +01:00
e2caac4c73 Merge branch 'blender-v3.5-release' 2023-03-19 07:04:17 +01:00
cc44b98871 Fix #105720: crash when adding viewer node
The crash is fixed by reverting 87fd798ae3 and
some follow up commits. While it would generally be nice to move to a more
SoA format for these things, we are not there yet and this is causing more
trouble than it's worth currently. The main difficulty is that the socket
indices are changed by many different operations which invalidates the array
too often and led to many follow up bugs.

Pull Request: blender/blender#105877
2023-03-19 07:03:01 +01:00
45c4a0b1ef Merge branch 'blender-v3.5-release' 2023-03-18 19:57:58 -04:00
Jorijn de Graaf
ea019cf01e Fix #105152: Removing color attribute doesn't update active
It now gets the index before deleting the attribute,
then sets the attribute at that index as active.

Pull Request: blender/blender#105871
2023-03-18 19:57:22 -04:00
3048d9e99c Mesh: Remove unnecessary mesh position copying
Change code fragments where `BKE_mesh_vert_coords_alloc` had been used
to temporarily copy vertex coordinates of a mesh (see #103789) and
providd pointers to the mesh's stored vertex positions instead.
This reduces memory usage and improves performance.

Pull Request: blender/blender#105756
2023-03-19 00:26:28 +01:00
335688dd42 EEVEE-Next: Deferred Pipeline
Implement GBuffer prepass and deferred lighting (lights only).

This decouple lighting from the material shaders making them lighter,
less expensive and faster to compile.

Trying to keep a nice data flow so we could potentially use the
subpass programable blending feature on tiled GPU arch.

Not everything is covered yet and #105880 is making the GBuffer layout
a bit awkward and not easily extendable.

Pull Request: blender/blender#105868
2023-03-18 20:54:20 +01:00
b93a66d603 IO: refactor, replace std::vector with Vector in OBJ and PLY code 2023-03-18 08:51:43 +02:00
1b2f58adff VSE: Update text of text strip after each typed character
Use `PROP_TEXTEDIT_UPDATE`
2023-03-18 05:33:38 +01:00
bb1c503bee Fix 105824: Retiming remove gizmo size is fixed
Size was hardcoded to 14 pixels. Now it also conforms to strip size.
Minimum size is 40% of strip size, Otherwise it stays at 14px.
2023-03-18 05:33:35 +01:00
cf8640e7b5 Fix: Broken mesh to curve conversion
A recent refactor replaced the use of the `totpoly`
local variable where it shouldn't have.

Pull Request: blender/blender#105838
2023-03-18 03:49:38 +01:00
740c9204cc Cleanup: Simplify mesh to legacy curve logic
Changed `edge->v2` to `endVert` to make it consistent with surrounding code.
Removed the unused `totedges` variable.
Currently `totpoly` is also unused, but is fixed in a separate PR.

Pull Request: blender/blender#105870
2023-03-18 03:49:25 +01:00
73509d1bc1 Fix #105327: USD import fails to recognize UV map varname
Follow connections when reading the varname attribute of a primvar
reader, and support both string and TfToken types for the varname.

A unit test is also provided.

Authored by Apple: Matt McLin

Pull Request: blender/blender#105508
2023-03-18 00:05:39 +01:00
3eff28a158 Merge branch 'blender-v3.5-release' 2023-03-17 17:08:22 -04:00
d260cacc9d Fix #105577: Python MeshPolygon API allows negative material indices
This was lost in the refactor to store material indices in a generic attribute.
The attribute API still allows this, but that will be handled separately
since it's a more complex task. The existing API that already clamped
input values should still do that.
2023-03-17 17:07:44 -04:00
74de2e23a5 Merge branch 'blender-v3.5-release' 2023-03-17 21:53:51 +01:00
cc6d8cd573 Fix #105442: Cycles CUDA and HIP host memory fallback not working
Transforming the host pointer should not be done in an assert, it only works
in debug builds then. Caused by 6dcfb6d.
2023-03-17 21:52:29 +01:00
ec08d03198 Merge branch 'blender-v3.5-release' 2023-03-17 20:40:26 +01:00
97b0d8f72b Fix #105052: crash with sculpt automasking topology and mesh filter tool 2023-03-17 20:32:15 +01:00
ef4485720c Fix crash in viewport with negative material indices
Other areas like blenkernel and Cycles clamp the material indices to be
positive so this should be consistent with them. There is still discussion
if material indices should be made impossible, but this at least avoids
crashing for the 3.5 release.

There was also an inconsistency in how sculpt mode handles material index
higher than the number of slots.

Ref #105577
2023-03-17 20:14:47 +01:00
728694b4e4 Cleanup: use array instead of vector for LightTreeBucket with fixed size 2023-03-17 19:57:04 +01:00
a1a11b08d8 Cleanup: added a bunch of const qualifiers in Light Tree 2023-03-17 19:57:04 +01:00
74070a1c2c Merge branch 'blender-v3.5-release' 2023-03-17 18:12:20 +01:00
ddec556ef3 Fix make_update running on a freshly cloned Blender fork
Simple logic: when the repository is not found under the relative
path to the main repository's origin, enforce clone of the upstream
repository instead.

Pull Request: blender/blender#105858
2023-03-17 18:07:31 +01:00
f4fd348d22 Fix: FCurve Bounds - return when can't be found
Originally this was added by #105179
This code was reverted by accident in #105177
2023-03-17 17:16:11 +01:00
11b16c4ae3 Fix #105640: LineArt: Default value for LRT_GPENCIL_MATCH_OUTPUT_VGROUP flag.
This flag is moved to a different variable but the default value is still placed on the wrong variable.

This fixes the default value assignment but due to the old flag bits are in conflict with used bits in the new flag variables, versioning changes are not included.

Pull Request: blender/blender#105852
2023-03-17 16:31:01 +01:00
48496f1473 PLY: optimize new exporter (2x faster)
1) There was a logic error in FileBuffer where when it was trying to
   add a new 64kb chunk to hold output, it was adding an empty chunk,
   but making sure we have space capacity to hold 64 thousand chunks.
   So that was a bit of pointless juggling to get nothing good.
2) In UV_vertex_key, instead of trying to combine three members into
   a hash value, badly, by doing some ad-hoc shifts and xors, use
   get_default_hash_3 instead, which combines them way more properly.
   Also avoid copying the whole hash map object.

On my windows box (Ryzen 5950X, VS2022), exporting Stanford Lucy 3D
scan:
- Binary: 13.4 -> 5.4 sec
- ASCII: 29.3 -> 14.6 sec

So basically 2x faster for two tiny changes.
2023-03-17 17:01:09 +02:00
d9273d8578 Fix Cycles growing BoundBox with empty BoundBox modifies the original BoundBox 2023-03-17 15:28:27 +01:00
f440b15630 Merge branch 'blender-v3.5-release' 2023-03-17 13:59:29 +01:00
2c9ba55c7f Fix #105849: crash when using link-swap with an existing link
The code didn't check if there was actually a link to displace.
2023-03-17 13:55:01 +01:00
8ded95c175 Vulkan: Clearing Storage Buffers
This PR adds support for `GPU_storagebuf_clear` and
`GPU_storagebuf_clear_zero` to the Vulkan backend. It also adds test
cases for all backends.

Pull Request: blender/blender#105487
2023-03-17 13:48:39 +01:00
0cb02ff3ba Merge branch 'blender-v3.5-release' 2023-03-17 12:46:16 +01:00
6d3ce8273a Fix #105363: Frame nodes can act wrong in transform system
When multiple nodes (Frame nodes included in the selection) are scaled/
rotated, the TransData location and center can get "wrong" due to the
fact that Frame nodes dont only use `locx`/`locy` for their
representation while drawing, but also `offsetx`/`offsety`.

So in order to use the "real" top-left corner in the transform system,
we have to respect `offsetx`/`offsety` when creating/flushing transform
data.

In addition to the file in the report, this patch was also tested to work
well with nested Frame nodes.

Pull Request: blender/blender#105400
2023-03-17 12:42:04 +01:00
6c6edaf513 PLY: Improve robustness and performance of the new PLY importer
Fixes:

* General:
- Was assuming that positions/normals/UVs are always `float`, and colors
  are always `uchar`. But e.g. positions are sometimes doubles, or colors
  are floats etc.
- Was assuming that `face` element is always just a single vertex indices
  property. But some files have more arbitrary properties per-face.

* ASCII importer:
- Was assuming that file elements are always in this order: `vertex`,
  `face`, `edge`. That is not necessarily the case.
- Was only handling space character as separator, but not other
  whitespace e.g. tab.
- Was not checking for partially present properties (e.g. if just `nx` is
  present but not `ny` and `nz`, it was still assuming whole normal is there).

* Binary importer:
- Was assuming that faces are always 1-byte list size and 4-byte indices.
- Was assuming that edge vertex indices are always 4-byte.

For the assumptions above, it often lead to either crashes, garbage data
or not detecting presence of a vertex component. E.g. binary importer was
just always reading 4 bytes for vertex indices, but if a file has 2 byte
indices then that would read too much, and then later on would start reading
garbage. ASCII importer was doing out-of-bounds reads into properties array
if some assumptions were not correct, etc.

Improvements:
- Some ply files use different property type names, e.g. `float32`,
  `uint16` or `int8` instead of `float`, `ushort`, `char`; now that is
  supported too.
- Handles `tristrips` element. Some files out there do not have `face` but
  rather has a triangle strip, internally using -1 indices for strip restarts.

Performance:

While doing the above fixes/improvements, in order to fix some things it was
more convenient to also make them more performant :) Now it avoids splitting
each ASCII line into a vector of `std::string` objects, for example, or
reading a binary file in tiny chunks.

Generally this is now 2x-4x faster than the previous state of C++ importer.

The code has changed quite a bit to achieve both the fixes and performance:
- Instead of separate files for ASCII and Binary reading, they are now both
  in `ply_import_data.cc/hh`. Reason is that all of the "find correct property
  indices" logic is the same between both (and that bit was mostly missing
  previously).
- Instead of using raw C++ `fstream` object and reading line by line (which
  in turn reads one byte at a time) or reading field by field, now there's a
  `ply_import_buffer.cc/hh` that reads in 64KB chunks and does any needed
  logic for the ASCII/header part to properly split into lines. This avoids
  all the mutex locking, locale lookups, C++ abstraction layers overhead
  that C++ iostreams have when doing a ton of tiny reads.

Tests:

Extended test coverage with new files (comitted in svn revision 63274).
11 new "situations", in both ascii and binary forms. Additionally, now also
has a Big Endian binary file to test; BE codepath was completely untested
before.

Overall reworked the tests so that they don't do the whole "load dummy
blend file, import ply file on top, go over meshes, check them", but rather
do a simpler "run ply importer logic that fills in PlyData structure, check
that". The followup conversion to blender meshes is fairly trivial and the
tests were not really covering that in a useful way.

Pull Request: blender/blender#105842
2023-03-17 12:20:41 +01:00
ac2f67dda0 Merge branch 'blender-v3.5-release' 2023-03-17 12:13:10 +01:00
1929862ad6 Fix #105688: Ignore modifier part of viewer path in pinned trees.
Viewer node paths usually start with the modifier, but in pinned
node editors the tree may not be used by the object in context.
In that case the modifier part of the path should be ignored.
The viewer node is always disabled in that case.

Pull Request: blender/blender#105826
2023-03-17 12:11:50 +01:00
6e2ea0b997 Merge branch 'blender-v3.5-release' 2023-03-17 12:06:00 +01:00
fa4acbd6be Fix #105757: Resizing images is not marking them as changed
Resizing an image via the operator did not mark it dirty
(`IB_BITMAPDIRTY` is needed to pick this up as being modified, if this is
not set, no warning/option is shown on file close).

Note that using RNA would already do this correctly (since it uses
`BKE_image_scale` -- which already calls `BKE_image_mark_dirty`
internally).

Pull Request: blender/blender#105851
2023-03-17 12:04:49 +01:00
b4e0e696fc Merge branch 'blender-v3.5-release' 2023-03-17 11:58:19 +01:00
24266fd68c Fix #105216: Clear Asset does not immediately redraw the outliner
While **marking** an asset would update the Outliner immediately (this
due to the fact that `ED_asset_generate_preview` indirectly took care of
a refresh), **clearing** an asset would not do this.

Now be explicit about this in the Outliner listener and consider asset
notifiers there.

Pull Request: blender/blender#105287
2023-03-17 11:55:03 +01:00
8bf4aa2fdc Merge branch 'blender-v3.5-release' 2023-03-17 11:17:40 +01:00
38688adaad Fix #105818: material preview invalid memory access reported by ASAN
Preview render depsgraphs are put in the depsgraph registry
concurrently with other threads. This was lacking a mutex lock
and a map value that remains unchanged when other elements of
the map are updated.

Pull Request: blender/blender#105839
2023-03-17 11:17:01 +01:00
0963ee559e Cycles: adjust resolution divider to achieve a more usable viewport
This changes the maximum viewport resolution divider for Cycles to
help users get a more responsive viewport.

This is done by changing the maximum viewport resolution divider
to a divider that aims to have the largest axis of the viewport
roughly equal to 128 pixels.

Depending on the circumstances, this change can result in a few
noticeable differences:
 - Users with slow hardware and a large pixel_size, or slow hardware
 and a low resolution screen, may observe a higher resolution viewport
 during navigation, making the scene more readable. However this comes
 at the cost of reduced responsiveness.

 - Users with slow hardware and a low pixel_size and high
 resolution screen may observe a lower resolution viewport during
 navigation, providing a more responsive viewport during navigation.

Along with that, how Cycles iterates through resolution dividers
is changed to promote quick transitions between resolution dividers.
Meaning users don't need to wait through as many iterations to get
from a low navigation resolution to a 1:1 viewport resolution.

Pull Request: blender/blender#105581
2023-03-17 11:15:58 +01:00
509a12eaac Treat -Wunguarded-availability-new as an error
This makes it so access to macOS SDK from newer versions than our
deployment target can be detected on a buildbot via failed build.

Pull Request: blender/blender#105595
2023-03-17 10:45:03 +01:00
da590428c3 Merge branch 'blender-v3.5-release' 2023-03-17 10:08:42 +01:00
aca3039740 Fix #104730: Suppress using anonymous UV layers for rendering
When an object has no UV layers and an anonymous UV layer is created,
the anonymous layer gets set as the default (render) layer. This is
very confusing because it then uses a hidden anonmous layer. This patch
suppresses the usage of anonymous layers for rendering.

Pull Request: blender/blender#105192
2023-03-17 09:42:54 +01:00
4892a132bc Python: Unable to use gpu.state.scissor_test_set.
`scissor_test_set` wasn't able to parse the arguments that were
passed correctly, due to incorrect control data during functino
registration.

This patch uses the correct control data during registration and
is able to parse arguments.

Ref: #104911

Pull Request: blender/blender#105850
2023-03-17 08:03:55 +01:00
e853a67efc Cleanup: use BKE_blendfile_* for functions defined in BKE_blendfile.h 2023-03-17 16:45:42 +11:00
3b8a050fc1 Cleanup: use function-style casts, ELEM & STREQ macros 2023-03-17 16:45:42 +11:00
976b17e415 Cleanup: remove redundant casts 2023-03-17 16:45:42 +11:00
b6b0bc4531 Cleanup: spelling in comments 2023-03-17 16:45:42 +11:00
01a29ebaeb Merge branch 'blender-v3.5-release' 2023-03-17 14:52:04 +11:00
c169f67dc1 Fix #103263: Touchpad gestures changing pivot point of rotation/zooming
Auto-depth is no longer reset during consecutive touch-pad motion.

Details:

- Add wmEvent::flag, WM_EVENT_IS_CONSECUTIVE to detect consecutive
  track-pad & NDOF motion events. Expose via RNA as Event.is_consecutive.

- Consecutive events are broken by button/key presses and mouse motion.

- Add `WM_event_consecutive_data_*` functions, so operators can store
  data between consecutive events.

- Add `ED_view3d_autodist_last_*` functions to access the last autodist
  pivot point for view operators to use.
2023-03-17 14:48:50 +11:00
f78f05c749 Refactor: U.dpi_fac -> U.scale_factor
A renaming of UI scale factors from names that imply a relationship to
monitor DPI to names that imply that they simply change "scale"

Pull Request: blender/blender#105750
2023-03-17 04:19:05 +01:00
e4eb9e04e0 Fix #105823: Crash While deleting retiming handles
Handle index operator property was exposed to user, which was
unintended. The property is validated only in invoke function.
2023-03-17 03:26:37 +01:00
025beb2cda Merge branch 'blender-v3.5-release' into main 2023-03-16 17:52:08 -06:00
e63f84de29 make.bat: adjust for recent submodule changes
the path for clang_format_paths.py changed when the submodules
moved but format.cmd was never updated for that.

the work previously done by check_submodules.cmd is now done by
make_update.py so this file can be removed.
2023-03-16 17:51:12 -06:00
aa2d8647c1 Merge branch 'blender-v3.5-release' 2023-03-16 23:19:59 +01:00
20a8bc1204 Fix #105455: GPU subdivision with textures corrupts display after undo
This is an issue revealed by the recent optimization in 4d3bfb3f41 to have
CPU and GPU subdivision topology both cached.

BKE_subsurf_modifier_subdiv_descriptor_ensure is what (re)creates the
topology refiner when needed. Invalidating the topology refiner on changes
must be done before it, otherwise we end up with an incomplete Subdiv that
either does not draw or draws incorrectly.

Pull Request: blender/blender#105844
2023-03-16 23:18:55 +01:00
9a8bfe8dd3 Cleanup: Make format
Simply adds a single blank line.
2023-03-16 14:23:40 -07:00
339e9deb72 Merge branch 'blender-v3.5-release' 2023-03-16 21:45:16 +01:00
f46fb8051d Fix #105778: Prevent invalid links with link swap
Remove swapped links when they link sockets that belong to
the same node.

Pull Request: blender/blender#105809
2023-03-16 21:39:32 +01:00
f234d2d440 Subdivision: remove info message that GPU subdivision being used
This is the normal case, it's only when both CPU and GPU subdivision is used
that the user needs to be informed that performance is suboptimal.
2023-03-16 19:48:55 +01:00
34f3893831 BLI: support recursive usage of Vector
This makes it possible to use `Vector` recursively if the inline buffer
has 0 size. Any other inline buffer size does not work, because then
the type would be embedded in itself which does not make sense.

Pull Request: blender/blender#105832
2023-03-16 17:52:03 +01:00
ee213f3c4d Merge branch 'blender-v3.5-release' 2023-03-16 15:58:34 +01:00
a958ae36e8 Fix #104305: Crash in node editor with large asset libraries
Various UI code would store the `AssetHandle` in a way that turns out to
be unsafe. The file-data is part of the file browser caching system that
releases file-data when a certain maximum of items is in the cache. So
even while just iterating over the assets, earlier iterated asset
handles may become invalid. Now asset handles are really treated as
volatile, short lived objects.

For the asset-view, the fix was more involved. There we need an RNA
collection of asset-handles, because the UI list code requires that. So
we create a dummy collection and get the asset handles as needed by
index. This again meant that I had to keep the index of the collection
and the asset-list in sync, so all filtering had to be moved to the UI
list.
I tried duplicating the file-data out of the cache instead, but that
caused problems with managing the memory/ownership of the preview
images.

`AssetHandle` should be removed and replaced by `AssetRepresentation`,
but this would be an even more disruptive change (breaking API
compatibility too).

Fixes #104305, #105535.

Pull Request: #105773
2023-03-16 15:40:31 +01:00
cb20f2cbf9 Fix build error after previous merge
Function was moved and renamed in 48814c25fd.
2023-03-16 15:27:27 +01:00
7317da80fe Merge branch 'blender-v3.5-release' (won't build, see followup) 2023-03-16 15:26:23 +01:00
55811b2919 Assets: Add function to query data-block library path from asset
No user visible change.

This is needed for #105773, but will cause conflicts in the main branch,
so committing it separately.
2023-03-16 15:25:00 +01:00
d1b8a827a6 Refactor: Avoid unsafe strcpy in library path utility function
Make sure the expected max-length for the string is respected.

Suggested by Bastien in #105825.
2023-03-16 15:07:27 +01:00
b80f6c4017 Cleanup: Improve comment on library path utility function
Suggested by Bastien in #105825.
2023-03-16 15:07:27 +01:00
48814c25fd Cleanup: Move blend file path utilities out of blenloader module
These are not really about reading or writing .blend files, they are
general utilities for file-names/paths. Having to link to the
blendloader library just for these utilities is annoying.
Moved them to `BKE_blendfile.h` now, in agreement with Bastien.

Pull Request: #105825
2023-03-16 15:07:27 +01:00
4fba59c55d Fix #105803: Cycles slow light tree build when previewing shader nodes
When linking a texture directly to the material output, it's likely being
done for the purpose of previewing. In that case, bias the heuristic towards
not building a light tree, as it's likely not needed and slow on dense meshes.
2023-03-16 14:58:47 +01:00
8bb411ad1a EEVEE Next: IrradianceCache surfels debug display
Add a surfels debug pass to aid with the GI implementation development.

Pull Request: blender/blender#105802
2023-03-16 14:14:33 +01:00
bb0ee9fdb4 Fix tiny file browser highlight offset on retina screens
While this was just a single pixel off, it was a bit notable since the
highlight wasn't centered correctly. Now retina and non-retina screens match
visually.
2023-03-16 12:48:56 +01:00
5e0cc9d277 Cleanup: Silence Unused parameter warnings.
- blender::gpu::GLContext
- blender::gpu::VKContext
2023-03-16 09:44:09 +01:00
a25cc51db9 Cleanup: Spelling in previous commit. 2023-03-16 08:55:45 +01:00
3d9d67594c GPU: Add GPU frame capture support.
Adds two modes of GPU frame capture support for
enhanced debugging. GPU frame capture begin/end
allow instantaneous frame capture of all GPU commands
within the capture boundary.

GPU frame capture scopes allow several user-defined capture
regions which can wrap key parts of code. These scopes are
exposed to connected GPU tools allowing the user to manually
trigger a capture of a known scope at the desired time.

This is currently integrated with the Metal backend for
support with Xcode.

Related to #105591

Pull Request: blender/blender#105717
2023-03-16 08:54:05 +01:00
397f6250a5 Merge branch 'blender-v3.5-release' 2023-03-16 08:28:21 +01:00
7bdd82eca0 Metal: Resolve Race Condition in Memory Manager
Fix race condition if several competing threads are inserting Metal
buffers into the MTLSafeFreeList simultaneously while a new list
chunk is being created.

Also raise the limit for an MTLSafeFreeListChunk size to optimize
for interactivity when releasing lots of memory simultaneously.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#105254
2023-03-16 08:25:15 +01:00
d3409f2159 Fix: Uncached Metal Materials not Being Released
Optimized node graphs do not get cached and were
not correctly freed once their reference count reached
zero, due to being excluded from the GPUPass garbage
collection.

Also suppress Metal shader warnings, which are prevalent
during material optimization.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#105795
2023-03-16 08:19:32 +01:00
94855119da Fix: Metal validation error when shader has no uniforms
Metal buffer binding validation would trigger an error
when a given shader had an empty PushConstantBlock.
This patch removes the default uniform code gen if
no uniforms are present, to avoid any possible issues
with buffers being bound to a shader where the destination
data block is size zero.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#105796
2023-03-16 08:10:38 +01:00
ac6a70e5f8 Fix #104012: Selection crash with AMD on Metal
Crash when selecting objects on AMD platforms running
Metal. This was caused by shader compilation warnings
being treated as errors in macOS 10.15. Wrapping
compilation failure with success check resolves error.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#105739
2023-03-16 08:03:15 +01:00
b96f8ac9fe Fix #105606: Metal texture upload regression
immDrawPixels performs significantly slower in Metal
than OpenGL. This was caused by two main factors. Firstly,
the additional overhead of tiled texture update, where all
memory needed to be kept in flight for each update, but
caused update to take a slow path. Avoiding tile update
with Metal is more efficient for both memory pressure
and GPU pipelining.

Secondly, on AMD platforms, the staging buffer used
for temporary texture data was page-faulting when
several texture updates would occur within one frame.
This is due to limitations of allocating one large contiguous
memory chunk. Using the Metal buffer pool for staging
data is more efficient.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#105794
2023-03-16 07:59:22 +01:00
ebad816057 Merge branch 'blender-v3.5-release' 2023-03-16 17:20:28 +11:00
d3e37d3ed2 Fix #105224: Node editor NDOF pan changes RGB colors
Disable NDOF changing colors for 2D views since it conflicts with
panning.
2023-03-16 17:17:33 +11:00
b6caf5980e Merge branch 'blender-v3.5-release' 2023-03-16 04:47:15 +01:00
1ad3fa09c9 Fix #90389: No labels in scrubbing area with small FPS
Maximum distance of lines in screen space is limited. This limit seems
reasonable for FPS higher than 1, but UI allows to set 0.01 FPS with
soft. even lower values are possible.

This patch allows for normal operation within soft limits and labels are
still visible and quite usable within hard limits.

Pull Request: blender/blender#104849
2023-03-16 04:42:27 +01:00
bad85fe8c7 Cleanup: Avoid keeping mesh normals references after dirty tag
Without assumptions of a mesh's direct ownership of its normals,
this was error prone, since normals could potentially be reallocated
when they are tagged dirty or retrieved with write access.
2023-03-15 21:39:50 -04:00
896360de1f Cleanup: remove GCC warning pragma
I'm no longer able to generate a warning with GCC 12.2.1.
2023-03-16 11:46:56 +11:00
42380ea996 Cleanup: use static declaration, quiet undeclared warning 2023-03-16 11:24:14 +11:00
64304b4e27 Fix invalid enum passed to BKE_id_attribute_search 2023-03-16 11:24:11 +11:00
f2a05c3e4e Cleanup: Remove unused pbvh function declarations 2023-03-15 20:13:34 -04:00
0fe006eec5 Merge branch 'blender-v3.5-release' 2023-03-15 16:12:47 -07:00
d7a68a9de8 Fix: Correct several messages in the UI
- Show/hide mask layers: the tooltip was confusing from a user's
  perspective, because they should not be expected to know what a hide
  flag is.
- Active Spline -> Active Point: likely a copy and paste error.
- Geo Nodes face is planar node: forgotten article.
- Axes, plural instead of axis for the viewport preferences. Here
  there are several usages of axis or axes. Since they refer to
  coordinate axes I believe they should be plural, even though the
  property `mini_axis_type` is still wrong.

-----
![image](/attachments/7ccdc72d-1e83-4c22-b8e9-c3b7c5fcf629)
![image](/attachments/746015bc-23e1-49bc-8828-df07d7605048)
![image](/attachments/61c58766-a8f5-4a90-b862-c9b57c44c355)

Pull Request: blender/blender#105814
2023-03-16 00:12:29 +01:00
09cff506c1 Fix #89630: Hide backfaces when using using the "Alpha Blend" blend method
For proper display, backfaces should be hidden when using the "Alpha Blend" blend method:
https://docs.blender.org/manual/en/dev/render/eevee/materials/settings.html#blend-mode

See the mentioned bug for various examples.

Pull Request: blender/blender#105585
2023-03-16 00:10:26 +01:00
7ee0bf671e Cycles: use 8-bit type for number of ray hits when possible
INTEGRATOR_SHADOW_ISECT_SIZE is lower than 256 for GPUs, this allows
using only a 8-bit type for storing intersection counts there.
2023-03-15 22:01:48 +01:00
f9922b7074 Cycles: Use ray->tfar in Embree filter functions
This allows to tell embree to stop intersecting beyond the distance
when max number of hits is reached.
2023-03-15 22:01:48 +01:00
1a580dbfdd Cycles: Use IntegratorShadowState directly in Embree filter functions 2023-03-15 22:01:48 +01:00
b97a6daa9a Cycles: Use geometryUserPtr from Embree filter functions arguments
This saves calls to rtcGetGeometryUserData.
2023-03-15 22:01:47 +01:00
59a083e948 Cleanup: format 2023-03-16 09:34:38 +13:00
c38fe87127 UV: Improve UV Packing efficiency with non-square aspect ratio
Improve pre-conditioning of UV Islands before passing them to the UV Packing API.

Pull Request: blender/blender#105784
2023-03-15 21:29:31 +01:00
f6c70755d1 Measure Tool: reduce snap overhead
No functional changes.

This is just a micro-optimization to avoid updating `prev_point` and
calling `ED_gizmotypes_snap_3d_data_get` when snapping is not enabled.
2023-03-15 17:14:57 -03:00
b79ad1f93f Merge branch 'blender-v3.5-release' into main 2023-03-15 17:14:42 -03:00
4cd102bb73 Fix #105664: measure tool ignoring snap on first click
The bug only happened in wireframe mode.

Originally the `const bool use_depth` indicated when projection should
be done on invoke.

Later it started to indicate when to snap on invoke.

But with keymap snap detection, using this `use_depth` is no longer
correct.
2023-03-15 17:14:23 -03:00
b21537d215 Cleanup: Wrap C++ normal accessors with C functions
Implement the two cached normal accessors with C++ methods
directly. This avoids dealing with raw pointers and reduces the
amount of casting necessary.
2023-03-15 15:57:27 -04:00
4aa2a3522e Cleanup: Store cached mesh normals with Vector
Avoids manually allocating and freeing the data in some cases,
clarifies ownership, and gives extra safety with the sizes.
2023-03-15 15:57:27 -04:00
17a53d6647 Cleanup: Tweak mesh normal accessors documentation
Just reference the C++ functions in the C API, and make the wording
a bit more concise.
2023-03-15 15:57:27 -04:00
f9132e2bbf Cleanup: Remove redundant mesh normals dirty tag function
Since normals are derived data, it's always a change to something
else that will cause them to change, like the winding order of a face
or vertex positions. So it's clearer to use tags for those things
directly. It's correct to remove the tag in one place since dirty is
the default state of a new mesh.
2023-03-15 15:57:27 -04:00
2daf6c69be Merge branch 'blender-v3.5-release' 2023-03-15 14:05:29 -04:00
d7ac2a177a Cleanup: Use spans and C++ type to access mesh normals
Also rename some variables to use names consistent with elsewhere.
2023-03-15 14:03:05 -04:00
d9c2fb9ae2 Cleanup: Remove mesh validation of cached normals
This validation dates back to when vertex normals were stored in
the `MVert` type (before cfa53e0fbe). Since normals
are all calculated in the same place, and aren't saved in files, this
isn't relevant anymore-- they can just be recalculated.
2023-03-15 14:03:05 -04:00
e7295efb4b Fix #105791: Alembic procedural ignores materials
When creating the bounding box mesh for the viewport replacement,
copy the material from the original mesh. I'm not sure if Cycles is
meant to load materials from the original mesh or the Alembic file
itself, but either way, this should be a harmless change and fixes the
issue in the report.

Pull Request: blender/blender#105798
2023-03-15 19:01:53 +01:00
1fc892744c GPU: Fix: Use 2 slots for each UDIMs texture instead of 4
Create GPUNodeLinks for tiled_image and tiled_image_mapping together, to ensure they are the same texture.

See blender/blender#105661 (comment) for context and a more in-depth explanation.

Pull Request: blender/blender#105772
2023-03-15 17:58:25 +01:00
f518591abc Merge branch 'blender-v3.5-release' 2023-03-15 17:42:00 +01:00
72d64c35aa Cleanup: Basic C++ style for file_draw.cc
See #103343.
2023-03-15 17:40:00 +01:00
b9af4f6748 Cleanup: Remove unused headers in file_draw.cc 2023-03-15 17:40:00 +01:00
1bbb8b679f Cleanup: Move file_draw.c to C++
See #103343.
2023-03-15 17:40:00 +01:00
f6f2f4f264 Fix #105681: Sculpt trim generates smooth shaded faces
Caused by 5876573e14. We need to use the old default here
explicitly.
2023-03-15 12:32:45 -04:00
fee6238d33 Fix #105323: Compositor: Crash when using color-ramp with b-spline
... or carnidal interpolation with only 2 color stops.

This was triggering an incorrect path due to missing optimisation cases.
Just fall back to the unoptimized case fixes the assert.
2023-03-15 17:30:29 +01:00
ed4e0b559a Merge branch 'blender-v3.5-release' 2023-03-15 12:14:13 -04:00
1b34c466bc Fix #105711: Regression: Clone Tool in Image Editor not showing Stencil
This was likely caused by a bad merge when doing the uniform name
patching for Metal.
This also fix the same issue for active UDIM tile overlay which wasn't
reported.
2023-03-15 17:14:08 +01:00
c6878d5e82 Fix #103021: Metaballs have jagged normals
eaa87101cd made evaluated metaballs become meshes
for render engines. This exposed the normals calculated by the metaball
tessellation directly, whereas before they were recalculated later.

There are two fixes: not using the metaball tessellation normals at
all and calculating them with the standard Mesh code path instead,
or switching a define in the metaball code to use a more mesh-like
vertex normal accumulation. Since the results are very similar
(see attached renders), use the second solution, which should
be less expensive.

Pull Request: blender/blender#105799
2023-03-15 12:13:08 -04:00
19ca2e905e UI: Increase the size of the "Open Recent" list
Increase the default value for the maximum number of recently-opened
files from 10 to 20. Also change the user's preference on version bump
to this new value if their current value is exactly the old default.

Pull Request: blender/blender#105703
2023-03-15 17:09:36 +01:00
4f18022f80 Fix #105775: Make "Add > Fur" node setup stable with deformation
Move the deform curves with surface node group to last so it affects the
final generated curves consistently (though this will have a negative
performance impact), and make the generate and interpolate modifiers use
the surface mesh's rest positions.
2023-03-15 12:09:13 -04:00
c0e757a713 UI: Add scroll to sidebar tabs
When the height of the editor couldn't fit the sidebar tabs, they would shrink
to a size too small to read the tab label.

This change matches the behaviour with the Properties Editor navigation bar,
by introducing the following improvements:
* Avoid truncating tab labels.
* Allow scrolling when tabs don't fit.

Behaviour is similar to how scrolling works in the Properties Editor navigation
bar, supporting mouse wheel up/down and MMB, and switching tabs with
`Ctrl+Wheel Up/Down`.

Pull Request: blender/blender#105355
2023-03-15 16:45:11 +01:00
81818b797b Merge branch 'blender-v3.5-release' 2023-03-15 11:18:02 -04:00
6a96a151be Fix: Dyntopo attribute data warning doesn't work
My PR blender/blender#104535
was committed as 88f9c55f7f and the logic was changed
while adding support for face sets, making the logic incorrect and
the warning system disfunctional.

Restore the logic from the original PR with added support for face sets,
fix const correctness issues, improve variable naming, and remove a
check for empty names, since all attribute-type layers should have
names in a valid mesh.

Fixes #105780
2023-03-15 11:14:50 -04:00
c3dfe1e204 File Browser: Make full file name label draggable
Previously only the icon of a file could be dragged in the list display
modes, the name label would invoke box select. This made dragging quite
finicky. I've seen this cause quite some frustration, especially when
the file browser is used as a regular editor to drag data from into
other editors.

Instead follow the Outliner (and some other file browsers like the macOS
one): Dragging on empty space invokes box select, dragging on the name
or icon invokes drag & drop of the item.

The hitbox for the dragging is the width of the string, and the full row
height. So there's no space between rows to do box-select from, it
always triggers dragging. This is based on feedback during testing.

Note that 1e9564864c and 6da512f0bc were needed to prepare this change.

Pull Request: #104830
2023-03-15 16:03:00 +01:00
9332f27702 Fix #104124: Grease Pencil fills cover the lines below when drawing
The switch from `stroke_start` to `vertex_start` in 8c6d4aa103 forgot
to also update `iter->stroke_index_last` which also needs to use
`vertex_start`.

Pull Request: blender/blender#105797
2023-03-15 15:59:23 +01:00
2b78441c09 Merge branch 'blender-v3.5-release' 2023-03-15 13:59:10 +01:00
ffb120c560 Fix #105661: (Regression) Materials can use fewer images than before
Skip explicit binding location for samplers in OpenGL when not needed, since drivers can usually handle more sampler declarations this way (as long as they're not actually used by the shader).

Pull Request: blender/blender#105770
2023-03-15 13:58:28 +01:00
c31ba08f76 Fix #105661: (Regression) Materials can use fewer images than before
Skip explicit binding location for samplers in OpenGL when not needed, since drivers can usually handle more sampler declarations this way (as long as they're not actually used by the shader).

Pull Request: blender/blender#105770
2023-03-15 13:37:19 +01:00
30e517c3ca Merge branch 'blender-v3.5-release' 2023-03-15 13:07:26 +01:00
c4d6f766de Fix #105180: "All" asset library includes subfolders of current file
The loading for the "All" asset library would include the "Current File"
library as if it were a regular asset libray on disk. Instead make sure
the latter is loaded properly first and is skipped when recursively
reading on disk libraries.
2023-03-15 13:06:39 +01:00
254e3e133f Cleanup: format 2023-03-15 18:24:34 +13:00
559898709f Fix issues with retiming API
Ensure retiming data when operator is used, fix math for setting
retiming handle timeline frame.
2023-03-15 03:19:30 +01:00
089e8a1887 Cycles: Fix Metal API validation error (use uint instead of ushort)
This PR fixes an error that is given when Metal API validation is enabled. The compute grid can exceed 65536 threads so `ushort` is not sufficient for `metal_grid_id [[threadgroup_position_in_grid]]`.

This PR also fixes OS version warnings ([Cycles Metal: Unguarded access to newer macOS features #105630](blender/blender#105630))

Pull Request: blender/blender#105763
2023-03-14 22:05:55 +01:00
99506b3d73 Fix: Crash in weighted normal modifier
Mistake in 1dc57a89e9
2023-03-14 15:00:33 -04:00
7b66168bcb Merge branch 'blender-v3.5-release' into main 2023-03-14 18:19:53 +01:00
a7cd6de244 Fix Cycles missing light from multiple distant lights with different visibility 2023-03-14 18:19:12 +01:00
ee18b625ca Fix: Edit mesh face corner color operators always use first layer
The operator went through quite a bit of trouble to pass a color
attribute index to the operator, but then it always used the offset
from the first layer of the active color attribute's type.

Also remove the "copy domains temp" API function, which
generalized this more than necessary, and exposed the internals
of the custom data system a bit more than we would like.
2023-03-14 12:03:46 -04:00
3785dc8043 Fix #105146: Gpencil select does not work with Layer transforms
The transformations were applied two times and the old fix was wrong because it needs to use the evaluated point, not the original one. Also I did a small code cleanup.

Pull Request: blender/blender#105202
2023-03-14 16:57:46 +01:00
13ae75f545 Cleanup: Use C++ array type in skin modifier
This quiets a false positive (I think) allocation size warning for me.
2023-03-14 11:33:32 -04:00
90076b543b Cleanup: Remove two redundant color attribute functions
The two removed BKE functions were at a mid-level of abstraction
that doesn't make total sense in this API. Removing them is also
helpful in the general effort to have the attribute system rely less
on `CustomData` internally.
2023-03-14 11:33:32 -04:00
6d1cd997a2 Fix #105726: Driver Editing Popover Menu Closing
Allow specifying a specific region to check for active button. This is
required in some circumstances, like Driver Popover.

Pull Request: blender/blender#105746
2023-03-14 16:27:23 +01:00
92b607d686 CustomData: add separate function to add layer from existing data
This simplifies the usage of the API and is preparation for #104478.

The `CustomData_add_layer` and `CustomData_add_layer_named` now have corresponding
`*_with_data` functions that should be used when creating the layer from existing data.

Pull Request: blender/blender#105708
2023-03-14 15:30:26 +01:00
b06d522427 Fix potentially-uninitialised local variable
Very unlikely this caused any actual issue, but in theory it was possible.
2023-03-14 14:36:05 +01:00
258678916f Geometry Nodes: use lazy-function directly for switch node
This changes the Switch node so that it is implemented directly as a lazy-function,
instead of as a normal geometry node which uses `GeoNodeExecParams`. This improves
the design of the layered execution api, where different nodes can be implemented
at a proper different abstraction level. The simplest kinds of nodes are implemented
as multi-function, then there is `GeoNodeExecParams` and more specialized nodes are
implemented as lazy-function. The switch node is special in the sense that it currently
needs extra behavior in the lazy-function graph generation anyway.

`GeoNodeExecParams` can be simplified as well, because the Switch node was the only
one that used the `lazy_` methods.

We could consider adding back lazy-input functionality to normal geometry nodes
as it becomes necessary. Ideally, that could be integrated with the node declaration.

Pull Request: blender/blender#105696
2023-03-14 14:09:29 +01:00
96c6349cbf Fix #103605: Metal barycentric coordinate compilation failure
Fix support for Wireframe and parametric nodes by resolving
compilation failures surrounding barycentric coordinates.
A final missing part of the Metal implementation for barycentric
coordinates was missing.

Feedback also addressed to move barycentric calculation out
of code-gen and into surface_lib.

Authored by Apple: Michael Parkin-White

This also resolves #103606.
Ref #96261

Pull Request: blender/blender#105740
2023-03-14 08:23:02 +01:00
ce34024681 Merge branch 'blender-v3.5-release' 2023-03-14 16:09:44 +11:00
4ff3cd2476 Fix error building on Linux 2023-03-14 16:09:08 +11:00
51e5417bd3 Fix #105678: Crash assigning Image.pixels to an undersized sequence
Now only dynamic function parameters that use ParameterDynAlloc support
dynamically sized parameters arrays.

Add tests for both dynamic arrays that don't support resizing
(Image.pixels) and dynamic sized arguments using
(VertexGroup.add(index=[..])).

Regression in [0] which extended support for dynamic sized function
arguments.

[0]: dfb8c5974e
2023-03-14 16:00:24 +11:00
8929ed75d4 Image: Add OIIO support APIs
This adds a new set of APIs supporting the loading and saving of image
formats through OIIO. It makes use of the recent IOProxy work in OIIO
to align with the existing Blender image loading/saving machinery.

The support code here has been prototyped to work with ~7 of our image
formats so far. It includes centralized handling of `IB_test`,
`IB_mem`, and `IB_metadata` flags, which the existing code did not
handle consistently or at all depending on the format.

The PSD format (`format_psd.cc`) is included since the prior location
of the code has been restructured away. It serves as an example of how
the loading code typically flows for all the other formats.

Pull Request: blender/blender#105519
2023-03-14 04:42:17 +01:00
19565469c8 Merge branch 'blender-v3.5-release' 2023-03-14 13:41:43 +11:00
1c88bf6ce1 Fix #105715: Freeing the edit-mesh causes future access to fail
The BPyBMesh in `BMesh::py_handle` was invalidated but not cleared,
causing future access to return a 'dead' bmesh.
2023-03-14 13:36:54 +11:00
84b66c5a9c Cleanup: format, add missing CMake header 2023-03-14 12:53:37 +11:00
bc6985a6c1 Cleanup: doxygen comments 2023-03-14 12:51:37 +11:00
2a1a9307a7 Cleanup: spelling in comments 2023-03-14 12:36:49 +11:00
548d599dda Merge branch 'blender-v3.5-release' 2023-03-14 12:20:17 +11:00
708e84df90 Fix #105721: Fix crash accessing driver variables & targets
- DriverVariable.name update function passed DriverVar to
  BKE_driver_invalidate_expression as a ChannelDriver.

- DriverTarget.name update function passed DriverTarget to
  BKE_driver_invalidate_expression as a ChannelDriver.

- DriverVariable.type update function DriverVar accessed ChannelDriver,
  clearing a flag.

This was exposed by [0] however this issue existed beforehand.

[0]: c26566ad27
2023-03-14 12:16:22 +11:00
46da66f4df Fix: Uninitialized boolean arrays in mesh conversion
In practice this probably didn't cause bugs, but it would have
caused extra copies of the UV helper layers. The layers are only
needed if we find true values. Mistake in 0fe0db63d7.
2023-03-13 17:32:20 -04:00
1dba915dff Merge branch 'blender-v3.5-release' into main 2023-03-13 15:35:42 -03:00
98bfa8d458 Fix 'use_occlusion_test' option not having effect on wireframe
This is a non-recent regression that strangely went unreported.

It is expected that when snapping, only visible elements are considered
which does not include faces in wireframe mode.

This works like this before, and this change doesn't appear to have
been intentional.

Ref #105664
2023-03-13 15:34:39 -03:00
f92bacee94 Cleanup: use macro for 'SCE_SNAP_MODE_GEOM'
One of the advantages of separating this enum member from the others is
because mixing several members in a single one hinders debugging since
in this case the IDE does not define which enums were set.

Also separating this item makes it more readable as `SCE_SNAP_MODE_GEOM`
is not a snap mode but a combination of modes.
2023-03-13 15:34:26 -03:00
cf2c9fe186 Vulkan: Add initial VkPixelBuffer.
VKPixelBuffer is used by external render engines to allocate buffers
using the same GPU backend that Blender runs in.

In a later stage we should test what exact binding flags are needed. I
expect that it should be able to use as a transfer buffer to copy the
pixels over to a texture using transfer commands.

Pull Request: blender/blender#105741
2023-03-13 19:25:18 +01:00
2788fa915b Refactor: CurvesGeometry read/write function
This add the`CurvesGeometry::blend_read` and `CurvesGeometry::blend_write` methods
and uses them in the `curves_blend_read_data` and `curves_blend_write` functions.

No functional changes.

Pull Request: blender/blender#105737
2023-03-13 18:42:51 +01:00
ca2bf2f3a0 Fix #105625: GPencil sculpt crash with subdivide modifier
The created point hasn't a original point in the original stroke, so
must use only the valid points.

Pull Request: blender/blender#105627
2023-03-13 18:04:25 +01:00
69c6158cc8 Fix #105589: GPencil Paste duplicate active frame
The active frame is pasted always, so if multiframe is
copying the strokes don't need copy the active frame again.

Pull Request: blender/blender#105605
2023-03-13 18:02:36 +01:00
08fd5747d2 Python API: implement ViewLayer.aovs.remove
Implement ViewLayer.aovs.remove by adding a new RNA function to call
the internal BKE_view_layer_remove_aov.

Resolves #99259

Pull Request: blender/blender#105646
2023-03-13 17:29:19 +01:00
d3cfb2e20e Fix: Failing assert for meshes with no faces
It's okay if the normals span is empty when there are no faces
2023-03-13 11:40:22 -04:00
0b68e609fc Fix 105271: Luminance Matte not Working on NVIDIA.
Issue was that the clamping parameters were not in
the correct order. This leads to undefined behavior
and also lead to small artifacts on other platforms.

Pull Request: blender/blender#105735
2023-03-13 16:07:17 +01:00
097492b326 Merge remote-tracking branch 'origin/blender-v3.5-release' 2023-03-13 15:24:19 +01:00
6e4bcb7c87 Fix #100659: "Add F-Curve Modifier" applies only to Active F-Curve
In most places where it appears in a menu, the operator would already
apply to all selected F-Curves. Now it is done consistently and explicitly
from all menu items. The default of the operator is now also set to 'all
selected', so that it also behaves like that when called from the operator
search menu.
2023-03-13 15:23:57 +01:00
2ae9526cd9 Cleanup: Small changes in Mesh BMesh conversion
Tweak variable naming, remove a few unnecessary comments,
remove a timer accidentally committed previously.
2023-03-13 09:20:15 -04:00
0fe0db63d7 Mesh: Optimize BMesh to Mesh conversion with UV maps
The BMesh to Mesh conversion does some checks to the UV helper
attributes like selection to avoid copying them to the mesh if they
don't contain any meaningful data. However, it does this by looping
over all faces for every UV map, not in parallel, so it takes up a large
portion of the total time in the conversion. This commit moves that
to the existing similar checks.

On a 1 million face mesh with 3 UV maps, for me this improved the
conversion runtime by 75%, from 174ms to 99ms. Before the serial
loops took 88ms out of the total. Combining them with the existing
loop over faces only increased its runtime from 29 to 40ms.
2023-03-13 09:07:52 -04:00
ea50dbe615 Merge remote-tracking branch 'upstream/blender-v3.5-release' 2023-03-13 13:00:48 +01:00
84bcc1abfe Updated translations from svn trunk (r6385). 2023-03-13 12:59:46 +01:00
2bd88340bd Fix compiler warning 2023-03-13 11:57:03 +01:00
c6d6a3517e I18n: extract add-on bl_info warnings
Some add-ons choose to use the `warning` field in the `bl_info`
dictionary. This is potentially useful info, which should be shown to
the user translated.

This commit extends `dump_addon_bl_info()` from the i18n utils add-on,
to add this field to the message extraction.
2023-03-13 11:19:42 +01:00
4238080568 Cleanup: Remove gpu prefix in gpu test cases.
The _gpu_ prefix is redundant as they are inside a namespace
and run as part of a test suite that already contain the name
gpu. (GPUOpenGLTest)

This patch also moved the texture test cases to its own
compile module.
2023-03-13 11:14:17 +01:00
93bb443086 Fix: failing test in debug build due to wrong span size 2023-03-13 10:55:48 +01:00
df0c2693b6 Refactor: Rename grease pencil files to legacy
This renames the `BKE_gpencil_*` as well as the `DNA_gpencil_types.h`
files to indicate that it's the legacy grease pencil.

Pull Request: blender/blender#105597
2023-03-13 10:42:51 +01:00
6567ff558c Fix: Failing test case due to resource lifetime.
When a shader is bound it should outlife the pipeline. In one
test case where only the shader data was accessed it also bound
the shader. This isn't needed as the shader data should be
retrieved without binding the shader.

This change fixes the issue by not binding the GPU shader.
2023-03-13 09:54:57 +01:00
a26203bb3e Fix: Incorrect version code.
Patch version was increased, but the file subversion should have
been increased.

Also fixes previous incorrect patch versioning code as it didn't
add all 'version code until next subversion bump goes here.' after
version bump.
2023-03-13 08:38:04 +01:00
cbc73a1e05 Cleanup: Make mesh function static 2023-03-12 17:35:50 -04:00
03fffc08b6 Cleanup: Fix unused variable warning in release builds 2023-03-12 17:34:01 -04:00
050e08e5f0 Cleanup: Remove unused UI handlers function
Unused after c402b3f52f
2023-03-12 17:33:23 -04:00
68ec41d00e Cleanup: Remove unused mesh function
The function set bits in a bitmap for all the edge indices in a face.
With future changes to mesh topology storage though, this level
of abstraction won't be as helpful anyway.
2023-03-12 17:32:26 -04:00
1dc57a89e9 Mesh: Move functions to C++ header
Refactoring mesh code, it has become clear that local cleanups and
simplifications are limited by the need to keep a C public API for
mesh functions. This change makes code more obvious and makes further
refactoring much easier.

- Add a new `BKE_mesh.hh` header for a C++ only mesh API
- Introduce a new `blender::bke::mesh` namespace, documented here:
  https://wiki.blender.org/wiki/Source/Objects/Mesh#Namespaces
- Move some functions to the new namespace, cleaning up their arguments
- Move code to `Array` and `float3` where necessary to use the new API
- Define existing inline mesh data access functions to the new header
- Keep some C API functions where necessary because of RNA
- Move all C++ files to use the new header, which includes the old one

In the future it may make sense to split up `BKE_mesh.hh` more, but for
now keeping the same name as the existing header keeps things simple.

Pull Request: blender/blender#105416
2023-03-12 22:29:15 +01:00
5669c5a61b Mesh: Parallelize BMesh to Mesh conversion
This is very similar to ebe8f8ce71, but applies the same
changes to conversions to non-evaluated meshes meant for original
data. The function also handles shape keys, UVs, selection history,
"scan the database" object vertex index remapping, and multires fixes.
Those operations are handled in parallel with the other conversions now.

Similar to before, the improvement is better the more attributes/data
contained in the BMesh. This time I observed an improvement of 50%
(182ms to 123ms) for a large grid mesh with many attributes, and 20%
for a large grid mesh with less data. Shape keys, selection, hiding, and
multires data should have less of a detriment to performance now too.

One remaining thing to improve is the recently added UV selection/pin
handling. This should be moved into the first single-threaded loop over
faces, or changed further.

Pull Request: blender/blender#105602
2023-03-12 21:50:14 +01:00
4096bcfb25 I18n: extract math node operation type header messages, fix another
- The Math node lost the headers of its operation type menu in
  ee985fa925 , because a translation context was assigned to the RNA
  property, but the headers declaration was not updated to extract the
  messages with matching contexts.
- The message "Group Input" had a trailing space, which can be added
  after translation.
2023-03-12 16:01:56 +01:00
e2030fbc33 Fix: Add missing default versioning for retopology overlay color
This is something we missed in #104599.
Without it, the default color isn't always set.
Thanks to user roman-13 for pointing out the problem,
and thanks to Hans Goudey for telling me the solution.

Pull Request: blender/blender#105539
2023-03-12 09:33:52 +01:00
adfffb7d32 Fix: normalize matrix before converting to euler
Without this, Blender aborts due to an assert.
2023-03-12 05:55:06 +01:00
54c9f972df Merge branch 'blender-v3.5-release' 2023-03-11 08:33:50 +01:00
7d22b11352 Fix #105601: Remove duplicates when inserting links into multi inputs
Fix a regression that allowed to create several links between an
output socket and a multi input socket either by inserting
links or using the link swap feature.

This regression was caused by the link swapping feature
introduced in commit 89aae4ac82.

Pull Request: blender/blender#105631
2023-03-11 08:27:56 +01:00
b06edc2897 Cleanup: UV: simplify uv packing API.
Rename `struct ::UVPackIsland_Params` to
`class blender::geometry::UVPackIsland_Params`

Brings us closer to an "algorithm" style API.

No functional changes.
2023-03-11 14:59:58 +13:00
e56fe42aab Cleanup: format 2023-03-11 14:25:46 +13:00
eaa5a439b5 Merge branch 'blender-v3.5-release' 2023-03-11 12:01:33 +11:00
622c911534 Merge branch 'blender-v3.5-release' 2023-03-11 12:01:31 +11:00
e7b21403d2 Merge branch 'blender-v3.5-release' 2023-03-11 12:01:28 +11:00
65d8f9e140 Merge branch 'blender-v3.5-release' 2023-03-11 12:01:26 +11:00
0ea8e59151 Merge branch 'blender-v3.5-release' 2023-03-11 12:01:24 +11:00
12e8664f96 Merge branch 'blender-v3.5-release' 2023-03-11 12:01:22 +11:00
3c8b749a38 Merge branch 'blender-v3.5-release' 2023-03-11 12:01:19 +11:00
fe58ccfafb Mesh: compact edit-mesh undo data in parallel (address #105046)
Multiple user actions performed quickly could be blocked by undo
compacting memory - if the background compacting task was not complete
when the next undo step was pushed.

Notes:

- This and recent improvements to BLI_array_Store gives over ~2x speedup
  compared with 3.3x, over 10x compared with 3.4x.
  A sub-surfaced cube with the modifier applied was used for testing
  (~1.5 million polys), both randomized & non-randomized verts/edge/faces
  were used to avoid the sub-surface memory layout biasing the results.
  Tested transforming ~1/3rd of the mesh and inverting selection.

- Without compacting mesh-data in parallel, the optimizations to
  BLI_array_store can give similar performance to 3.3x, however there
  are still cases where performance isn't quite as good - so compact the
  arrays in parallel to ensure performance is at least as good as 3.3x.

Resolves #105046.
2023-03-11 11:58:09 +11:00
16968ccec7 BLI_array_store: improve hash accumulation for each memory chunk
The method of accumulating values to create a hash for each chunk has
been improved for ~16% better distribution of the resulting hashes.

Improve performance of array de-duplication, see: #105046.
2023-03-11 11:58:08 +11:00
7a5cb3b470 BLI_array_store: improve hash for smaller values (including booleans)
Accumulating hashes with a byte/boolean array didn't include enough
information for a useful hash, creating hashes with many collisions.

This is the root cause of a performance regression since 3.3 where
mesh data (used for storing edit-mesh undo steps) was changed to store
selection in a boolean array, creating a bottleneck de-duplicating
chunks of that array for edit-mesh undo's custom-data de-duplication.

Resolve by increasing hash accumulation for arrays with smaller elements,
so each chunk of memory (a candidate for de-duplication) isn't as likely
to have hash collisions.

`char` (single byte) arrays now accumulate 22 values instead of 7, it's
taking more values into account was necessary as these are effectively
bits in the case of boolean arrays, 2-byte values accumulate 32 bytes,
4-byte elements accumulate 44 bytes, larger structs accumulate
`sizeof(type) * 7` bytes (as before).

Also ensure the accumulation read-ahead never exceeds the chunk size -
technically a fix although this would only happen when passing a small
`chunk_count` to BLI_array_store_create (in the range of 1-16) so this
didn't happen in practice.

Improve performance of array de-duplication, see: #105046.
2023-03-11 11:57:56 +11:00
1b10883498 BLI_array_store: use uint32_t instead of uint64_t for hash storage
Use uint32_t since it's sufficient for hashing, using an int64_t was
especially inefficient when allocating an int64_t for every boolean
(when compacting an array of booleans).

Improve performance of array de-duplication, see: #105046.
2023-03-11 11:57:54 +11:00
2bfe9b50c6 Fix error freeing NULL if BArrayStore_AtSize is empty
Calling BLI_array_store_at_size_clear on an BArrayStore_AtSize
which was not used would attempt to free a NULL pointer.
2023-03-11 11:57:08 +11:00
412c62f62e Cleanup: rename BChunkList::total_size -> total_expanded_size
Use this name to avoid confusion between expanded & compacted sizes.
2023-03-11 11:57:06 +11:00
ce70e0055f Cleanup: improve/correct doc-strings, use doxygen formatting 2023-03-11 11:57:04 +11:00
c402b3f52f Fix #63890: Allow Eyedropper and Other Operations in Popovers
Allow some operations on contents of popovers, like resetting to
defaults and use of the eyedropper.

Pull Request: blender/blender#105387
2023-03-11 00:36:39 +01:00
4d5a3c9932 Merge branch 'blender-v3.5-release' into main 2023-03-10 16:55:04 -03:00
3baccee0af Pass BitVector by reference in lambda
This is a fix for the previous commit d7c023eb25.

Before, every time the lambda was called, a copy of the BitVector was
made. This was very inefficient.

Now this has been fixed by passing the BitVector by reference (&) in
the lambda function.
2023-03-10 16:54:40 -03:00
3f0853264f Merge branch 'blender-v3.5-release'
Conflicts:
	source/blender/geometry/intern/mesh_merge_by_distance.cc
2023-03-10 16:09:02 -03:00
d7c023eb25 Fix #105583: crash when weld modifier checks for duplicate polygons
In very specific cases, during intersection testing, `intersect` can
add polygons already checked as duplicates in the buffer that
corresponds to the rest of polygons that can form groups of duplicates.

As the buffer cannot have repeated indices, re-adding, even
temporarily, these duplicates can cause a buffer overflow.

While this may have some impact on performance, it's difficult to
predict these cases and thus add a buffer pad.

So the solution is to check if they are already duplicated.
2023-03-10 16:07:32 -03:00
e7a3a2c261 Fix custom normals not normalized in Cycles shader nodes 2023-03-10 19:29:27 +01:00
e7b0a23283 Fix (unreported) broken ID remapping code, and improve efficiency.
Commit ea97bb1641 introducing the GHash mapping between objects and
their CollectionObject items in a Collection broke ID remapping of
collections's objects. Release builds would 'work', but debug builds
would assert in several ways when opening complex production files.

The root of the issue was a bad/missing handling of the 'duplicate case'
(several CollectionObjects pointing to a same Object).

While fixing the code was possible, it turned out to require disabling
to much safety checks. Further more, there was an opportunity to improve
efficiency of the related code in ID remapping (the pos-processing
checking for NULL and duplicates in collections objects lists).

This commit introduces a new 'dirty' tag for CollectionObject lists and
their ghash mappings.

This tag is set by the `foreach_id` callback when the `ob` pointer of a
CollectionObject is changed, and it is detected as (potentially)
breaking the consistency of that data.

This tag is then used by a new `BKE_collections_object_remove_invalids`
call, to only check and fix collections tagged as dirty, instead of all
the collections in the given Main. It replaces the previous
`BKE_collections_object_remove_nulls` and
`BKE_collections_object_remove_duplicates` functions.
The speed-up is about an order of magnitude for the clean-up code
itself, which gives 2-3 percent speed-up on resynching a complex
production file e.g.

This commit also includes some cleanups and re-organization of related
code.
2023-03-10 18:52:01 +01:00
111038062a Cleanup: Remove unused node function declarations 2023-03-10 12:26:55 -05:00
4f56b02a0c Fix #95105: Unclamp draw size of the frame node's label
Fix issues with the display of frame node labels, that made them
harder to read for people with low vision or on high dpi displays:
* Unclamp the size of text that is drawn in the frame node
  so all sizes can be displayed consistently at all zoom levels
  and independet of the UI scale.
* Account for the label when calculating the frame node's
  bounds, so child nodes don't obscure the label.

Pull Request: blender/blender#104555
2023-03-10 18:24:22 +01:00
9b354e9433 Merge branch 'blender-v3.5-release' 2023-03-10 17:59:02 +01:00
55281c0eed Fix #105638: image.pixels.foreach_set() does not update displayed image
Pull Request: blender/blender#105639
2023-03-10 17:58:13 +01:00
9f76a21677 Merge branch 'main' of projects.blender.org:blender/blender 2023-03-10 21:16:59 +05:30
577fd9add5 Merge branch 'blender-v3.5-release' 2023-03-10 21:11:09 +05:30
c2fdbcca3c Fix #102317: Any action triggers expansion of all ViewLayers
Don't expand view layer elements if element is previously used
This is similar as done for other display mode (eg. scene, library override)
Pass view_layer ID instead of scene as argument in `outliner_add_element`

Old Differential Revision: https://archive.blender.org/developer/D16661

Pull Request: blender/blender#104862
2023-03-10 16:37:04 +01:00
3ea36e9134 Merge branch 'blender-v3.5-release' 2023-03-10 16:26:29 +01:00
382a54aefb Fix #101374: enable edge panning for move operators in menus
This patch enables edge panning for the operators where there was
a mismatch in behaviour between using the shortcut `G` and the
"Move" operator exposed via the menu and operator search.

Commit 19da434e9c introduced a `view2d_edge_pan` property which
was activated for the translate operators invoked when pressing G in
the default keymap.
The property is not enabled by default, to avoid it getting in the
way in some cases, so the "Move" operators exposed via the menus
didn't have edge panning. This lead to inconsistent behavior between
moving via the shortcut or via the menu.

Pull Request: blender/blender#104482
2023-03-10 16:22:48 +01:00
466eb426ed Extern: Update TinyGLTF to include fix for CVE-2022-3008
The use of wordexp(3) permits arbitrary code execution from manually-crafted
glTF files. See https://github.com/syoyo/tinygltf/issues/368 for more details.
In practice this shouldn't be an issue for Blender since the GlTF data isn't
manually crafted but from the OpenXR runtime (a bit like a driver). But
updating the library to include the fix is not a big deal anyway.

Note that the warning that required the local modification is no longer present upstream since
  0bfcb4f49e

Pull Request: blender/blender#105536
2023-03-10 14:56:35 +01:00
a60626ab0b Cycles: Workaround for MetalRT crash when building pipelines
Workaround for a crash when `addComputePipelineFunctionsWithDescriptor` is called *after* `newComputePipelineStateWithDescriptor` with linked functions (i.e. with MetalRT enabled). Ideally we would like to call `newComputePipelineStateWithDescriptor` (async) first so we can bail out if needed, but we can stop the crash by flipping the order when there are linked functions. However when addComputePipelineFunctionsWithDescriptor is called first it will block while it builds the pipeline, offering no way of bailing out.

Note that this only has an impact when the "MetalRT (Experimental)" option is checked.

Pull Request: blender/blender#105629
2023-03-10 12:36:58 +01:00
4805a54525 BLI: Math: Move rotation types template out of math::detail
The reasoning is that the detail namespace is not to be used
outside the module itself. But one might want to use different
number types with these templates.

The `Base` suffix was chosen in order to be consistent with `MatBase`
and `Vector` naming convention.
2023-03-10 11:48:15 +01:00
2e03352492 Refactor: fcurve bounds functions
Refactor the following functions and cover with tests

* `BKE_fcurve_calc_bounds` - used to get the `rctf` bounding box of an fcurve
* `BKE_fcurve_calc_range` - used to get only the x-range, potentially faster when not needing y extents

`get_fcurve_end_keyframes` has been replaced with `get_bounding_bezt_indices` - dealing with indices allows to iterate over that range later

### BKE_fcurve_calc_bounds
* pass in an `rctf` instead of float pointers
* extract logic to get bounds into separate functions

### BKE_fcurve_calc_range
* removed the parameter `do_min_length` it was always false, and this function shouldn't concern itself with clamping.
Calling code can do that if the return bool is false
* use function to get x bounds separated from `BKE_fcurve_calc_bounds`

Pull Request: blender/blender#105177
2023-03-10 11:33:11 +01:00
a6b8bdaa45 Cycles: oneAPI: fix AoT compilation when triggered from makepkg (archlinux)
Archlinux faced an issue with AoT compilation: https://bugs.archlinux.org/task/77554
These were due to compiler flag strings handling going wrong when cmake
calls the custom command. It ended up moving quotes around, leading flags to
get passed to the main compiler instead of the graphics compiler and trigger
the following error: "Unrecognized build options: -ze-opt-regular-grf-kernel".

Pull Request: blender/blender#105615
2023-03-10 11:07:02 +01:00
bcd99bcb5b Cycles: oneAPI: fix linking for when icpx compiler is used
When compiling from MSVC environment, libs such as libircmt.lib weren't
found, we need to set the path to these in LIB environment variable.
2023-03-10 11:07:01 +01:00
219be2e755 BLI; Math: Remove Normalized template parameter for some conversion
Always expect normalized matrix input as per API design.
2023-03-10 10:20:22 +01:00
896ba33336 GHOST: use logging for GHOST_NDOFManagerUnix
Even for debug builds, NDOF info on startup is unnecessarily noisy.
2023-03-10 13:12:27 +11:00
d64dfc4333 Cleanup: spelling in comments 2023-03-10 12:58:10 +11:00
ecc3e8c751 Cleanup: format, sort CMake file lists 2023-03-10 12:50:17 +11:00
10f06221c1 Cleanup: UV: simplify uv packing
Remove dependency on boxpack_2d in public API.

Brings us closer to full rotation in UV Packing.

No functional changes.
2023-03-10 13:56:33 +13:00
d474732f91 Cleanup: UV: simplify types
No functional changes.
2023-03-10 12:59:26 +13:00
66b4a4427b Sculpt: Edit face set operator improvements
* Last operator panel now works
* Added a strengh property for fairing modes
* Now works when called from a menu (added OPTYPE_DEPENDS_ON_CURSOR
  to operator type flag).
2023-03-09 15:43:05 -08:00
d795c00b88 Sculpt: Fix #105557 Bugs in new sculpt menu entries
Note: the wrong hotkeys are still displayed for
move/rotate/scale, for some reason the base view3d
keymap values are being used.
2023-03-09 15:20:22 -08:00
bd3c6801da Cleanup: BLI: Rotation: Remove unneeded type forward declarations 2023-03-10 00:02:53 +01:00
3982aa922e BLI: AxisAngle: Fix wrong constructor
The constructor was using the incorrect cast to VecBase3.
Also removes a redudant cast.
2023-03-10 00:02:53 +01:00
610cb16d5d BLI: AxisAngle: Make axis normalization mandatory
This moves out the normalization as per math API design (no implicit
normalization of inputs).
2023-03-10 00:02:53 +01:00
f70171e9c6 Cleanup: format 2023-03-10 11:00:18 +13:00
caf90c6a90 Fix #105587: Triangulated shading in sculpt mode
The function to upload the normals uses an optimization to avoid
checking the smooth status or face normal of the triangle is part
of the same face. The smooth status needs to be initialized before
the loop for that to work.

Also do a bit of cleanup:
- Decrease variable scope
- Fix the reversed incorrect naming of `smooth`
- Retrieve mesh data at the start of the function
2023-03-09 14:44:25 -05:00
68a142ee7b Fix #105524: Texture paint broken after recent cleanup
eb68334b58 replaced the pointer to looptris with a span
but left the variable for the number of looptris unset at zero. Fix by
using the size of the span instead.
2023-03-09 14:25:53 -05:00
0fe1a02055 Merge branch 'blender-v3.5-release' 2023-03-09 13:50:29 -05:00
4912695e00 Fix #105610: Missing "Amount" validation in duplicate elemnts node
The count wasn't clamped above zero in some newly optimized code.
Instead of adding it there, move the clamping to the field network,
similar to some other nodes. That makes it so the rest of the code
doesn't have to deal with the clamping, and should be faster in the
single-value case.
2023-03-09 13:49:16 -05:00
af5a115f65 GPU: Refactor API for Clearing Storage Buffers
The previous API for clearing storage buffers was following the OpenGL
api. OpenGL has many options to support for data conversions, striding
and sizzling. Metal and Vulkan don't have these features and we have to
deal it ourselves.

Blender internally only uses a tiny subset for what is possible in
OpenGL. Making the current API to difficult to implement on our future
platforms as we had to implement all cases, most even not used at all.

By changing the API we make future development easier as we only need
to implement what we are actually using.

**New API**

`GPU_storagebuf_clear(GPUStorageBuf* ssbo, uint32_t clear_value)`

Related issue: #105492

Pull Request: blender/blender#105521
2023-03-09 18:46:28 +01:00
ffcd8e6b02 Eevee-next: Use compute shader to clear clipmaps
Clearing of clipmaps is the only place in Blender that uses non
uniform data (not all components of the cleared data to be exact
the same).

Vulkan has only the possibility to clear buffers using a single
uint32_t. There were two solutions:
- Add compute shader to Vulkan backend.
- Make Eevee-next responsible to clear the clipmaps.

When fixing this in the Vulkan backend it could lead to other issues
as the backend isn't aware what is exactly required and might overwrite
active bindings. We chose to make it a responsibility of Eevee-next
as there it is clear what is needed.

Related issue: #105492

Pull Request: blender/blender#105560
2023-03-09 18:28:05 +01:00
28a581d6cb BLI: Rotation C++ API
This patch re-implement the whole C rotation API into a more type
oriented C++ API. See the #104444 design task for more details about
the goals.

The list of C to C++ equivalent syntax can be found attached.

This adds `AngleRadian`, `AngleCartesian` and `AngleFraction` as
different angle types with the same interface. Each of them have
specific benefits / cons. See inline documentation for detail.

This adds `Axis` and `AxisSigned` class wrapped enums to increase type
safety with axes selection.

This adds `CartesianBasis` to represent orthonormal orientations.

Added a weight accumulation to dual-quaternions to make normalization
error proof. Creates the overhead of summing the total weight twice
(which I think is negligible) and add an extra float.

Named the dual-quaternion `DualQuaternion` to avoid naming ambiguity
with `DualQuat` which come up quite often (even with namespace).

Pull Request: blender/blender#104941
2023-03-09 18:15:22 +01:00
f9c627b275 Mesh: Set bounds eagerly for cube and grid primitive nodes
For mesh primitives, the bounds can be calculated trivially in advance
with negligible cost. In case they are needed later on, setting them
eagerly can save the calculation later on. For large meshes, this can
save tens of milliseconds before drawing.

Pull Request: blender/blender#105266
2023-03-09 18:11:53 +01:00
0fd026d0b4 Sequencer: Use Same Sampling As Rendering.
When subsampling was introduced in VSE it was disabled during
editing. Only when rendering it was enabled. This lead to
cache being different between editing and rendering. Leading
to confusion.

This PR will enabled the subsampling when editing. This way
it is more consistent.

Pull Request: blender/blender#105612
2023-03-09 18:02:17 +01:00
10cf02d26b Fix #104466: Resolve smooth lines in Metal.
Caused by replacement of Macro with uniform
in overlay edit mesh vert shader.

Pull Request: blender/blender#105609
2023-03-09 17:04:00 +01:00
a8819481cb Merge branch 'blender-v3.5-release'
Conflicts:
	source/blender/modifiers/intern/MOD_array.cc
2023-03-09 16:53:06 +01:00
e699bd780c Cleanup: silence unreferenced param warning in MSVC
This warning appears when the `WITH_BULLET` option is off.
2023-03-09 12:50:07 -03:00
b7679addd2 cmake/win32: Fix building with WITH_VULKAN_BACKEND
The shader libraries were not hooked up yet in cmake for windows since
when the shaderc libs landed there was no code yet that used it.

It's required now, so this change adds the missing bits.
2023-03-09 08:41:17 -07:00
8b2556e8d8 Fix (unreported) crash in Array modifier in case of empty mesh.
Return early the input mesh in case it is fully empty.
2023-03-09 16:36:56 +01:00
15dd622a63 Fix (unreported) crash in clnors with empty mesh.
Do not try to allocate zero-size memory from memarena.
2023-03-09 16:34:27 +01:00
ebc062191c LibOverride: Do not assert on invalid resync situation.
Some checks here are really critical and should assert, but that one is
more an indication that something is not going right, though data itself
should still be mostly valid, so better warn the user with a LOG
warning, than be silent in release builds, and crash in debug ones.
2023-03-09 16:31:07 +01:00
b0037c5c6b Texture Painting: Fix Seam Bleeding of Non-Manifold Sections of Mesh
Fix seam bleeding of non-manifold sections of the mesh, by copying pixels
that are covered by the brush stroke.

As manifold parts are already handled, the pixel copying solution can be
very straight forward.

* Pixels are copied from the same tile. So we don't need a mechanism that
  copies and merges pixels from other tiles.
* Pixels are copied from the closest pixel that is being painted on. We
  don't need to consider that that pixel can be in different areas of the
  tile.

When we copy a pixel, we find the closest pixel in UV space that is being
directly influenced by a paint brush. We also look for the second closest
pixel, which is still a neighbor from the closest pixel. We can mix both
pixels together and store it in the destination. A mix factor is calculated
using the closest non manifold edge as a guidance.

The result of this step is a list of copy and mix commands that can be
executed to fix the seam bleeding for non-manifold sections of the mesh.

| Destination | Source 1 | Source 2 | Mix factor |
| ----------- | -------- | -------- | ---------- |
| 1780,1811   | 1780,1810| 1779,1810| 0.000000   |
| 1781,1811   | 1781,1810| 1782,1811| 0.168627   |
| 1828,1811   | 1828,1810| 1827,1811| 0.156863   |
| 1829,1811   | 1829,1810| 1828,1810| 0.188235   |
| 1830,1811   | 1830,1810| 1829,1810| 0.188235   |
| 1831,1811   | 1831,1810| 1830,1810| 0.188235   |
| 1832,1811   | 1832,1810| 1831,1810| 0.188235   |
| 1833,1811   | 1832,1810| 1832,1810| 0.000000   |

In the end we go over this list mix the sources and store the result at
the destination.

```
tile_buffer[destination] = mix(tile_buffer[source_1],
                               tile_buffer[source_2],
                               mix_factor);
```

**Encoding**
When using a large textures or large seam margins this table can grow
large and reduce performance as data retrieval is slower, than the
operations it has to perform. To improve the performance we encode the
table so less data retrieval needs to be done.

* first `DeltaCopyPixelCommand` is delta encoded from
  `CopyPixelGroup#start_destination` and `start_source_1`. The others
  are delta encoded from the previous `DeltaCopyPixelCommand`.
* For performance reasons PixelCopyGroup#pixels are ordered from
  destination (left to right) for each row a new group would be created
  as the delta encoding most likely doesn't fit. When pixels cannot be
  delta encoded a new group will also be created.

**Compression rate**
When using Suzanne the compression rate is around 36% when using a seam
margin of 4 pixels. The compression rate may vary depending on seam
margin and model. For Suzanne the compression rate was around 36% for
various resolutions.

| Resolution | Margin | Decoded size | Encoded size | Compression |
| ---------- | ------ | ------------ | ------------ | ----------- |
| 2048x2048  | 4 px   | 353.052      | 128.101      | 36%         |
| 4096x4096  | 4 px   | 700.140      | 255.137      | 36%         |
| 8192x8192  | 4 px   | 1.419.320    | 513.802      | 36%         |
| 2048x2048  | 8 px   | 721.084      | 193.629      | 26%         |
| 4096x4096  | 8 px   | 1.444.968    | 388.110      | 26%         |

Pull Request: blender/blender#105336
2023-03-09 16:11:01 +01:00
f27d6b9640 MSVC: lower C4100 warning level from 4 to 3
The C4100 warning is related to unused formal parameters in functions.

Enabling it better aligns with "-Wunused-parameter" option in other
compilers.

While suppressing it with `__pragma(warning(suppress:4100))` is not the
same as using `__attribute__((__unused__))` in GCC or Clang, it is
still preferable to use it over completely hiding the warning.

This ensures consistent warning behavior across compilers and improves
code quality by addressing unused function parameters.

(Note that some warnings in Windows-specific code have already been
silenced in 7fcb262dfd)

Pull Request: blender/blender#105534
2023-03-09 16:05:48 +01:00
85fb63f99c Cleanup: Move functions in BMesh Mesh conversion
These functions will be useful to speed up the edit mode to object
mode conversion too, move them above that so they can easily be
used for that case later.
2023-03-09 09:41:26 -05:00
d21b9a4bb6 Vulkan: Warn Developer When Layer Not Found.
Currently a developer that starts blender with `--debug-gpu` or
runs the GPU test cases can receive an error when not the full
VulkanSDK is installed.

The VulkanSDK isn't required for normal developement and
therefore it is better to show it as a warning.

NOTE: VulkanSDK is adviced to use when developing in the Vulkan
backend as it contains tools that helps/speed up the development
and validation during development.

Pull Request: blender/blender#105599
2023-03-09 14:55:40 +01:00
85a70e9756 Fix memory leak with button tooltip callback and decorator buttons
Decorator buttons would be skipped when setting the tooltip data for all
buttons in the layout, but the duplicated data would still be marked as
used, so not freed.
2023-03-09 14:38:51 +01:00
3b900048f1 Animation: Move Graph Editor settings to User Preferences
Move two settings that were previously in the "View" menu of the Graph Editor into User Preferences.

It has been mentioned in the meeting by Luciano Muñoz Sessarego that it would be good to move that to the preferences so you can set it once and then forget about it.

The Settings moved are:

    Only Selected Curve Keyframes
    Use High Quality Display

Pull Request: blender/blender#104532
2023-03-09 14:15:23 +01:00
0239eee1c6 Fix build error on Windows introduced in 46be42f6b1 2023-03-09 13:48:14 +01:00
7edb3ab5e0 Merge branch 'blender-v3.5-release' 2023-03-09 13:16:15 +01:00
dcfc9629c2 Fix OptiX TLAS being built with invalid traversables when a geometry is empty
The traversable handle of a BLAS may be zero when the relevant geometry
is empty (no triangles/curves/points/...), as no BLAS is built in such cases.
It is not correct to attach a zero handle to a TLAS, so filter out such instances.
2023-03-09 13:15:08 +01:00
560314b7fd Merge branch 'blender-v3.5-release' 2023-03-09 11:21:27 +01:00
a4fd2d10c1 Fix #105571: crash when connecting invalid node group to multi input
Invalid nodes are not added to the lazy-function graph. Therefore, their
outgoing links are also not added, which implies that the targets need
some default value.
2023-03-09 11:19:59 +01:00
c20bf8d61e GPU: Replace old shader tests with shader builder.
Both the shader_builder and existing shader tests eventually
tested the same aspects. shader_builder is more modern and
handles more cases.

The old shader test requires a full backend in order to run
This commit replaces the old tests to just use the
shader builder for validation.

Shader builder can still be run at compile time, this is
just a convenience to have as a test case as well for CI/CD.

Ref: #105482
2023-03-09 10:40:57 +01:00
0ad06cd39d Vulkan: Automap Buffers.
It is recommended to map buffers once and not each time the
mapped memory is needed. This patch will map the buffer when
created and unmap the buffer when the buffer is freed.

This patch will reduce the overhead where the Vulkan driver or
the virtual memory manager needs to be accessed.

Pull Request: blender/blender#105588
2023-03-09 09:27:42 +01:00
c77b78ad53 Fix: restore margin offset for UV packing
Regression caused by b1185da403
2023-03-09 18:15:11 +13:00
9d3edb7e9a Cleanup: clear the linked list pointers for wmWindow::event_last_handled
While this doesn't cause any bugs, these may reference freed memory
so it's best to clear them as the event is no longer in a list.
2023-03-09 15:57:08 +11:00
09ba0210d9 Docs: note wmWindow::event_last_handled is for event queue handling only 2023-03-09 15:57:08 +11:00
7dcc040118 Merge branch 'blender-v3.5-release' into main 2023-03-09 01:33:14 -03:00
495a6ec6cc Fix #105579: weld modifier crashes when merging n-gons
The correction bbc6bb3468 was still wrong because there it was
disregarded that `vert_ctx_len` does not necessarily indicate merges in
the same polygon.

Therefore, it is not safe to rely on `vert_ctx_len` to count possible
new polygons.

NOTE: It might be worth preempting part of the
`weld_poly_split_recursive` logic to identify what the new polygons are
in advance. But this can be left for a future refactor.
2023-03-09 01:32:29 -03:00
434526f3fc Cleanup: use doxy sections 2023-03-09 14:53:44 +11:00
39ab104761 Cleanup: remove invalid copy-pasted comments 2023-03-09 14:53:44 +11:00
ea913d40a2 Cleanup: format 2023-03-09 16:33:05 +13:00
25d2a4f948 Merge branch 'blender-v3.5-release' 2023-03-09 13:16:39 +11:00
f4c6ad5eb3 Fix RNA path functions not escaping strings, using single quotes
Add doc-string to RNA_def_struct_path_func to avoid this in the future.
2023-03-09 13:14:57 +11:00
c10377cf08 Cleanup: rename 'ok' to 'success' in file reading, double-quote paths
- Both success & ok were used for file reading, use the clearer name.
- Paths were single/double quoted, use double quotes for print/reports.
- Rename `path` to `filepath` / `dirpath`.
2023-03-09 12:11:40 +11:00
46be42f6b1 PyAPI: extend save/load handlers, optionally take a filepath argument
Add a filepath argument to load/save pre/post.
Also add save_post_failed and load_post_failed handlers so it's always
possible to for the pre handlers to run a matching post action.

This makes it possible to know the filepath of the blend file mean
loaded/saved as well as supporting running an action when load/save
operations fail.

When loading and saving the startup-file, the path argument is set to
an empty string.

Details:

New RNA types were added to support storing primitive values in
PointerRNA. Primitive{String/Int/Float/Boolean}RNA. These will likely
only be used in some limited cases, in the case of BKE_callback_exec it
allows strings to be included as part of the PointerRNA **pointers
argument.

Ref !104769.
2023-03-09 12:05:30 +11:00
1cc072b1a7 Cleanup: remove redundant filepath access in WM_OT_save_mainfile 2023-03-09 12:04:37 +11:00
b3625e6bfd Cleanup: comment blocks 2023-03-09 10:39:49 +11:00
56d2298271 Fix #105435: Pause Win32 Auto-Focus During Text Entry
Don't allow the hover of mouse to auto-raise another window while you
are entering data into a text or number input.

Pull Request: blender/blender#105446
2023-03-08 22:20:34 +01:00
60f35207d4 Fix: Hide ".uv_seam" attribute in UI
The attribute, like the other attributes that start with `.` is not
supposed to be displayed in the spreadsheet or the attribute list
by default. This was missing from the commit that added the attribute.
2023-03-08 11:41:36 -05:00
27b9ce6ab6 Mesh: Avoid writing unnecessary attributes
When writing in the legacy mesh format, some attributes don't need to
be written since they're written as flags or legacy struct types.
2023-03-08 11:41:36 -05:00
1354e3108b const_cast no longer needed for ntreeIsRegistered. 2023-03-08 17:38:15 +01:00
7d7190de74 Merge branch 'blender-v3.5-release' 2023-03-08 17:36:59 +01:00
1b398dbad0 Fix build error: ntreeIsRegistered requires non-const pointer. 2023-03-08 17:35:22 +01:00
5876573e14 Mesh: Move face shade smooth flag to a generic attribute
Currently the shade smooth status for mesh faces is stored as part of
`MPoly::flag`. As described in #95967, this moves that information
to a separate boolean attribute. It also flips its status, so the
attribute is now called `sharp_face`, which mirrors the existing
`sharp_edge` attribute. The attribute doesn't need to be allocated
when all faces are smooth. Forward compatibility is kept until
4.0 like the other mesh refactors.

This will reduce memory bandwidth requirements for some operations,
since the array of booleans uses 12 times less memory than `MPoly`.
It also allows faces to be stored more efficiently in the future, since
the flag is now unused. It's also possible to use generic functions to
process the values. For example, finding whether there is a sharp face
is just `sharp_faces.contains(true)`.

The `shade_smooth` attribute is no longer accessible with geometry nodes.
Since there were dedicated accessor nodes for that data, that shouldn't
be a problem. That's difficult to version automatically since the named
attribute nodes could be used in arbitrary combinations.

**Implementation notes:**
- The attribute and array variables in the code use the `sharp_faces`
  term, to be consistent with the user-facing "sharp faces" wording,
  and to avoid requiring many renames when #101689 is implemented.
- Cycles now accesses smooth face status with the generic attribute,
  to avoid overhead.
- Changing the zero-value from "smooth" to "flat" takes some care to
  make sure defaults are the same.
  - Versioning for the edge mode extrude node is particularly complex.
    New nodes are added by versioning to propagate the attribute in its
    old inverted state.
- A lot of access is still done through the `CustomData` API rather
  than the attribute API because of a few functions. That can be
  cleaned up easily in the future.
- In the future we would benefit from a way to store attributes as a
  single value for when all faces are sharp.

Pull Request: blender/blender#104422
2023-03-08 15:36:18 +01:00
10eab0a12c Fix: crash executing geometry nodes on undefined node tree type
Node tree updates can crash if the tree contains a node group that points at an "undefined" tree type.
This can happen if the tree is linked from a library and the path is lost,
or if a custom (python) tree is used and the script is not run.

The fix is to check if the node group type is valid ("registered") and return an empty list otherwise.

Pull Request: blender/blender#105564
2023-03-08 15:31:50 +01:00
2f04f8882f Merge branch 'blender-v3.5-release' into main 2023-03-08 11:17:12 -03:00
bbc6bb3468 Fix #105556: weld modifier crashes when merging N-gons
The logic for counting possible new polygons was incorrect.
2023-03-08 11:16:25 -03:00
b9649c2e72 Eevee: fall back to Diffuse BSDF before proper implementation of Hair BSDFs
Co-authored by @fclem
2023-03-08 15:05:58 +01:00
2282272787 Overlay: Adjustment of the max value of "Edge Width" from 5 to 32.
The first implementation based the max value on what seemed reasonable.
It was therefore limited it to 5.
I received a request from a user in the first already merged #104741
to allow a higher max value.

Thus I adjusted the max value to be the same as the max value used for
"Vertex Size", 32.

Pull Request: blender/blender#105544
2023-03-08 15:01:46 +01:00
6398c9cd7f Cleanup: Remove unused GPU subdivision function declaration 2023-03-08 08:05:36 -05:00
25016b56ef EEVEE Next: Tag shadowmap usage for transparent object volumes
Render the transparent object bounds to a low-res frame-buffer and ray-march the
bounds volume, tagging shadow tiles along the way.

The bounds volume is inflated by half a pixel as a conservative rasterization
alternative, to ensure the tiles needed by all LOD0 pixels get tagged.

The bounds are rendered with front face culling and then the fragment shader
ray-marches against the bounds volume.
Each ray-marching step size equals the world space size of the pixel at the step
depth.
The step bounding sphere radius is also sent to the shadow usage tagging library
to ensure the whole step volume is tagged.

Pull Request: blender/blender#104580
2023-03-08 13:51:24 +01:00
53bb713eda Refactor: Rename OB_GPENCIL and ID_GD
This renames the `OB_GPENCIL` object type and the `ID_GD` to `OB_GPENCIL_LEGACY` and `ID_GD_LEGACY` respectively.
There is no change for the user.

Pull Request: blender/blender#105541
2023-03-08 12:35:58 +01:00
a736f1d638 BLI: Math: Support more vector swizzling and add alignment static assert
Sergey said it was faaaaaaaaaaaaiin.
2023-03-08 11:21:12 +01:00
63a05f1e18 Vulkan: Fix Shader Compilation Issues.
Fixes recent introduced shader compilation issues.
- `sampler` is a reserved keyword in Vulkan GLSL.
2023-03-08 11:10:05 +01:00
b1185da403 Fix #102843: Add UV Packer with O(nlogn) performance
Adds a novel "Alpaca" UV packing strategy for fast packing
of UV island AABBs without rotation.

Pull Request: blender/blender#105393
2023-03-08 20:39:27 +13:00
4fb2c9a407 Cleanup: use system native slashes in PLY, OBJ tests, studiolights
Use native paths to avoid issues comparing paths, see: #103385.
2023-03-08 15:50:02 +11:00
4787384d9d Cleanup: use BKE_area_find_region_type utility function 2023-03-08 15:50:01 +11:00
3a1d5e6032 Cleanup: surround expressions in defines by parenthesis 2023-03-08 15:49:59 +11:00
7896ebec12 Cleanup: make undeclared function static 2023-03-08 15:49:57 +11:00
5c5650f0f8 Cleanup: UV: Rearrange functions in cpp files to improve type safety
No functional changes.
2023-03-08 05:43:15 +01:00
809a336a3d Merge branch 'blender-v3.5-release' 2023-03-07 20:06:05 -05:00
d6d2e98e5e PyAPI Docs: Fix Broken link to source files
With the move to Gitea the URI for line numbers changed from `$1234` to `#L1234`.

The change also removes a superfluous space character from the generated RST syntax.
2023-03-07 20:03:07 -05:00
b228e5b118 Cleanup: run clang-format on a few files 2023-03-07 16:54:18 -08:00
e67c27e172 Merge branch 'blender-v3.5-release' 2023-03-08 01:50:08 +01:00
02fb607520 Fix Freestyle fill range by selection error when there is no active camera
When trying to use the Fill Range by Selection operator, in the
Distance from Camera Freestyle modifier, the operator fails if no
camera is active in the scene.

Before getting the data from the camera, check that it is defined, and
return otherwise.

Pull Request: blender/blender#105475
2023-03-08 01:46:51 +01:00
7fcb262dfd Cleanup: resolve some unreferenced parameter warnings in MSVC
When the warning level is set to 4, some unreferenced parameter
warnings can appear

This commit resolves some of those warnings.
2023-03-07 21:39:44 -03:00
da65b21e2e Sculpt: Add Transform, Trim, and Mesh Filter operators to Sculpt menu
Hello, this is a small PR to check that my understanding of #102427 is correct before moving on to the rest of the issue.
This PR contains the updated UI of the `Sculpt` menu only. Other menus will be submitted for review later.

Currently exposed operators:
* Move
* Rotate
* Scale
* Box Trim (Trim Mode ="Difference")
* Lasso Trim (Trim Mode ="Difference")
* Box Add (Trim Mode ="Join")
* Lasso Add (Trim Mode ="Join")
* Line Project
* Smooth
* Surface Smooth
* ~~Scale (Could be left out?)~~
* Inflate
* Random
* Relax Topology
* Relax Face Set Boundaries
* Sharpen
* Enhance Details
* Erase Displacement

The original issue specifies `Relax Face Set Boundaries` and `Erase Displacement`. I'm not quite sure if this is done in the UI code or somewhere else.

Reviewed By: Joseph Eagar & Julian Kaspar
Pull Request: blender/blender#104718
2023-03-08 01:18:21 +01:00
d46a0f5a1a Cleanup: UV: simplify #uv_parametrizer_construct_end
No functional changes.
2023-03-08 10:29:07 +13:00
d41a1e1806 Cleanup: UV: simplify types
No functional changes.
2023-03-08 10:16:07 +13:00
8faeccf6e5 Fix #105496: Incorrect solidify modifier materials after recent cleanup 2023-03-07 16:11:01 -05:00
a97cae3efc Fix: VSE retiming off by 1 error 2023-03-07 22:10:00 +01:00
cf39e077b3 Cleanup: Remove useless function
`seq_time_strip_original_content_length_get()` was created initially for
purposes of retiming, but it just returns `seq->len`.
2023-03-07 22:10:00 +01:00
894dcfbb41 Cleanup: format 2023-03-08 09:50:03 +13:00
655623ce08 Merge branch 'blender-v3.5-release' 2023-03-07 15:41:15 -05:00
281f383c23 Fix #105430: Curves pick select selects multiple objects
Pick select is only meant to change a single element from a single
data-block. However, the operator worked on each object individually
rather than first finding the closest point, then processing the
selection. Change the operator to find the closest point across all
objects, then deselect if necessary, then select the closest point.

Pull Request: blender/blender#105495
2023-03-07 21:39:46 +01:00
314db1bcab Merge branch 'blender-v3.5-release' 2023-03-07 15:24:29 -05:00
ea80e14464 Fix: Logic error in check for curves selection
The code always assumed the selection array was on the curve domain.
Introduced in 33cbd063d3.
2023-03-07 15:24:20 -05:00
58401a85cd Merge branch 'blender-v3.5-release' 2023-03-07 15:07:01 -05:00
fefb35988c Fix #105518: Crash in edit mode with cage editing
The attributes used for rendering were retrieved from the wrong mesh,
since `mr->me` and `me` weren't the same.
2023-03-07 15:03:50 -05:00
0b05baeaf3 Cycles: oneAPI: fix linking for when icpx compiler is used
When compiling from MSVC environment, libs such as libircmt.lib weren't
found, we need to set the path to these in LIB environment variable.
2023-03-07 21:01:59 +01:00
66eedc542b VSE: Use flag for strips with single frame of content.
Previously `SEQ_transform_single_image_check` function was used to check
if image or effect strip has only one frame of content. Now these strips
are flagged with `SEQ_SINGLE_FRAME_CONTENT`.

While previously this was implicit property of strip, benefit of having
explicit flag is that this property can be decoupled from strip length.
2023-03-07 20:34:24 +01:00
5ab49afe8d Cleanup: Fix warning in skin modifier
Pull Request: blender/blender#105542
2023-03-07 19:33:49 +01:00
78e8c6649d Fix unreliable PLY regression test
At a random the bf_io_ply_tests would fail in one of the fixtures.

The root of the issue was that the exporter parameters were used
uninitialized, causing the mesh to be triangulated in some of the
runs and not be triangulated in other runs.

This change makes it so PLYExportParams is always zero-initialized,
so that this solves this issue, and that adding fields to it in the
future will not re-introduce the issue.

Pull Request: blender/blender#105537
2023-03-07 18:59:02 +01:00
d11874bf21 Merge branch 'blender-v3.5-release' 2023-03-07 18:29:30 +01:00
ec1a76d9cd Fix (unreported) potential invalid usage of Main relations cache.
`library_foreach_ID_link` should only use Main ID relations cache if no
'special' relations flag is set.
2023-03-07 18:25:50 +01:00
d0918c5c7f Assets: Add License and Copyright meta-data
As per #105300, this adds optional "license" and "copyright" meta-data
to assets.

Pull Request: blender/blender#105318
2023-03-07 18:22:43 +01:00
cbf569523c Realtime Compositor: Implement bicubic interpolation
This patch implements the bicubic interpolation option in the transform
nodes. The path merely reuse the code in the shader image texture and
adds bicubic variants to the domain realization shader.

Pull Request: blender/blender#105533
2023-03-07 18:02:20 +01:00
393d5aac59 Ignore build files for VS and VS Code
Git: Add VS/VSCode litter to .gitignore

Neither regular VS nor VS Code can't seem to keep themselves from
littering in the source folders.

This change adds some common litter to .gitignore file to provide some
relief for developers using these editors/IDE's
2023-03-07 17:38:34 +01:00
023524765a Merge branch 'blender-v3.5-release' 2023-03-07 17:35:05 +01:00
68e7004e5e Fix ffmpeg warnings due to missing header include 2023-03-07 17:33:08 +01:00
8f1136e018 Cycles: Use async Metal PSO compilation to avoid std::terminate on exit
When running unit tests or other fast completing renders, forced crashes can occur if there are any slow, outstanding PSO compilation requests (due to the `std::terminate` fall-back case in `~ShaderCache`).

This patch eliminates the need for this shutdown hack by using of the async version of `newComputePipelineStateWithDescriptor` when creating a PSO for the first time. In doing so, we are able to explicitly respond to app shutdown instead of waiting for the pipeline to finish compiling (..and then timing out and force-crashing). We still use the blocking version of `newComputePipelineStateWithDescriptor` when loading from an archive, as this can handle loading from a corrupted archive gracefully. Finally, we move `addComputePipelineFunctionsWithDescriptor` to *after* the PSO is built (as this will trigger a full blocking compile if the PSO has not yet been built, which would bring back the original issue).

Pull Request: blender/blender#105506
2023-03-07 17:08:30 +01:00
5ff959a056 Fix BLI_assert 'attr->comp_len == 2' failed in cage 2d gizmo 2023-03-07 17:07:49 +01:00
48944e7a8e Gizmo: slightly increase cage2d corner margins 2023-03-07 16:29:09 +01:00
275d69467b Gizmo: show hovering regions of cage2d gizmo to indicate constraint axis 2023-03-07 16:29:09 +01:00
d31083583c Fix 105449: Resolve selection in Metal backend
MTLFramebuffer's viewport was not correctly updated when
updating attachments. Behaviour modified to be consistent
with OpenGL.

Authored by Apple: Michael Parkin-White

Ref #96261

Pull Request: blender/blender#105529
2023-03-07 16:00:23 +01:00
7bf20e93d6 Cleanup: silence unused local variable warning
`region` is not used in a `Release` build.
2023-03-07 11:56:42 -03:00
bc5f2c5415 GPencil: Fix compiler warning 2023-03-07 15:26:48 +01:00
a4d2ae12a5 Blenlib: Add ConstListbaseWrapper for iterating const ListBase *
This commit introduces `ConstListBaseWrapper`, to allow easy iteration over
`const ListBase *` in C++ code.

Basically `ListBaseWrapper` was renamed to `ListBaseWrapperTemplate`, and
got a new template parameter `LB`. The new `ListBaseWapper` class has `LB=ListBase`,
whereas `ConstListBaseWrapper` has `LB=const ListBase`.

Also in this commit is one use of `ConstListBaseWrapper` to make sure the
templated code is actually expanded & compiled.

Example use:

```cpp
for (const bDeformGroup *dg : ConstListBaseWrapper<bDeformGroup>(defbase)) {
  ...
}
```

Pull Request: blender/blender#105464
2023-03-07 15:23:59 +01:00
6fbc52bdca Viewport: draw light icons using the light colors
Indicating light colors by coloring the light icons.
Task: #104280
Pull Request: #105236

- Added a checkbox under overlay extra to enable/disable light coloring. Disabled by default.
- The outer ring and the sun rays are colored.
- Only the base color is shown, colors in nodes are not considered.
2023-03-07 15:17:59 +01:00
891eb4938c UI: add parenting (Keep Transform Without Inverse) to menu
Since db6287873c, we added parenting (Keep Transform Without Inverse)
to the parent_set operator and exposed this in the UI in the invoke menu
of that operator.

This however never made it to the `Object` > `Parent` menu.

Since this is quite useful (and otherwise a bit hidden in the Adjust
Last Operation panel) and parent inverse can cause confusion in many
cases (see e.g. #105276 or #103969), now add this as an explicit entry
in the `Object` > `Parent` menu as well.
2023-03-07 15:14:00 +01:00
4aea5df231 Cleanup: Use CPP Wrapper to Clear SSBO in Eevee-next.
Eevee-next motion blur called GPU module directly, but should have
used the CPP wrapper.

Pull Request: #105528
2023-03-07 15:11:38 +01:00
ae47a9b2b8 Fix #93953: Translation double displayed in panel header
After ed870f87b9, panels headers displayed inside panels had their
label duplicated when translations were enabled. This is because a
string comparison was made against the original message, instead of
the translated message.

Pull Request: blender/blender#105151
2023-03-07 14:23:55 +01:00
7f5d1fb05a Merge branch 'blender-v3.5-release' into main 2023-03-07 13:23:43 +01:00
4eb88bca58 Gitea: use full URL for referencing pull requests
For easy clicking in commit logs.

Pull Request: blender/blender#105493
2023-03-07 13:21:51 +01:00
a668e3b73a I18n: do not translate a message already translated using iface_()
This follows #105417, which allowed detection of this message.

Pull Request #105420
2023-03-07 12:32:00 +01:00
ae530592fe I18n: disambiguate messages
- "Lines" in the sense of number of lines
- "Number" can mean "amount, count" or "index, offset"
- "Second" can be an ordinal number or a unit
- "Root": add the brush curve to the "square root falloff" sense
- "Strip" can be a sequence or a type of hair rendering
- "Constant" in the sense of a value, for the Geometry Nodes add
  submenu (#105447).

Additionally, extract:
- "Press a key" from the Keymap preferences.
- "MaskLayer", upon new mask layer creation

Ref #43295, #105447
2023-03-07 12:31:59 +01:00
2a3d945dc5 Armature drawing: prevent crash on unknown draw type
While developing a new armature draw type, I was switching between
branches and opening the same test file. It would crash Blender because
it assumed that the `else` clause could only mean `(arm->drawtype ==
ARM_OCTA)`. This is now explicitly tested for.

The result is that an armature with unknown draw type is not drawn at
all, but I prefer that over either resetting the draw type to something
valid (thus altering the blend file) or downright crashing.
2023-03-07 11:48:26 +01:00
5ed8d3537b Merge branch 'blender-v3.5-release' 2023-03-07 11:34:07 +01:00
e7606139ba Fix #105467: NaN values resulting from curve editing with collision
This was caused by an incorrect assumption in the solver:
It tries to solve both collision and length constraints simultaneously,
using the projected movement of a point as a slide direction along the surface.
This only works if the distance of the previous curve point to the surface
is less than the allowed segment length. Otherwise the segment will
exceed the allowed length even with zero slide and NaN values are computed.

The case of larger surface distance can occur if the previous segment
solve was already stretching the current segment and then the point
moves further away. In this case we can simply clamp the segment length
without violating the contact constraint.

Pull Request #105499
2023-03-07 11:30:07 +01:00
64faa31bb7 Revert "Fix for NaN values resulting from curve editing with collision"
This reverts commit 98b56aadec.

Causes a compile error due to incomplete rename, and should go to release branch.
2023-03-07 11:18:05 +01:00
067fc67bdd Merge branch 'blender-v3.5-release' 2023-03-07 11:06:19 +01:00
98b56aadec Fix for NaN values resulting from curve editing with collision
This was caused by an incorrect assumption in the solver:
It tries to solve both collision and length constraints simultaneously,
using the projected movement of a point as a slide direction along the surface.
This only works if the distance of the previous curve point to the surface
is less than the allowed segment length. Otherwise the segment will
exceed the allowed length even with zero slide and NaN values are computed.

The case of larger surface distance can occur if the previous segment
solve was already stretching the current segment and then the point
moves further away. In this case we can simply clamp the segment length
without violating the contact constraint.

Fixes #105467

Pull Request #105499
2023-03-07 11:05:04 +01:00
38cba7a843 Cleanup: remove old AST code in I18n message extraction
Pre-Python 3.8, the string nodes in an AST were of type ast.Str.
Post, they are of type ast.Constant.

Remove the old naming.

Pull Request #105418
2023-03-07 10:41:57 +01:00
2e5452ee87 I18n: do not extract messages explicitly marked as not translatable
Some UI functions have a "translate" argument, which if set to False
specifies that the message is not to be translated. This sometimes
means that it was already translated beforehands.

But many messages were still getting extracted, sometimes twice in
different contexts. Some featured errors because the arguments of
various functions would be concatenated, such as:

```
col.label(text=iface_("Branch: %s") % bpy.app.build_branch.decode('utf-8', 'replace'), translate=False)
```

which would get extracted as:

```
msgid "Branch: %sutf-8replace"
```

Pull Request #105417
2023-03-07 10:41:18 +01:00
5a004ccc6a Cleanup: use function style casts, nullptr 2023-03-07 15:59:14 +11:00
5b152a4880 Docs: correct doc-string for wmEvent::customdata
Also cross-reference custom-data with GHOST_TEventType.
2023-03-07 15:57:18 +11:00
dbb4c4a687 Cleanup: use gz_prop_type for wmGizmoPropertyType
This is already the convention, missed renaming this case.
2023-03-07 15:18:18 +11:00
0e64d1e652 Docs: add comments to bNodeType init & free callbacks
When investigating ID user-count issues, it wasn't clear how nodes
were meant to handle user-count for ID's. Specifically that the
initfunc should _not_ increment the ID's user count.
2023-03-07 15:13:06 +11:00
90dc655951 Cleanup: spelling in comments 2023-03-07 15:00:05 +11:00
175b1b449e Fix #105433: Offset Tracking Shortcut no longer working
Regression caused by 03f17c42d0

The `TFM_MODAL_TRANSLATE` is used in a special way in the tracking
transformation.
2023-03-06 19:38:46 -03:00
91e191bd21 Transform: split tracking conversion
The conversion of curve tracking points is not integrated into `Tracks`
and `PlaneTracks` so its logic can be separated from the file.
2023-03-06 19:38:35 -03:00
1658de6769 Merge branch 'blender-v3.5-release' 2023-03-06 23:14:18 +01:00
83f28793c0 Fix missing data role in color management fallback
This would show as warning in gtests. Does not affect normal operation as
OpenColorIO should have a valid configuration file for Blender itself.
2023-03-06 23:01:50 +01:00
a3b0a77f50 Cleanup: UV: simplify types
No functional changes.
2023-03-07 10:33:06 +13:00
b309feb71c Cleanup: format 2023-03-07 10:24:05 +13:00
51cd560b47 Fix PLY exporter test writing files to install directory
Doing such writes leaves dangling file in the installation directory which
then is packaged as well. Not only this makes it so a random file gets
packaged for installation, it also makes notarization process to fail because
of not-so-clear reason.

The `ply_exporter_ply_data_test.SuzanneLoadPLYDataUV` fixture seems to be
unreliable and fails at random, even before this change. This makes it
hard to reliably get green light on all tests.

Pull Request #105504
2023-03-06 22:07:14 +01:00
b756915206 Cleanup: Avoid recursion for node parenting
Don't call recursion where it's redundant. The recursive algorithm
can carry dangerous behavior due to stack growth and overflow. The
probability is low for something like the frame nodes. But using a loop
is cheap, providing O(N = const) memory cost. A loop through the links
in a singly linked list is sufficient. The use of 2D vectors for
location mapping and other things can be separate.

Pull Request #105394
2023-03-06 18:39:20 +01:00
a23102528c Fix failing test after own recent commit regarding Main freeing function.
3e5ce23c99 introduced a regression in case the freed Main was part of a
list, and was supposed to be removed from it, since calling
`BLI_remlink` does _not_ clear the `prev`/`next` pointers of the removed
link.

This commit also contains a few more tweaks to recent related b3f42d8e98
commit.

Pull Request #105485
2023-03-06 16:11:35 +01:00
1f2823291a Cleanup: Add warning to ListBase's BLI_remlink regarding not cleared prev/next pointers.
While this behavior can be useful in some cases, it can also create
issues (as in one of own recent commits, 3e5ce23c99), since it
implicetly keeps the removed linknode 'linked' to the listbase.

At least warn about it in the documentation of `BLI_remlink`.
2023-03-06 16:08:45 +01:00
08bd6deb57 Fix #99836: Blender SEGV when open .blend file in blender.
Use recent 'abort file reading' mechanism to simply not try to load such
purposedly broken .blend files at all.
2023-03-06 16:08:45 +01:00
f49a995b2c Add a mechanism to abort a blend file reading on critical error.
This commit introduces a new Main boolean flag that marks is as invalid.

Higher-level file reading code does checks on this flag to abort reading
process if needed.

This is an implementation of the #105083 design task.

Given the extense of the change, I do not think this should be
considered for 3.5 and previous LTS releases.
2023-03-06 16:08:45 +01:00
f1df811899 Fix (unreported) potential leak in Main freeing function.
Could happen in case a 'split-by-libraries' Main is passed to
`BKE_main_free`.
2023-03-06 16:08:45 +01:00
c26566ad27 Drivers: Introduce the Context Properties
Drivers: Introduce the Context Properties

The goal: allow accessing context dependent data, such as active scene camera
without linking to a specific scene data-block. This is useful in cases when,
for example, geometry node setup needs to be aware of the camera position.

A possible work-around without changes like this is to have some scene
evaluation hook which will update driver variables for the currently evaluating
scene. But this raises an issue of linking: it is undesirable that the asset
scene is linked to the shot file.
Surely, it is possible to have post-evaluation handler to clear the variables,
but it all starts to be quite messy. Not to mention possible threading
conflicts.

Another possibility of introducing a way to achieve the goal is to make it so
the dependency graph somehow parses the python expression where artists can
(and already are trying to) type something like:

  depsgraph.scene.camera.matrix_world.col[3][0]

But this is not only tricky to implement properly and reliably, it hits two
limitations:

- Currently dependency graph can only easily resolve dependencies to a RNA
  property.

- Some properties access which are valid in Python are not considered valid
  RNA properties by the existing property resolution functions:

  `camera.matrix_world[3][0]` is a valid RNA property, but
  `camera.matrix_world.col[3][0]` is not.

Using driver variables allows to have visual feedback when the path resolution
fails, and there is no way to visualize errors in the python expression itself.

This change introduces the new variable type: Context Property. Using this
variable type makes allows to choose between Active Scene and Active View
Layer. These scene and view layer are resolved during the driver evaluation
time, based on the current dependency graph.

This allows to create a driver variable in the following configuration:

- Type: Context Property
- Context Property: Active Scene
- Path: camera.matrix_world[3][0]

The naming is a bit confusing. Tried my best to keep it clear keeping two
aspects in mind: using UI naming when possible, and follow the existing
naming.

A lot of the changes are related on making it so the required data is available
from the variable evaluation functions. It wasn't really clear what the data
would be, and the scope of the changes, so it is done together with the
functional changes.

It seems that there is some variable evaluation logic duplicated in the
`bpy_rna_driver.c`. This change does not change it. It is not really clear why
this separate code path with much more limited scope of supported target types
is even needed.

There is also a possible change in the behavior of the dependency graph: it
is now using ID of the resolved path when building driver variables. It used
to use the variable ID. In common cases they match, but when going into nested
data-blocks it is actually correct to use relation to the resolved ID. Not sure
if there was some code to ensure that, which now can be resolved. Also not sure
whether it is still needed to ensure the ID specified in the driver target is
build as well. Intuitively it is not needed.

Pull Request #105132
2023-03-06 16:01:47 +01:00
4fb6e45b37 Curves: change default font offset from 1.0 to 0.0
Currently, curves have a default offset of 1.0, while the initial (and
expected) value is 0.0. When resetting this value to its default, the
curve is now modified unexpectedly. This is most noticeable with text
objects: when resetting the offset of a new text, it will look very
broken.

Internally the value is stored with an offset of 1.0, with custom
setter and getter adding and subtracting 1.0 respectively. To give
this property a default of 0.0, we also need to add 1.0 to the initial
value upon curve creation.

Pull Request #105182
2023-03-06 14:28:40 +01:00
4dc59c7311 I18n: add per-socket translation contexts for nodes
In order to properly translate UI messages, they sometimes need to be
disambiguated using translation contexts. Until now, node sockets had
no way to specify contexts and collisions occurred.

This commit adds a way to declare contexts for each socket using:
`.translation_context()`

If no context is specified, the default null context is used.

Pull Request #105195
2023-03-06 14:24:36 +01:00
214b24e025 Cleanup: Fix incorrectly formatted multi-line docstring
This has the effect that the message is cut off at the end of the
first line. I copied the solution from other similar docstrings
elsewhere in the code.

As far as my regex-fu can tell, there are no other occurrences of this
in the codebase.

Issue reported by Joan Pujolar in #43295.

Pull Request #105474
2023-03-06 14:09:44 +01:00
61b457d390 Vulkan: Push constants
**What are push constants?**

Push constants is a way to quickly provide a small amount of uniform data to shaders.
It should be much quicker than UBOs but a huge limitation is the size of data - spec
requires 128 bytes to be available for a push constant range.

**What are the challenges with push constants?**

The challenge with push constants is that the limited available size. According to
the Vulkan spec each platform should at least have 128 bytes reserved for push
constants. Current Mesa/AMD drivers supports 256 bytes, but Mesa/Intel is only 128
bytes.

**What is our solution?**

Some shaders of Blender uses more than these boundaries. When more data is needed
push constants will not be used, but the shader will be patched to use an uniform
buffer instead. This mechanism will be part of the Vulkan backend and shader
developers should not see any difference on API level.

**Known limitations**

Current state of the vulkan backend does not track resources that are in the
command queue. This patch includes some test cases that identified this issue as
well. See #104771.

Pull Request #104880
2023-03-06 12:28:55 +01:00
08db6bf215 IO: factor out axis validation logic between OBJ and PLY
The up_axis_update/forward_axis_update was the same logic between
the two, so factor that out.

Also use the same time reporting logic in PLY as in OBJ/USD/Alembic.
2023-03-06 10:22:01 +02:00
62c4dce83b Merge remote-tracking branch 'upstream/blender-v3.5-release' 2023-03-06 09:18:42 +01:00
c3fdb02b91 Updated translations from SVN trunk (r6369). 2023-03-06 09:17:14 +01:00
4e32864786 Cleanup: Remove compilation warning.
In MTLTexture it was checked that this was valid. What in that
case should always be true.
2023-03-06 08:40:30 +01:00
5a20c63975 Fix #104534: Image editor doesn't refresh after render.render.
When render is triggered from python and the render result is displayed
it isn't being updated as it wasn't tagged as being invalid.

Pull Request #105480
2023-03-06 08:38:53 +01:00
3674de160d Fix #105395: Handle quoted paths better in the OBJ importer
If the texture image path in the MTL is a "quoted" absolute path, the importer will fail to find the
file. It was only attempting to un-quote the path for the relative case. Now we attempt to un-quote
in all cases.

Pull Request #105478
2023-03-05 21:32:24 -08:00
049027d697 Cleanup: Fix a few messages in the UI
Issues reported by Joan Pujolar in #43295.

- uv -> UV everywhere.
- Wrong plurals.

Pull Request #105473
2023-03-05 21:32:23 -08:00
68d5784802 Fix #105395: Handle quoted paths better in the OBJ importer
If the texture image path in the MTL is a "quoted" absolute path, the importer will fail to find the
file. It was only attempting to un-quote the path for the relative case. Now we attempt to un-quote
in all cases.

Pull Request #105478
2023-03-06 06:29:40 +01:00
507c442289 Cleanup: UV: simplify types
No functional changes.
2023-03-06 17:27:45 +13:00
96263368b5 Cleanup: Unused variables, missing includes in PLY IO 2023-03-05 22:31:43 -05:00
3c5a15db57 Cleanup: Small tweaks to new PLY code
- Add missing braces for if statements
- Tweak variable naming to use snake case
- Use more common name for `MLoop`s of a face
- Use `std::move` when appending an array
- Use const for a few variable declarations
2023-03-05 22:12:26 -05:00
9eee008691 Fix Cycles oneAPI build error due to conflicting CONSTANT define 2023-03-06 00:13:21 +01:00
7d5754b8b6 Cycles: Reuse random variable for principled hair BSDF sampling
This lets us skip the hash and use a proper stratified variable instead.
Suggested by Christophe Hery.
2023-03-06 00:09:04 +01:00
f3c5fda899 Cleanup: Fix a few messages in the UI
Issues reported by Joan Pujolar in #43295.

- uv -> UV everywhere.
- Wrong plurals.

Pull Request #105473
2023-03-05 23:16:26 +01:00
71c366f5cc PLY: fixing tests 2023-03-05 21:50:25 +02:00
ca4486bfa1 Cleanup: format 2023-03-05 19:53:40 +01:00
9139983f94 Cycles: Implement MaterialX OSL microfacet closures
This commit implements three OSL microfacet closures that are needed to support
MaterialX: dielectric_bsdf, conductor_bsdf and generalized_schlick_bsdf.

Internally these map to existing microfacet closures, only the Fresnel term is
different.
2023-03-05 19:52:07 +01:00
014f6e4309 Cycles: Make Fresnel term independent of microfacet closure type
Currently, we use the closure type to encode the type of microfacet distribution
(GGX/Beckmann/Sharp/MultiGGX), the lobes we're interested in
(Reflection/Refraction/both) AND the Fresnel type (None or Principled v1).

This results in the mess of dozens of options that we currently have. Since
adding Principled v2 and the MaterialX OSL closures will involve adding more
Fresnel types, this clearly doesn't scale.

But, since the earlier Fresnel rework (D17101), the Fresnel type only matters
in one place now. This allows to significantly clean up the closure type
handling. To do this, MicrofacetBsdfs now separately store their Fresnel type,
and instead of a single MicrofacetExtra we have one struct per Fresnel type
(unless no extra data is needed).

Further, instead of having one _setup() function per combination, the Fresnel
setup is also split into separate functions. This decouples the implementation
of new Fresnel terms from most of the Microfacet logic, and makes it a very
simple and clean operation.
2023-03-05 19:52:07 +01:00
5f9b518a8b Cycles: Use per-microfacet Fresnel term for Glass closures
This commit replaces the current Glass approach, where Glass is a virtual closure
that gets replaced with a Glossy and a Refractive closure, with a combined
closure that handles Fresnel after sampling the microfacet. That way, the Fresnel
term is more accurate since it accounts for the microfacet normal, not the
shading normal.

Also updates the BSDF sampling to use a 3D sampler now, since we need two
dimensions to pick the microfacet normal and then a third dimension to pick
reflection/refraction. This can also be used to get rid of the LCG in the
Principled Hair BSDF, which means we can remove it altogether once MultiGGX is
gone.

Also, "sharp" is now supported as a microfacet distribution in OSL, and 2
is supported as the "refract" argument to microfacet() in order to get glass.
2023-03-05 19:52:07 +01:00
a30abe9c2e IO: minor tweaks to the new C++ PLY importer/exporter
Address some issues discussed in PR #104404:
- Vertex color options changed to None/sRGB/Linear, default is sRGB
  to match the existing Python addon.
- Change name to "Stanford PLY" from "PLY" in the menu item.
- Default "Export UVs" to on.
- After importing vertex colors, they are set as enabled for render.
2023-03-05 20:44:53 +02:00
Nathan Rozendaal
43e9c90061 IO: New C++ PLY importer/exporter
New (experimental) Stanford PLY importer and exporter written in C++.

Handles: vertices, faces, edges, vertex colors, normals, UVs. Both
binary and ASCII formats are supported.

Usually 10-20x faster than the existing Python based PLY
importer/exporter.

Additional notes compared to the previous Python addon:
- Importing point clouds with vertex colors now works
- Importing PLY files with non standard line endings
- Exporting multiple objects (previous exporter didn't take the vertex
  indices into account)
- The importer has the option to merge vertices
- The exporter supports exporting loose edges and vertices along with
  UV map data

This is squashed commit of PR #104404
Reviewed By: Hans Goudey, Aras Pranckevicius

Co-authored-by: Arjan van Diest
Co-authored-by: Lilith Houtjes
Co-authored-by: Bas Hendriks
Co-authored-by: Thomas Feijen
Co-authored-by: Yoran Huzen
2023-03-05 20:44:53 +02:00
b4d36b3efe GPU: Compute: Document and cleanup header
No fonctional changes.
2023-03-05 18:14:17 +01:00
4862d56a0e GPUFrameBuffer: Document and cleanup header
No fonctional changes.
2023-03-05 17:57:51 +01:00
d782569682 Cleanup: GPU: Improve eGPUBarrier documentation 2023-03-05 17:57:51 +01:00
0a10571501 GPU: Replace GPU_finish by correct memory barrier 2023-03-05 17:57:51 +01:00
1b815678aa msgfmt: fix runtime requirements
msgfmt has a TBB dependency though bf_blenlib, now for a release build
The MSVC linker is smart enough to realize none of the TBB code is
actually used and discards it. In debug mode the linker is a bit more
conservative and doesn't, leaving msgfmt with a runtime dependency
on TBB. The problem here is, we only copy the runtime dlls during
the install phase, and msgfmt runs long long before that.

For this reason when we run msgfmt we should make sure any runtime
needs it could have are met in the path, there already is a handy
variable for that since oslc has similar requirements.

Pull Request #105048
2023-03-04 17:39:49 -07:00
38407b319a CMake/Win32: Install boost dlls during install phase
During install all dlls should copy to the blender.shared
folder regardless if the dependency is on or off, creators
CmakeLists.txt already did this correctly, but for boost
the BOOST_POSTFIX and BOOST_DEBUG_POSTFIX variables were
not set causing the boost dll's not to be copied.

This change takes the setting of these variables out of the
WITH_BOOST block, but still guards it with a
WITH_WINDOWS_FIND_MODULES block so we don't break the build
for people building with that on.
2023-03-04 14:07:17 -07:00
adacf5a706 Merge branch 'blender-v3.5-release' 2023-03-04 04:12:20 -08:00
5a4872bd4e Fix #105341 Hard freeze in scene space stroke code
Note: the entire paint stroke code needs to be rewritten to
work properly in world space.  At least it now freezes in
one less edge case.
2023-03-04 04:08:18 -08:00
4b0f5c2aad Fix build error introduced in previous commit.
Fix build error introduced in 57742c7868 due to int/float conversion.
2023-03-04 08:04:35 +01:00
f5e9a78216 GPU: Fix wrong barrier in tests
Texture and buffer reads were using the incorrect barrier.
2023-03-04 07:44:34 +01:00
fcedc97d11 GPU: Add GPU_BARRIER_BUFFER_UPDATE barrier type
This barrier types is needed for correct readback of buffers GPU memory
to CPU memory.
2023-03-04 07:44:34 +01:00
57742c7868 Fix: Wrong text clipping in the frame node
When drawing text with multiple lines inside a frame node, depending
on the zoom level some lines would wrongly get clipped despite being
inside the clipping region.

This was caused by the clipping check in `blf_glyph_draw` not accounting
for the font’s aspect.

Pull Request #105389
2023-03-04 07:12:14 +01:00
e22eb23bc2 Cleanup: match header/source arguments & quiet cppheck warnings 2023-03-04 15:19:00 +11:00
7cb3a79246 Cleanup: remove unused arguments 2023-03-04 15:10:39 +11:00
d0cfbc23db Merge branch 'blender-v3.5-release' 2023-03-03 15:37:11 -08:00
c02feb6773 Fix failing VSE test
Caused by b4100ed377. Image strips with only 1 frame of content do
expect any timeline frame to be translated into frame index of 0.

Check this case and return 0 explicitly.
2023-03-03 23:56:12 +01:00
89c3ead7c6 Fix #105388: Default Font Accidentally Kerning
Move the code that disables kerning for the default font so it can't be
re-enabled by the cache subsystem.

Pull Request #105415
2023-03-03 23:17:20 +01:00
6749593aec Fix mistake in previous commit
Fix error in b4100ed377

`seq_retiming_evaluate()` returns range from 0 to 1, to which framerate
correction was applied. this is incorrect, and correction should be
applied to function input.
2023-03-03 23:03:59 +01:00
c066035907 Cleanup: Deduplicate node parent checking functions
Unify both functions in one, with a more telling name,
to be sure of the order of the arguments. Some functional
cleanup of the using code to make it more explicit.

Pull Request #105413
2023-03-03 22:38:49 +01:00
b4100ed377 Fix VSE clamping strip content length incorrectly
When movie framerate does not match scene, content length was clamped to strip
length in scen framerate. This also caused issues with retiming which behaved in
similar way. Retiming was modified to use frame index of strip content, so even
when scene framerate is changed, retiming data is preserved in correct
proportions. This means, that handles are mapped to time in seconds rather than
to frames.
2023-03-03 22:32:37 +01:00
a95eaf0ec1 Build: Make OpenImageIO a required dependency
During the discussion for #101413 there was consensus that we could make
OIIO a mandatory dependency. This patch does just that.

The `idiff` testing tool remains optional.

Pull Request #105111
2023-03-03 21:53:34 +01:00
d0eeb3d155 Cleanup: Remove mesh normals function, deprecate in RNA
Since normals are calculated when they are accessed if necessary, this
was a no-op. Related to cfa53e0fbe and 6a3c3c77b3.
2023-03-03 15:18:29 -05:00
0d080d1a07 Fix: Build with FFmpeg 6.0
Pull Request #105377
2023-03-03 18:42:35 +01:00
915ff8d152 Cleanup: Use references for mesh poly variables
Similar to the previous commit, this simplifies future refactoring
to change the way edges are stored, and further differentiates
single poly variables from array pointers.
2023-03-03 11:40:43 -05:00
45cff837bc Cleanup: Use simpler iterator for mesh polygons
Avoid incrementing a pointer, use only indices as a source of truth.
This should ease refactors to change the way polys are stored.
2023-03-03 11:40:43 -05:00
e1a0c09f06 Merge branch 'blender-v3.5-release' 2023-03-03 16:55:20 +01:00
e7ba8247de Merge branch 'blender-v3.5-releas' into main 2023-03-03 16:45:45 +01:00
513d31360f Fix #105329: Keyframe handles staying in place when using slider operators
The issue was that when using the `HD_ALIGNED` handle type,
Blender would not automatically move the keyframe handles with the key.
Instead one handle would get stuck in place.
To remedy that manually move the keyframe handles in case the type is `HD_ALIGNED`
This makes it consistent with moving a key with G

Pull Request #105401
2023-03-03 16:41:14 +01:00
549cc568b0 Fix various issues with modifiers and edge display in edit mode
Consistently use edge draw flag instead of original index to determine if an
edge should be drawn or not.

In GPU subdivision the edge original index was used for both edge optimal
display and selection mapping to coarse edges, but they are not the same.
Now match the CPU subdivision logic and use a separate edge draw flag VBO.

For cage display, match Blender 3.3 behavior more in showing/hiding of edges
in wireframe mode. That is edges without a mapping to an original edge are
always hidden when there is no distinct cage, and drawn otherwise. This is
not ideal for e.g. the bevel modifier where it will always show some edges on
corners despite all edges being hidden by the user. But we currently have
no good information to decide if these should be hidden or not, so err on
the side of showing too much as it did before.

Fie #103706: bevel modifier edges not drawn correctly
Fix #103700: optimal display can't be turned of with GPU subdivision
Fix wrong edge display with GPU subdivision preceded by other modifiers

Pull Request #105384
2023-03-03 16:38:27 +01:00
05b141e67f Merge remote-tracking branch 'upstream/blender-v3.5-release' 2023-03-03 15:27:07 +01:00
d66672e17a WM: Fix invalid memory access in wmTimer handling code.
Timer management code often loops over the list of timers, calling
independant callbacks that end up freeing other timers in the list. That
would result in potentail access-after-free errors, as reported in #105160.

The typical identified scenario is wmTimer calling wmJob code, which
calls some of the job's callbacks (`update` or `end` e.g.), which call
`WM_report`, which removes and add another timer.

To address this issue on a general level, the deletion of timers is now
deferred, with the public API `WM_event_remove_timer` only marking the
timer for deletion, and the private new function
`wm_window_delete_removed_timers` effectively removing and deleting all
marked timers.

This implements design task #105369.

Pull Request #105380
2023-03-03 15:24:26 +01:00
e0732b640a Fix: Build with FFmpeg 6.0
Pull Request #105377
2023-03-03 13:51:45 +01:00
a2d988b5da Cleanup: function style casts for C++, use nullptr 2023-03-03 23:28:18 +11:00
a2cc7e1511 Merge branch 'blender-v3.5-release' 2023-03-03 23:16:32 +11:00
24f3cb9b5c Fix #105381: Alt-Tab causes Alt to stick with multiple monitors on WIN32
Window activation events on Windows-10 don't seem to be reliable as it's
possible for Alt-Tab to trigger WM_ACTIVATE on a window when switching
away from it. As detecting the keys which are held relies on a valid
active state - this meant Alt could become stuck when using Alt-Tab
to switch between windows.

Disable reading modifiers on activation for WIN32, activating the window
now clears modifiers on WIN32. This isn't ideal as held modifiers wont
be detected, re-introducing the error reported in #40059.
2023-03-03 23:12:28 +11:00
5bb3dc84c1 Merge branch 'blender-v3.5-release' 2023-03-03 12:31:25 +01:00
d3cbfc96e0 Metal: Ensure explicit UBO bind indices
Previously, UBO bind locations were linearly incremented and
relied on  the correct uniform location being queried. This fix
is a future requirement for EEVEE next, however, pulling forward
due to Issue #105280 highlighting a possible flaw with expected
uniform locations.

Authored by Apple: Michael Parkin-White

Ref #96261
Pull Request #105311
2023-03-03 12:03:43 +01:00
06cf84f77f EEVEE: Resolve artifacts in EEVEE with Intel GPUs on macOS.
Intel GPUs exhibit a number of rendering artifacts.
The most substantial being incorrect resolve of reflections.
Splitting the reflections_resolve shader into two passes,
one for SSR and one for light probes ensures correct rendering
and optimal performance on this GPU.

Also resolves an artifact with ambient occlusion wherein
the pow(a, b) function causes excessive precision loss.
Using an alternative method for power calculation on these
platforms resolves the issues.

Authored by Apple: Michael Parkin-White

Ref T96261
Pull Request #105240
2023-03-03 11:53:15 +01:00
9801f7def8 Fix #105280: DRW: Allow UBO bindpoint of 0 for clipping data.
The check was testing against 0 instead of -1
(invalid location).

Authored by Apple: Michael Parkin-White

Ref #96261
Pull Request #105310
2023-03-03 11:24:31 +01:00
7ebe721557 Refactor: Move motion tracking related files to C++
A bulk change, to make things moving as quickly as possible, instead of
doing per-modified-file basis.

This is pretty much direct translation of C code to C++, is not really
"proper" C++ usage. That could happen on a more case-by-cases basis.

Pull Request #105376
2023-03-03 11:09:33 +01:00
48aac51c35 Fix: EEVEE: Lightcache texture usage flags
Metal backed requires HOST_READ texture usage flag
for irradiance grid. This was correctly in place for the
basic grid, but not for grid_prev.

Authored by Apple: Michael Parkin-White

Ref #96261
Pull Request #105312
2023-03-03 11:02:37 +01:00
7e5cb36e0c Metal: Fix erroneous outvar replacements.
Resolves issue with node_holdout perfomring an outvar
replacement on a function, causing shader compilation
failure.

Ref #96261
Pull Request #105396
2023-03-03 11:01:36 +01:00
aa82afaaf7 Cleanup: regenerate the default theme file
Re-run ./tools/utils/blender_theme_as_c.py
2023-03-03 16:32:38 +11:00
f0257aa71b Cleanup: use camel-case for struct name, wrap function arguments 2023-03-03 16:29:43 +11:00
2eaa55272d Cleanup: use function style casts, nullptr in C++ 2023-03-03 16:29:36 +11:00
b4eef99973 Cleanup: use C-style code comments, format 2023-03-03 16:29:22 +11:00
37c0b0b2b8 Cleanup: format 2023-03-03 13:42:21 +13:00
dcad51dfc3 DRW: Retopology Overlay
Add overlay option for retopology, which hides the shaded mesh akin to Hidden Wire, and offsets the edit mesh overlay towards the view.

Related Task #70267
Pull Request #104599
2023-03-03 00:35:45 +01:00
55ea58ff5b BLI_string: correct size for BLI_str_format_int_grouped, update tests
Ensure the defines match the longest strings in tests.
2023-03-03 10:25:47 +11:00
05324e2e3c Cleanup: spelling in comments 2023-03-03 10:09:20 +11:00
99e90615d7 Cleanup: compiler warnings 2023-03-03 09:53:23 +11:00
d130f81a22 Cleanup: Use const arguments in node.cc
Cleanup, try to always use const.
Many function signatures still have incorrect argument order
(constants, mutables). But this is a larger other cleanup.

Pull Request #104937
2023-03-02 23:14:59 +01:00
118ec54ec7 Cleanup: Move five mesh related files to C++
To faciliate further mesh data structure refactoring. See #103343.

Pull Request #105354
2023-03-02 23:14:33 +01:00
15375b0845 Docs: improve comments in linux_rocky8_setup.sh 2023-03-02 21:30:22 +01:00
2a9f792c9e Draw Next: Fix shader orco computation 2023-03-02 17:57:30 +01:00
8c29d84139 BLI: Prevent Overflow in Grouped Number Output
Increase the buffer sizes used for `BLI_str_format_uint64_grouped` to
prevent overflow on strings representing numbers within the uint64
range. Also creates and uses defines for all the formatted string
buffer sizes.

Pull Request #105263
2023-03-02 17:38:36 +01:00
ff6ce25926 Add a basic support to BKE library linking code to generate liboverrides.
This commit adds the ability to generate liboverrides of linked data at
the `BKE_blendfile_link_append` BKE level, and through the Python API
(the `BPY_library_load` context manager, aka `bpy.data.libraries.load`).

The python API was updated essentially to allow easy testing of the new
code. This commit also adds tests for the new 'override' behavior, and
for existing basic link one.

Current code only generates 'basic' overrides, without any handing of
hierarchies or dependencies, as for brush assets only the Brush ID needs
to be overridden.

That new feature does not aim at being exposed to user through the
link/append operations in its current state, as it is way too simplistic.

This change is a requirement for the Brush Asset project (#101908).

Pull Request #104746
2023-03-02 17:22:42 +01:00
f5c56b4cd6 Animation: Remove the 'Weight Paint: Fix Deforms' operator
The code of the 'Fix Deforms' operator was hard to read and inefficient, doing `O(num_vertices * num_vertex_groups)` evaluations of the mesh. It caused multiple issues and got in the way of improvements to Blender, and seems to be used very little (if ever).

It was decided in [last week's module meeting](https://devtalk.blender.org/t/2023-02-23-animation-rigging-meeting/27757#patch-review-decision-time-5) that this operator should be removed.

Pull Request #105237
2023-03-02 16:58:14 +01:00
00ca7c5221 Fix #105109: Pick selection with multi object edit
Pick selection for the Curves object was not considering multi
object editing. Only the active object was considered.

This fix introduces pick selection for Curves for multi object editing.

Pull Request #105184
2023-03-02 15:43:15 +01:00
1d3a2fb5bb Merge branch 'blender-v3.5-release' 2023-03-02 15:15:11 +01:00
422f3d0b0f Fix #105278: IDProperty UI missing library overridable toggle
The toggle (for anything but float and int types) was swallowed in
bf948b2cef. Also seems ef68a37e5d discarded
`property_overridable_library_set` for bools.

Now treat the overridable toggle as a general property for all property
types.

Pull Request #105370
2023-03-02 15:13:52 +01:00
fa044c453f Cleanup: Unused fields and API for tracks map
The map is used to, well, map localized copy of the tracks used by the
tracing thread to the original tracks in the movie clip. There seems to
be some accumulated stuff in there which is no longer used by the current
state of code.

There should be no functional changes.

Pull Request #105374
2023-03-02 15:09:50 +01:00
81b56f8bbc Cleanup: Refactor BKE_nlatrack_add to multiple methods to handle adding a new NLA track to the track list. Insert before, after, head, and tail
This PR removes the BKE_nlatrack_add, and adds new:

* BKE_nlatrack_insert_before
* BKE_nlatrack_insert_after
* BKE_nlatrack_new_before_and_set_active
* BKE_nlatrack_new_after_and_set_active
* BKE_nlatrack_new_head_and_set_active
* BKE_nlatrack_new_tail_and_set_active

methods to easily add new NLA tracks in relation to the existing track list.

Pull Request #104929
2023-03-02 15:02:30 +01:00
12854fdfd6 Fix: Frame Channels fails when no keys in range
Under the following circumstances
* keys on 1, 3 and 5
* preview range set to 10-20

The frame channel operator would zoom into nothingness.
because no keys were found in the preview range.
(Only the `ANIM_OT_channel_view_pick` operator though)
This PR fixes it and notifies the user with a warning.

Pull Request #105179
2023-03-02 13:04:57 +01:00
f97542e5a2 Merge branch 'blender-v3.5-release' 2023-03-02 11:04:17 +01:00
9e5275791f Fix #105343: id.make_local() doesn't work for overridden data.
RNA `make_local` call isfairly low-level and by-passes
`BKE_library_make_local`, so it also needs to handle the liboverride
case itself.
2023-03-02 11:02:16 +01:00
4de2cf4136 Merge branch 'blender-v3.5-release' 2023-03-02 09:53:58 +01:00
2eeec49640 Fix #105339: grease pencil selection can toggle object selection
Grease Pencil (when not in object mode) implements its own selection
opertor. This operator (`gpencil.select`) returns
`OPERATOR_PASS_THROUGH`, then falls though to `view3d.select` which can
toggle object selection (when using shift-click picking).

Removing `OPERATOR_PASS_THROUGH` would fix the object toggling, but this
was added in 62c73db734 with good reason (the tweak tool would not
work then).

Now prevent `view3d.select` from acting on Grease Pencil (when not in
object mode).

NOTE: longer term we could have grease pencil use view3d.select to avoid having to add these awkward exceptions

Pull Request #105342
2023-03-02 09:52:35 +01:00
b02b2589e2 Merge branch 'blender-v3.5-release' 2023-03-02 16:37:59 +11:00
bb77d6934c Merge branch 'blender-v3.5-release' 2023-03-02 16:37:55 +11:00
944a6e78f5 Fix #105277: Alt key suck after Alt-Tab on Windows 11
Windows 11 has strange behavior with Alt-Tab.
In some cases an Alt-Press event is sent to the window immediately
after it is de-activated (both Left & Right Alt keys for some reason
even when only one is held).

This meant that:

- Modifiers could be enabled for de-activated windows
  (so we can't assume de-activated windows have modifiers released).

- Releasing the modifier key would not be sent to the inactive window
  causing the modifier key to be stuck.

- Button events over an inactive window are generated before activation,
  so even though activation reads the correct modifier state,
  the button event uses the "stuck" modifier state.

Now button & drop events on inactive windows always read the modifier
state first instead of relying on the modifier state to be cleared.

This has some advantages:

- If modifiers are held, they will be used as part of the click action.

- While modifier keys on inactive windows should be rare,
  in the case this does happen - stuck keys are avoided.
  So it makes sense to apply these changes for all platforms.
2023-03-02 16:35:46 +11:00
b43f520a82 Cleanup: Move UV parameterizer to blender::geometry namespace
The current API makes more sense as part of a class, but for now, keep
consistency with the other geometry module headers and move the code
to the proper namespace, removing the `GEO_` prefix which is only meant
for C code.

Pull Request #105357
2023-03-02 06:10:26 +01:00
2d6921198a Cleanup: Remove unnecessary struct and using keywords in C++ 2023-03-02 06:10:25 +01:00
aea53c771d Cleanup: Move UV parameterizer header to C++
See #103343
2023-03-02 06:10:25 +01:00
b61807ebcf Cleanup: split logic for updating event modifiers into functions
Also remove USE_WIN_ACTIVATE & USE_WIN_DEACTIVATE defines as they
were only added when changes to modifier handling failed on WIN32.

This logic has now been tested to work on all platforms.
2023-03-02 16:08:14 +11:00
8cae7a0dcc Cleanup: remove/comment unused defines 2023-03-02 15:05:52 +11:00
ae086deaa5 Docs: note that "Effect" and related types are deprecated
Also use comments to identify "Effect" members which must be used
by all structs.
2023-03-02 15:05:52 +11:00
93508ab2df Cleanup: Make mesh validation functions static
These functions used internal values and only really make sense in
the context of the mesh validation process where they're used to remove
invalid elements from the mesh.
2023-03-01 22:30:47 -05:00
fcaf12f07a Cleanup: format 2023-03-02 16:23:17 +13:00
52d20c6a0e Fix #105331: Assert in solidify extrude after recent cleanup
Use indices instead of pointers to avoid accessing elements beyond
the end of the result mesh arrays.
2023-03-01 22:21:08 -05:00
6b8cdd5979 Fix #103469: Update UV Sphere Projection with Seam support.
Note: Applies to both UV Sphere Projection and UV Cylinder Projection.

Adds a new boolean option "Preserve Seams" to UV Sphere Projection.

With "Preserve Seams" active, the Sphere projection will do a
greedy flood fill over the 3D topology, stopping at 3D boundaries
and also stopping at edges where "Mark Seam" has been used in the
3D Viewport.

During the flood fill, each face is mapped using the spherical
projection and then adjusted along the U axis so the UV map is
continuous across the shared edge.

With careful seam placement, this allows for the creation of a
spiral-cut-orange-peel unwrap, where a sphere can be unwrapped
into a single long continuous strip, wrapping multiple times around
the object.

Finally, if the flood fill process creates multiple UV Islands,
they are spaced along the `U` axis to prevent overlaps.

Pull Request #104847
2023-03-02 00:48:34 +01:00
7de2f21001 Fix: Debug build error after recent variable rename cleanup
Also adjust some comment formatting as penance.
2023-03-01 18:08:41 -05:00
3022a805ca Cleanup: Standardize mesh edge and poly naming
With the goal of clearly differentiating between arrays and single
elements, improving consistency across Blender, and using wording
that's easier to read and say, change variable names for Mesh edges
and polygons/faces.

Common renames are the following, with some extra prefixes, etc.
 - `mpoly` -> `polys`
 - `mpoly`/`mp`/`p` -> `poly`
 - `medge` -> `edges`
 - `med`/`ed`/`e` -> `edge`

`MLoop` variables aren't affected because they will be replaced
when they're split up into to arrays in #104424.
2023-03-01 15:58:01 -05:00
0f61497e20 Cleanup: Use spans for mesh render data
This offers overflow checking in debug builds, avoids implicit
conversion to pointers, slicing features for future convenience,
and clarifies ownership. Also switch naming to plural like most
other arrays for further clarification.
2023-03-01 15:58:01 -05:00
f1f47df56b Cleanup: Remove unused variable 2023-03-01 15:58:01 -05:00
2324eb4f8c Fix: Use of uninitialized variable after recent cleanup 2023-03-01 15:58:01 -05:00
d939ecc46f Cleanup: Access mesh data with spans
Similar to cb62ab5b28, in newly C++ files.
2023-03-01 15:58:01 -05:00
7ca63d40dc Revert #105225: WM Check for lack of active window
This check is no longer needed as Campbell has removed the need to
pass around the active window.  This check could potential be error-
hiding so best removed if not needed.

Pull Request #105351
2023-03-01 21:44:41 +01:00
59b9bb0849 Draw: Custom IDs
This pull request adds a new tipe of resource handles (thin handles).
These are intended for cases where a resource buffer with more than one
entry for each object is needed (for example, one entry per material
slot).
While it's already possible to have multiple regular handles for the
same object, they have a non-trivial overhead in terms of uploaded
data (matrix, bounds, object info) and computation (visibility
culling).
Thin handles store an indirection buffer pointing to their "parent"
regular handle, therefore multiple thin handles can share the same
per-object data and visibility culling computation.

Thin handles can only be used in their own Pass type (PassMainThin),
so passes that don't need them don't have to pay the overhead.

This pull request also includes the update of the Workbench Next
pre-pass to use PassMainThin, which is the main reason for the
implementation of this feature.

The main change from the previous PR is that the thin handles are now
stored directly in the main resource_id_buf, to avoid wasting an extra
 bind slot.

Pull Request #105261
2023-03-01 21:42:25 +01:00
03f17c42d0 Fix #100129: Status bar incorrectly shows "[G] Move" after pressing G
Add specific modal keyitem for `Vert/Edge Slide` and `TrackBall`.
So they don't need to reuse modal items from other operators.

Note that there is a workround to avoid repeated keys in the status bar.
2023-03-01 16:06:20 -03:00
515cb14056 Fix: Don't create undo step for empty box select in VSE
In `gesture_box_apply`, check if `exec` function returns
`OPERATOR_CANCELLED` and return 0 to prevent any undo items from being
created.

Pull Request #105065
2023-03-01 18:47:46 +01:00
d449539cd2 Cleanup: Move five modifier files to C++
See #103343

Pull Request #105345
2023-03-01 17:32:12 +01:00
4d58f01424 Add LSAN suppression rules config file.
This file has been tested on linux, other platforms may need some
tweaks, and/or dedicated files.

This is used to suppress errors with builds integrating ASAN sanitazing
tools, regarding memleaks detected in some third party libraries.

To use it, define the envvar option like that:

`LSAN_OPTIONS=print_suppressions=false:suppressions=/path/to/blender/source/tools/config/analysis/lsan.supp`

This is especially usefull when running ctest.

NOTE: Will also update https://wiki.blender.org/wiki/Tools/Tests/Setup
and https://wiki.blender.org/wiki/Tools/Debugging/ASAN_Address_Sanitizer
accordingly.
2023-03-01 16:24:59 +01:00
3006140718 Refactor: Replace DNA_DEPRECATED attribute with _legacy suffix
Applied for the motion tracking data data structures.

There are two advantages of doing so:

- More explicit and platform independent way of indicating that
  something is legacy and is not to be accessed outside of the
  versioning code.

- Simplifies conversion to C++ where having deprecated fields
  triggers warning in implicitly defined assign operator.

Pull Request #105340
2023-03-01 15:18:54 +01:00
1ba0494e33 Fix failing test after own recent commit regarding Main freeing function.
3e5ce23c99 introduced a regression in case the freed Main was part of a
list, and was supposed to be removed from it, since calling
`BLI_remlink` does _not_ clear the `prev`/`next` pointers of the removed
link.

This commit also contains a few more tweaks to recent related b3f42d8e98
commit.
2023-03-01 15:17:33 +01:00
3ff2cbe708 Cleanup: Add warning to ListBase's BLI_remlink regarding not cleared prev/next pointers.
While this behavior can be useful in some cases, it can also create
issues (as in one of own recent commits, 3e5ce23c99), since it
implicetly keeps the removed linknode 'linked' to the listbase.

At least warn about it in the documentation of `BLI_remlink`.
2023-03-01 15:17:33 +01:00
565acb639c WM: use the window associated with an area for initialization
The active window was used by the NLA and the Graph editor however
this is not always available and not necessarily the window that
contains the area being initialized. Potentially causing the graph and
NLA spaces to be initialized with the wrong scene.

Active window access caused various awkward fixes in the past
([0], [1], [2]) which worked around the active window not being set.
Use a lookup for the window instead of accessing the active window.

Note that passing the window is an option too however this is only
used for versioning older files and is not be needed in most cases.

[0]: 20788e1747
[1]: 42f6aada98
[2]: 480e467ac9
2023-03-02 00:39:29 +11:00
124b41a877 Cleanup: unused variables 2023-03-02 00:39:28 +11:00
cccf91ff83 Mesh: Move edge UV seams to a generic attribute
As part of #95966, move the `ME_SEAM` flag on mesh edges
to a generic boolean attribute, called `.uv_seam`. This is the
last bit of extra information stored in mesh edges. After this
is committed we can switch to a different type for them and
have a 1/3 improvement in memory consumption.

It is also now possible to see that a mesh has no UV seams in
constant time, and like other similar refactors, interacting with
only the UV seams can be done with less memory.

The attribute name starts with a `.` to signify that the attribute,
like face sets, isn't meant to be used in arbitrary procedural
situations (with geometry nodes for example). That gives us more
freedom to change things in the future.

Pull Request #104728
2023-03-01 14:13:05 +01:00
66c9c19466 Cleanup: add missing CMake headers & sort file lists 2023-03-01 22:46:04 +11:00
01e711749b pyproject: remove tools/pyproject.toml
Rely on ./pyproject.toml. This file was only separated because it was in
an external repository.
2023-03-01 22:18:28 +11:00
e1ab9e352c Cleanup: autopep8 2023-03-01 22:12:18 +11:00
bd0aa88909 Fix invalid path references after moving tools & scripts 2023-03-01 22:00:46 +11:00
1ed783eed3 Fix #99836: Blender SEGV when open .blend file in blender.
Use recent 'abort file reading' mechanism to simply not try to load such
purposedly broken .blend files at all.
2023-03-01 11:50:50 +01:00
b3f42d8e98 Add a mechanism to abort a blend file reading on critical error.
This commit introduces a new Main boolean flag that marks is as invalid.

Higher-level file reading code does checks on this flag to abort reading
process if needed.

This is an implementation of the #105083 design task.

Given the extense of the change, I do not think this should be
considered for 3.5 and previous LTS releases.
2023-03-01 11:50:50 +01:00
3e5ce23c99 Fix (unreported) potential leak in Main freeing function.
Could happen in case a 'split-by-libraries' Main is passed to
`BKE_main_free`.
2023-03-01 11:50:50 +01:00
e35afd8a1d Merge branch 'blender-v3.5-release' 2023-03-01 21:16:37 +11:00
e9fefcd298 Merge branch 'blender-v3.5-release' 2023-03-01 21:16:33 +11:00
ff89dfd6d2 Fix #105328: unit system does not affect cavity 2023-03-01 21:15:11 +11:00
cf572f1a64 Python: Add range and instance drawing to GPUBatch
GPUBatch.draw supports basic drawing methods. Although all
supported GPU backends support range based and instance based drawing.

This patch adds 2 methods to GPUBatch to add support to range based and
instance based drawing.

my_batch.draw_range(my_shader, elem_start=10, elem_count=5)
Will draw my_batch using my_shader. From the attached index buffer
elements 10-14 will be drawn.

my_batch.draw_instance_range(my_shader, instance_start=0, instance_count=10)
will draw my_batch using my_shader 10 times. Inside the vertex
shader the current instance number is held by gl_InstanceID.

Pull Request #104457
2023-03-01 10:23:38 +01:00
52064bf5da Fix #104824: GPencil natural drawing building with 1 subdivision very slow
1. Changes the subdivision function to not fill in time but add 0 to fix bug #104824
2. Fixes a bug in sanitization function noticed while fixing this bug.

Pull Request #105306
2023-03-01 10:09:23 +01:00
159958e52b Cleanup: Simplify storage and comments in UV Unwrapper.
Rename `single_pin_uv` to `origin`.

Remove `PChartPack`.

No functional changes.
2023-03-01 20:38:41 +13:00
c7d38b643b Cleanup: Simplify storage and comments in UV Unwrapper.
Simplify PChart handling of area_uv and area_3d.
2023-03-01 20:01:40 +13:00
6766a7911f UV: Merge both UV Packing engines into one.
Affects Geometry Nodes:
* UV Unwrap
* UV Pack

No functional changes.

Pull Request #105286
2023-03-01 07:28:28 +01:00
09c4d6bd7b Cleanup: avoid looping over layer collections again when freeing 2023-03-01 15:14:50 +11:00
ea97bb1641 Use hash for Collection.gobject lookup, speedup object linking
Add a hash for faster look-ups on collection->gobject,
This avoids a full list lookup for every object added via Python's
CollectionObject.link as well as linking via BKE_collection_object_add_*
functions.

While the speedup is non-linear, linking & unlinking 100k objects from
Python is about 50x faster. Although unlinking all objects in order
(a best-case for linked lists) is approximately the same speed.

Ref !104553.
2023-03-01 12:34:45 +11:00
e65671c1ed Merge branch 'blender-v3.5-release' 2023-03-01 11:21:02 +11:00
337e68aeb5 Test: update bl_rna_defaults
- Remove Group test
- Add Brush, Collection, GreasePencil, HairCurves,
  LightProbe, PointCloud, Volume tests

Ref !105172.
2023-03-01 11:18:47 +11:00
6f4d36ca8f Python: Change console banner color-style to info
Update the style of the Python Console banner to "INFO" instead of
"OUTPUT".

This change makes it easier to difference user generated output from the
initial banner text.

This also has an advantage that "Copy as Script" excludes the banner.

Ref !105188.
2023-03-01 11:10:06 +11:00
6fe2fabbff Merge branch 'blender-v3.5-release' 2023-02-28 17:47:10 -05:00
d90d6f8674 Fix #105259: Copy & paste boolean custom property as driver doesn't work
A copy and paste mistake in ef68a37e5d.
2023-02-28 17:46:26 -05:00
71a79a7a7c Cleanup: Small cleanups to flip faces node
Decrease indentation, simplify variable names, use IndexRange more.
2023-02-28 17:30:25 -05:00
ce25209e26 Cleanup: Clarify mirror modifier copying and face flipping
Rewrite the logic to depend less on local variables and prefer spans
and indices over points and pointer arithmetic. Also make use of the
IndexRange type for some basic logic, correct the mesh that the
sharp edge layer was chosen from, and reduce variable scope.
2023-02-28 17:29:35 -05:00
f2ea7ae751 Fix #105319: Crash in weighted normal modifier after recent cleanup 2023-02-28 16:44:26 -05:00
8aa1a7db3e Cleanup: Use clearer variable names in mirror modifier
It wasn't clear what "max" referred to.
2023-02-28 16:03:49 -05:00
eb5e7b1b4e Merge branch 'blender-v3.5-release' 2023-02-28 15:39:55 -05:00
079dbf4d1b Fix #105162: Array modifier cap material index ignored
The material indices from the caps were only copied if the base mesh had
a material index attribute. Fix that by copying them manually if the cap
has the attribute.
2023-02-28 15:39:19 -05:00
f911a9280b Merge branch 'blender-v3.5-release' 2023-02-28 14:03:22 -05:00
15f59470a3 Fix #105314: Custom node groups missing sockets
`ShaderNodeCustomGroup` and others lost their UI with
7026096099 without a dynamic declaration callback.
2023-02-28 13:59:28 -05:00
4ffae99d6d Cleanup: Remove unnecessary declarations in laplacian smooth modifier 2023-02-28 13:03:42 -05:00
08e20376b1 Cleanup: Use simpler for loop syntax for mesh polys in two modifiers 2023-02-28 13:03:42 -05:00
62c6eb12bf Fix #105165: Weighted normal modifier crash after recent cleanup
Mistake in cb62ab5b28
2023-02-28 13:03:42 -05:00
9b67e883dd Fix #105257: Incorrect Search Region Size
Search list's region is having its size members (winx and winy) set
to values that are one pixel too small. This causes text to look bad
as they are slightly off their pixel alignment.

See #105308 for more details and an illustration of the issue.

Pull Request #105308
2023-02-28 18:21:07 +01:00
8fbc80be8f Merge branch 'blender-v3.5-release' 2023-02-28 11:36:20 -05:00
076a33ccd1 Fix #104219: Node links dragged from wrong socket after selection
Nodes are sorted based on the selection. In some cases (even depending
on processor speed, nodes can be selected and reordered, and another
operation can run before the next redraw). That gives a window where
operators mapped to the same input as selection can run with invalid
socket locations (which aren't updated after the nodes are reordered,
since they are stored in a separate array).

To fix this, move the socket locations from the node editor runtime
data to the node tree, tag them as invalid when the nodes are
reordered, and check for that status in a few more places.

A better longer term solution is not reordering nodes based on
UI status and instead storing the UI drawing order separately.

Pull Request #104420
2023-02-28 11:35:32 -05:00
480e467ac9 Fix #104726: Allow loading of 2.48 file without active window
Add check to WM_check for lack of wmWindowManager->winactive. Sets it
if there is a window and makes that one wmWindow->active as well.

Pull Request #105225
2023-02-28 17:08:30 +01:00
eb68334b58 Cleanup: Mesh: Access looptris with Span
Similar to cb62ab5b28 but for mesh triangulation.

Pull Request #105297
2023-02-28 14:52:31 +01:00
3c94e2ab4c Cleanup: split 'transform_gizmo_3d.cc' in more specific units
Split `transform_gizmo_3d.cc` in:
- `transform_gizmo_3d.cc`
- `transform_gizmo_3d_cage.cc`
- `transform_gizmo_3d_shear.cc`

Split `transform.h` in:
- `transform.h`
- `transform_gizmo.h`

Also:
- Move functions `gimbal_axis_pose` and `gimbal_axis_object` to
`transform_orentations.c` (they are not used in `transform_gizmo_3d.cc`)

Pull Request #105256
2023-02-28 14:12:14 +01:00
5edca02d08 Fix cage2d gizmo setting uniform size when uniform scaling is required 2023-02-28 13:00:20 +01:00
30a81f1b55 GPencil: UV parameters for the first point in sample modifier.
Simplify modifier sample mode failed to transfer uv parameters for the first point, now fixed.

Continuation of #104942

Pull Request #105284
2023-02-28 12:15:50 +01:00
7842347ec8 Cycles: Fix hanging unit tests when MetalRT is enabled
This patch fixes hanging unit tests when MetalRT is enabled. It simplifies and fixes the kernel selection logic by baking the MetalRT-specific options into `kernels_md5` rather than expanding out and testing MetalRT bit flags explicitly.

Pull Request #105270
2023-02-28 11:42:08 +01:00
0786b05175 Cleanup: More clear variable name in File Browser drawing 2023-02-28 11:29:59 +01:00
09e848deec Cleanup: use term "filepath" instead of "name" / "fname" 2023-02-28 17:31:08 +11:00
707af21afd Merge branch 'blender-v3.5-release' 2023-02-28 17:14:02 +11:00
9fccd2dc24 Fix #100819: Built-in VFont has an additional user by default
New built-in fonts would have an additional user when added for the
first time.

BKE_vfont_builtin_get now always borrows the reference.
2023-02-28 17:08:23 +11:00
3cba2911e0 Vulkan: Add Initial VKFrameBuffer.
This was backported from tmp-vulkan. When disabling the fence check
in ghost it is able to start blender. It will show a black screen
so not usable for users.
2023-02-28 06:20:12 +01:00
c2df623e86 Merge branch 'blender-v3.5-release' 2023-02-28 16:01:42 +11:00
1e6aaf5f65 Merge branch 'blender-v3.5-release' 2023-02-28 16:01:26 +11:00
9cee0eb7fa Cleanup: format 2023-02-28 15:44:49 +11:00
e885973ea9 Fix #104894: Toggle comments assumes '#' prefix (failing for OSL)
Add comment line prefix to format struct so each language can define
it's own comment prefix.

Ref !104953.
2023-02-28 15:43:11 +11:00
8d9819e07f Fix: Not all vulkan code-paths where compiled.
Fix issue where old `WITH_VULKAN` was still used. It should
have used `WITH_VULKAN_BACKEND`.
2023-02-28 05:36:06 +01:00
8859b1cd3c Cleanup: quiet mypy type checking warnings
- make_update.external_script_add_origin_if_needed
  returned None or an empty string. As neither where checked simply
  return None.
- git_get_remote_url had an incorrect annotation.
2023-02-28 15:12:04 +11:00
cca5f18303 Fix path for check_mypy_config 2023-02-28 15:11:27 +11:00
466d160424 Cleanup: replace an integer array with booleans for RNA type validation 2023-02-28 14:53:48 +11:00
9ac0cc48b9 Cleanup: use _ separator for variable names including dummy
Names such as `dummyult` and `dummyet` didn't read very well,
underscore separate these names.

Also rename some variables that used old conventions which missed
being updated (`mpr` for manipulator instead of `gz` for gizmo).
2023-02-28 14:39:41 +11:00
6d5e834857 Merge branch 'blender-v3.5-release' 2023-02-28 14:11:25 +11:00
52f521dec4 Fix #105063: Registering existing RNA types overwrote built-in types
When an RNA type was registered, any existing dynamic types with the
same name were unregistered. This didn't account for built-in types
which cannot be unregistered in (most cases) allowing duplicate
operators for e.g. to be registered with the same name as existing
built-in operators (asserting with debug builds with GHash duplicates).

In practice the newly registered operator would be called unless
adding operators caused the GHash to be resized which could cause the
original operator to be used.

As registered RNA type identifiers are meant to be unique, don't allow
duplicate names in the first place. Now all dynamically registerable
RNA types prevent this situation, raising an error when scripts
attempt to register a type with an identifier matching the name of a
type that could not be removed.
2023-02-28 13:58:40 +11:00
4675ee3c73 Merge branch 'blender-v3.5-release' 2023-02-28 10:31:07 +11:00
0965341dcf Fix #105229: Operator tooltips are cut short
Shortened in [0], increase to 1024 with the following changes:

- Use BKE_ST_MAXNAME for translation_context.
- Use OP_MAX_TYPENAME for wmOperatorType.name.

Both these limits were already used elsewhere but happened to use
RNA_DYN_DESCR_MAX (incorrectly).

[0]: f403d9a2b1
2023-02-28 10:28:34 +11:00
a58caeb4b3 Cleanup: quiet struct declaration warning 2023-02-28 10:17:17 +11:00
e4f0e29bab Merge branch 'blender-v3.5-release' 2023-02-28 10:12:51 +11:00
de12ea7226 Cleanup: quiet unused warnings 2023-02-28 10:10:12 +11:00
d291955665 Fix setting the active vertex color when assigning false
Oversight in c517e4a501.
2023-02-28 10:10:12 +11:00
cb1af1fbd9 UV: Migrate UV packing from Editor to bf_geometry.
No functional changes.

Pull Request #105212
2023-02-27 22:41:10 +01:00
c3d803c2ef Cleanup: Use consistent "positions" term for mesh update tag functions
Consistent with naming from 1af62cb3bf. Keep the "coord"
naming in the "vert_coords_alloc" set of functions since they should be
removed (see #103789).
2023-02-27 16:08:48 -05:00
b37111c574 Cleanup: Use consistent "vert" term for mesh normals
Use "vert" instead of "vertex" when referring to mesh normals. This was
discussed as part of 1af62cb3bf but never completely
implemented.
2023-02-27 15:52:29 -05:00
baa27d0aef Fix: Explode modifier cycles test failure after recent cleanup
Caused by 96abaae9ac. Just keep the old argument
in the `_ex` version of the function for now. It can be removed
when the explode modifier is removed in 4.0.
2023-02-27 15:29:52 -05:00
5ea41a9942 UI: Added Edge Width option in preferences for 3DView and UV/Image Editor
Previously [D16255](https://developer.blender.org/D16255)
There is no option to adjust the edge_width like there is in the preferences for vertex_size and face_dot_size.

I only added the option for 3DView and UV/Image Editor, and limited both to a max size of 5 pixel, since the edges do not look very nice with too high values.
In the UV Editor only, there are always black outlines on the edges, I could not find a way to reduce the increasing thickness of these black outlines.

The default edge_width of 1 pixel:

![shows the marked new attribute with a value of 1 in the settings for the UV/Imageeditor](/attachments/f48fc1e5-2b49-4337-bd86-f2ad4aca42c3)

Here the edge_width with a falue of 3:

![shows the marked new attribute with a value of 3 in the settings for the UV/Imageeditor](/attachments/d0b0b1ea-5967-46b2-80a2-ccae18933638)

And here the visible increase of the dark border of the edges and their overlap (even at the maxed size of 5):

![shows the marked new attribute with a value of 5 in the settings for the UV/Imageeditor and points out the thicker border in the left side UV Editor](/attachments/1590965f-af2a-49d0-a11e-1afecaabf940)

Lastly for the 3DView the max edge_width of 5 looks like this:

![shows the marked new attribute with a value of 5 for the settings for the 3DView and it's resulting wider lines in the right side visible 3DView](/attachments/fcd35341-97a5-4db6-8bbf-c5ce5333e5aa)

Pull Request #104741
2023-02-27 20:02:37 +01:00
f37077ae5a Mesh: Clear loose edges bitmap with count of zero
When there are no loose edges, the loose edge bitmap shouldn't be used.
That was already documented in the loose edge storage struct, but the
bit vector wasn't actually cleared.
2023-02-27 13:09:45 -05:00
52104c1a0c Mesh: Avoid recalculating bounds after some operations
Share the bounds cache across the input and output meshes of some
mesh operations that don't change the min and max positions: simple
subdivision, edge/face deletion, and triangulation. If the source mesh's
bounds are computed, or if the mesh is persistent, this can save
recalculation of the bounding box, which takes a few milliseconds
for large meshes.
2023-02-27 12:31:09 -05:00
96abaae9ac Cleanup: Remove legacy argument from mesh creation functions
The legacy `tessface_len` argument was only used for the explode
modifier. Remove it and copy the legacy face data manually there.
2023-02-27 11:24:22 -05:00
494becdec9 Cleanup: Remove redundant parenthesis 2023-02-27 16:56:46 +01:00
17e92711d3 UI: Refactor path dropping so logic doesn't depend on icons
No behavior change intended.

Many file drag & drop handlers used the icon assigned for dragging to
determine what type of data is dragged. This is fragile, for example
changing an icon would break drag & drop (!). This happened a few times,
e.g. see 3788003cda. It's also causing problems with #104830, which
changes how file browser drag data is handled.

Instead use the file extension to determine the file type.
2023-02-27 16:44:47 +01:00
1d4abfb537 Merge remote-tracking branch 'upstream/blender-v3.5-release' 2023-02-27 16:28:23 +01:00
4d5e68a638 Updated i18n PO files from SVN trunk (r6355). 2023-02-27 16:26:22 +01:00
5bd63e0fa5 Merge remote-tracking branch 'upstream/blender-v3.5-release' 2023-02-27 16:20:18 +01:00
3dd071e39b Usual i18n/UI messages fixes. 2023-02-27 16:19:16 +01:00
d69e2dba34 Merge branch 'blender-v3.5-release' 2023-02-27 16:14:43 +01:00
e6af81c536 Fix #105028: No update exiting curves edit mode
Exiting curves edit mode (going to object mode) would not update the
screen.

The fix adds a case to `ED_object_editmode_load_free_ex` for CURVES
to make sure the function returns properly. This then correctly adds the
notifier in `ED_object_editmode_exit_ex` to update the screen.

Pull Request #105252
2023-02-27 16:14:05 +01:00
0ade3dfc14 Merge branch 'blender-v3.5-release' 2023-02-27 15:23:56 +01:00
c5bbc5db6f I18n: disambiguate a few messages
- "Value" in the sense of color lightness is not the same word in
  Japanese as other usages. See #105113.
- "Double" as a data type vs. a value.

Also extract "Custom Color Presets" in the tracking UI.
Run clang-format as well.

Pull Request #105187
2023-02-27 15:21:00 +01:00
8cc11bc5f2 Fix #105226: Transform Gizmo with tncorrect offSets
Error in Commit a85b62bbc

Offsets were incorrectly being accumulated.
2023-02-27 11:09:22 -03:00
07f5d9bf2a Merge branch 'blender-v3.5-release' 2023-02-27 14:13:29 +01:00
1f6c710463 Fix #105230: Crash when reloading a library when one of its scene is active.
Scene and viewlayers pointers in the link/append context data need to be
updated after reload, otherwise they would keep pointing to old freed
IDs.
2023-02-27 14:12:50 +01:00
c79c35b4d3 Merge branch 'blender-v3.5-release' 2023-02-27 14:02:56 +01:00
79bce99260 Fix #104857: crash when datafiles/assets folder does not exist
This adds some simple null checks to avoid the crash. It might still
be good to improve the error message, but also does not seem as
important as avoiding the crash. Typically, users should not run into
this issue because the assets are shipped with Blender.
2023-02-27 14:02:03 +01:00
b558fff5b8 Outliner: New Grease Pencil filter
Actually is impossible to filter the Grease Pencil object type in the Outliner because only Meshes, Cameras and Lights are supported. This patch adds the Grease Pencil filter that allows artists to select only this type of objects. This filter is very handy for storyboarding.

Pull Request #104473
2023-02-27 13:07:14 +01:00
9044ba0ae5 Compositor: Compositor Output should Follow Active Node.
When using multiple compositor output nodes, compositing would fail
, showing a completely black output as it doesn't respect the active
node.

This patch will equalize the implementation with the viewer nodes.

Patch created by @OmarEmaraDev

Fixes: #86836

Pull Request #105235
2023-02-27 12:58:25 +01:00
8aedc03aa2 Vulkan: Calculate Correct Host and Device Memory Size.
Due to an error in GPU module we fixed the memory size in the
Vulkan backend. Last week the error has been fixed in the GPU module
so we can remove the temp fixes in the Vulkan backend.

Pull Request #105244
2023-02-27 12:56:05 +01:00
f738843362 Metal: Fix possible uniform lookup issue.
Similar to recent issues with gl_shader_interface,
ShaderInput lists need to be sorted to ensure correct
and efficient uniform lookup by name.

Authored by Apple: Michael Parkin-White

Ref #96261
Pull Request #105239
2023-02-27 12:33:28 +01:00
1812f5cb92 Merge branch 'blender-v3.5-release' 2023-02-27 12:03:42 +01:00
0c67a90e4f #99807: USD IO: Add support for exporting to USDZ
This commit adds the default .usdz export capability.

The importer already supports usdz so no change is required other than updating the text in menu to match the updated exporter text.

On export, a .usd/a/c file has to be created first, and then converted to .usdz. A weird change of directory is required because of a quirk with the USD conversion to usdz. If an absolute filepath is passed into the `UsdUtilsCreateNewUsdzPackage` function, the usd files inside the usdz archive will have the same directory structure, i.e. if one tries to create a file at `C:\code\BlenderProjects\file.usdz`, when the usdz file is created, inside it will have the structure `\code\BlenderProjects\file.usdc`.

This is counteracted by setting the current working directory to the temporary session directory where both the usdc and usdz files are created, and just passing the file name to `UsdUtilsCreateNewUsdzPackage` without any filepath. Once the usdz file is created it is moved to the intended directory.

There is a separate `UsdUtilsCreateNewARKitUsdzPackage` capability for exporting usdz for iOS devices that will be implemented in a follow up patch as it will require some more small UI changes.

Co-authored-by: Charles Wardlaw (@CharlesWardlaw)
Co-authored-by: Sonny Campbell (@SonnyCampbell_Unity)
Co-authored-by: Bastien Montagne (@mont29)

Pull Request #105185, based on #104556.

Pull Request #105223
2023-02-27 11:59:57 +01:00
f6c9fb27d5 Cleanup: remove .orig file added by accident 2023-02-27 21:52:26 +11:00
efb86b75ee Cleanup: comment block formatting 2023-02-27 21:51:57 +11:00
f240a16037 Cleanup: format 2023-02-27 21:34:53 +11:00
9a1ab6bd14 Cleanup: function style casts for C++, use nullptr 2023-02-27 21:34:53 +11:00
347cbbff2d Fix path in check_licenses utility 2023-02-27 21:34:53 +11:00
16aab1508d Cleanup: comment out unused parameters from last commit 2023-02-27 02:04:55 -08:00
a1c3061812 Fix OSX implementation of BLI_current_working_dir and improve tests.
While some implementations of `getcwd` may return an allocated string
instead of the given char buffer in some cases, this is not the expected
behavior of the BLI wrapper. Not to mention the danger of returning a
pointer to a static char buffer...

Improve `ChangeWorkingDirectoryTest` to be more 'full check' regarding
behavior of both `BLI_current_working_dir` and `BLI_change_working_dir`.
Also move call to `BLI_threadapi_init` into proper `SetUp` method (to
have correct symmetry with the call to `BLI_threadapi_exit` in the
`TearDown` one).

Based on investigation by Charles Wardlaw (@CharlesWardlaw).

Pull Request #105220
2023-02-27 11:03:42 +01:00
c4791ee009 Fix tests for macOS storage_apple.mm functions.
Pull Request #105000
2023-02-27 11:03:42 +01:00
DESKTOP-ON14TH5\Sonny Campbell
561e50f6c6 BLI: add function for changing working directory
Add `BLI_change_working_dir(path)` to change the current working directory.

This change is required for adding USDZ support to Blender. When exporting to that format, we are required to do a weird change of directory because of a quirk with the USD library's USDZ functionality. If an absolute filepath is passed into the `UsdUtilsCreateNewUsdzPackage` function, the USDZ archive will store that full path.

macOS uses `NSFileManager` through some new Mac-only wrapper functions.

Ref #99807

Pull Request #104525
2023-02-27 11:03:42 +01:00
08af0f1204 Fix setting the active vertex color when assigning false
Oversight in c517e4a501.
2023-02-27 21:00:30 +11:00
30db096cc8 Cleanup: quiet compiler warnings 2023-02-27 21:00:30 +11:00
dc08ff3c2e Cleanup: spelling in comments 2023-02-27 21:00:30 +11:00
40a11c7404 Merge branch 'blender-v3.5-release' 2023-02-27 10:59:30 +01:00
931b832fb2 Fix make update when local branch exists
Apparently `git checkout -t` is only allowed to happen for new branches.
Added a code which checks whether the branch already exists and it so
uses the `git checkout <branch>`.

Pull Request #105234
2023-02-27 10:58:58 +01:00
b4ee936627 Sculpt: Add support for last operator panel to color filter operator
* Refactored the color filter op to have an ->exec callback.
* Added nullptr checks to the filter cache API to support
  running outside of a view3d context.
* Redo panel displays the active filter type's name in the
  header.
2023-02-27 01:51:36 -08:00
6c03339e48 Cycles: reduce mesh memory usage by unflattening
To improve mesh upload speeds and reduce the size of the scene data which allows larger scenes to be rendered.

The meshes in Cycles are currently stored as flattened meshes, where each triangle is stored as a set of 3 vertices. Unflattening writes out the vertices in a list according to the index buffer. This uses a lot of memory and for current hardware does not provide a noticeable benefit. This change unflattens the mesh by directly using the meshes vertex and index buffers directly and skips the unflattening. This change allows for larger scenes and also a reduction in the sizes of the meshes. Further it results in a decrease the amount of time it takes to upload the data to a GPU. This is especially important for when multiple GPUs are used in a single machine.

Pull Request #105173
2023-02-27 10:39:19 +01:00
79d64bfde3 Geometry Nodes: Remove unnecessary position copying in delete node
In Edges and Edges & Faces modes, the node copied the positions once
with the other generic attributes and another time specifically just as
the positions. This is now unnecessary since positions are stored as
a generic attribute (1af62cb3bf). In a simple test this saved
2ms out of a total 12 in these modes.
2023-02-26 22:16:58 -05:00
ca2c0da79e Merge branch 'blender-v3.5-release' 2023-02-26 18:09:18 -05:00
97a8bb450c Fix #103387: Radius affects curves bounding box
e8f4010611 unified the bounds computation for the new curves
object type and the rest of the curves system used by geometry nodes.
In the process, it made bounds affected by the control point radius.
In theory that makes sense; the bounds are supposed to be the extents
of the visible geometry. But in practice the change wasn't expected,
for a few reasons:
 - The radius has never affected the bounds for the legacy curve type
 - The default radius of legacy curve objects is absurdly large at 1.0m
 - Only the new curve object has visible radius, and only in "strip"
   mode or when rendering with Cycles

Currently the bounds are only used for the "Bounding Box" geometry node
and the panel in the 3D viewport sidebar, so there isn't any incentive
to choose less intuitive behavior yet.

Long term, the correct behavior is probably to include the radius in
the bounds, but this commit postpones that change to when it works
better with the rest of the curves system.

Pull Request #105154
2023-02-27 00:01:01 +01:00
3db246a3ce Fix #104915: Race condition writing subsurf optimal display edges
Writing to a bitmap from multiple threads causes races when writing to
bits within the same integer. Instead, write to a separate boolean
array while subdividing, then move that to the final mesh bit vector.

Notes:
 - The final copy to the bit vector could be replaced by a generic
   `copy_from(Span<bool>)` call in the future.
 - Theoretically we could entirely replace the `BitVector` with an
   `Array<bool>`, but 1/8 the memory use for edges is likely worth it.

Pull Request #105156
2023-02-26 23:59:02 +01:00
3b59163b02 Subdiv: Simplify final vertex counting
The initial subdivision context counting ended up using unnecessarily
complicated logic to count the number of final vertices. In a first pass
it added vertices for every coarse edge. Then it added the same number
of vertices for every loose edge. That adds up to the same number of
vertices for the edges, so the separation is redundant and can be
replaced with a single multiplication.

The bitmap doesn't need to be cleared then, since it isn't used now.

In a test of a mesh with 2 million faces and 3 million vertices, this
saved 2.8ms (though the whole subdivision process takes around 700ms).

Pull Request #105159
2023-02-26 23:57:49 +01:00
8b543bfa3a Merge branch 'blender-v3.5-release'
# Conflicts:
#	source/blender/gpu/metal/mtl_immediate.mm
2023-02-26 17:44:31 +01:00
bf27a239c7 Fix: segfault when setting value in empty bit span 2023-02-26 17:26:12 +01:00
9335150f8c Cleanup: move some function implementations out of header
It's not really worth having them in the header and compiling them
in every translation unit where they are used.
2023-02-26 17:26:12 +01:00
54f672cbfa #99807: USD IO: Add support for exporting to USDZ
This commit adds the default .usdz export capability.

The importer already supports usdz so no change is required other than updating the text in menu to match the updated exporter text.

On export, a .usd/a/c file has to be created first, and then converted to .usdz. A weird change of directory is required because of a quirk with the USD conversion to usdz. If an absolute filepath is passed into the `UsdUtilsCreateNewUsdzPackage` function, the usd files inside the usdz archive will have the same directory structure, i.e. if one tries to create a file at `C:\code\BlenderProjects\file.usdz`, when the usdz file is created, inside it will have the structure `\code\BlenderProjects\file.usdc`.

This is counteracted by setting the current working directory to the temporary session directory where both the usdc and usdz files are created, and just passing the file name to `UsdUtilsCreateNewUsdzPackage` without any filepath. Once the usdz file is created it is moved to the intended directory.

There is a separate `UsdUtilsCreateNewARKitUsdzPackage` capability for exporting usdz for iOS devices that will be implemented in a follow up patch as it will require some more small UI changes.

Co-authored-by: Charles Wardlaw (@CharlesWardlaw)
Co-authored-by: Sonny Campbell (@SonnyCampbell_Unity)
Co-authored-by: Bastien Montagne (@mont29)

Pull Request #105185, based on #104556.
2023-02-26 16:36:49 +01:00
a8cc5f6919 Fix #104906: GPU: Fix signed/unsigned mismatches in shader code
Fix error message "initializer of type int cannot be assigned to
variable of type uint" on Blender startup.

Pull Request #105153
2023-02-26 16:13:55 +01:00
ec6e7d97ca Fix OSX implementation of BLI_current_working_dir and improve tests.
While some implementations of `getcwd` may return an allocated string
instead of the given char buffer in some cases, this is not the expected
behavior of the BLI wrapper. Not to mention the danger of returning a
pointer to a static char buffer...

Improve `ChangeWorkingDirectoryTest` to be more 'full check' regarding
behavior of both `BLI_current_working_dir` and `BLI_change_working_dir`.
Also move call to `BLI_threadapi_init` into proper `SetUp` method (to
have correct symmetry with the call to `BLI_threadapi_exit` in the
`TearDown` one).

Based on investigation by Charles Wardlaw (@CharlesWardlaw).

Pull Request #105220
2023-02-26 15:52:19 +01:00
2b7707b0d0 Fix #105059: Fix Grease pencil fill tool with Metal.
GPencil 3D stroke rendering uses a geometry shader.
This is unsupported by the Metal backend, so implement
fix for this failing compilation by shifting geometry shader
logic into the Vertex shader for Metal backend.

Authored by Apple: Michael Parkin-White

Ref #96261
Pull Request #105143
2023-02-26 15:22:13 +01:00
9f42888552 Fix #104016: Resolve Metal LineLoop emulation.
Metal LineLoop emulation path does not correctly apply
when using SSBO vertex fetch mode alongside 3D line
rendering.

Patch moves line emulation above SSBO
vertex fetch setup to ensure the correct emulation
parameters are passed to the shader.

Authored by Apple: Michael Parkin-White

Ref #96261
Pull Request #105142
2023-02-26 15:21:54 +01:00
fb63e484b9 Fix #103398: Fix Icon sampler initialization in Metal backend.
Resolves issue with nearest filtering on UI Icons. Note that as
Metal does not support LOD bias as a parameter on a sampler
object, the original code has been modified to perform LOD
biasing at the shader level.

As GPU_SAMPLER_ICON is not  widely used, it is more
efficient to apply directly to the  affected shaders, rather
than workaround passing in the sampler LOD bias as a
separate value e.g. uniform or push constant.

Original PR feedback addressed to also refactor ICON
shaders to use consistent style for single and multi
Icon rendering.

Authored by Apple: Michael Parkin-White

Ref #96261
Pull Request #105145
2023-02-26 13:23:40 +01:00
86ceb6722f Cleanup: format 2023-02-26 11:55:22 +13:00
52ded6ab56 GPUTexture: Make sure all available texture format are supported
This remove default casses from the `switch` statements to catch where
the missing cases are.

Uncomment unimplemented cases for the sake of completeness. Improving the
overall API.

This make the format conversion lists exhaustive and documented.

This replace `validate_data_format_mtl` by the common version as they
don't differ at all now.
2023-02-25 21:47:00 +01:00
5b2b114a2a Fix #105198: Ensure Frame and Reroute nodes are searchable
Set the new `gather_add_node_search_ops` member for these two special
node types.

Pull Request #105201
2023-02-25 21:32:23 +01:00
7eef746270 Merge branch 'blender-v3.5-release' 2023-02-25 23:13:05 +05:30
f9bcd8c7e8 Fix #104992: Crash on calling operation search in outliner
After 7eda9d8dda, crash occurs when operation search is called and no
active tree element is present. Add missing null check in new poll
function to fix the crash.

Pull Request #105004
2023-02-25 18:36:24 +01:00
afb6336857 Workbench: Remove unecessary GPU_TEXTURE_USAGE_ATTACHMENT flag
The dummy 3D textures are read only and never used as framebuffer targets.
2023-02-25 13:13:21 +01:00
9fb1f32f06 Cleanup: GPUTexture: Remove _ex suffix from texture creation
It isn't relevant anymore now that usage flags are mandatory.

Pull Request #105197
2023-02-25 11:39:54 +01:00
3d6578b33e GPUTexture: Add texture usage flag to all texture creation
All usages are currently placeholder GPU_TEXTURE_USAGE_GENERAL.
2023-02-25 11:39:53 +01:00
e01b140fb2 GPUTexture: Remove data_format from 3D texture creation function
For every other texture types this is expected to be implicitly
`GPU_DATA_FLOAT`. There is only one case where this is not the case.

I believe this was previously needed because the data type was
conditionning the texture creation. This is not the case anymore.
2023-02-25 11:39:53 +01:00
75e3371aef GPUTexture: Remove obsolete GPU_texture_bind_ex argument set_number
This was previously used when the binding number wasn't always stored
inside the texture itself.
2023-02-25 11:39:53 +01:00
73da5ee90d Cleanup: GPUTexture: Rename some functions with more descriptive names
List of renames:
GPU_texture_generate_mipmap > GPU_texture_update_mipmap_chain
GPU_texture_orig_width > GPU_texture_original_width
GPU_texture_orig_height > GPU_texture_original_height
GPU_texture_orig_size_set > GPU_texture_original_size_set
GPU_texture_format_description > GPU_texture_format_name
GPU_texture_array > GPU_texture_is_array
GPU_texture_cube > GPU_texture_is_cube
GPU_texture_depth > GPU_texture_has_depth_format
GPU_texture_stencil > GPU_texture_has_stencil_format
GPU_texture_integer > GPU_texture_has_integer_format
2023-02-25 11:39:53 +01:00
584e514561 Cleanup: GPUTexture: Improve function parameters name 2023-02-25 11:39:53 +01:00
7974557f0b GPUTexture: Add header documentation and reorganize sections 2023-02-25 11:39:53 +01:00
6166dac3ee Gizmo: support scaling of light gizmos with zero size
Zero-sized gizmos were not shown because GPU does not draw filled
triangles with zero area. This problem is resolved by drawing lines or
points in these degenerated cases.
Scaling is supported via computing the original and the new size, then
treat the case with zero original size separately, instead of only
computing the scale itself.
Actually applies to all `cage2d` gizmos, but not compatible when
translate flag is set.
2023-02-24 22:54:24 +01:00
0f09678036 Merge branch 'blender-v3.5-release' 2023-02-24 11:47:39 -08:00
01d4c8462d Fix #104006 Sculpt box/lasso trim projection errors 2023-02-24 11:46:29 -08:00
a843a9c9bb Sculpt: Add trim orientation to sculpt box trim UI 2023-02-24 11:28:23 -08:00
6cd9604a91 Merge branch 'blender-v3.5-release' 2023-02-24 11:10:56 -08:00
c517e4a501 Fix #104803: Fix broken deprecated vertex color RNA APIs
Fixed:
* mesh.vertex_colors.active
* mesh.vertex_colors.active_index
* MeshLoopColorLayer.active
* MeshLoopColorLayer.active_render
* MeshVertColorLayer.active
* MeshVertColorLayer.active_render
2023-02-24 11:07:53 -08:00
e3538546f2 Merge branch 'blender-v3.5-release' 2023-02-24 22:36:18 +05:30
b789980e27 Fix #105009: Restore GPencil layer drawing in dopesheet
After 49ad91b5ab, an extra visibility
toggle is being drawn for grease pencil layer in dopesheet. In this PR,
a condition is added to skip drawing of visibility toggle for GPencil
layer. Also, Grease pencil does not support pinning so restore the offset
added to channel for drawing the pin icon.

Pull Request #105080
2023-02-24 18:02:35 +01:00
82ff277528 Fix #100066: Cycles hangs when MSL->AIR compilation fails
This fixes [#100066](blender/blender#100066) by failing hard when front-end MSL->AIR compilation errors are encountered.

Pull Request #105122
2023-02-24 17:55:27 +01:00
626c233dd2 Fix #104087: Cycles crashes (Metal / AMD)
This is a workaround for [issue #104087](blender/blender#104087). We encounter crashes when using shader binary archives on AMD, so this disables them while we investigate a proper fix. Kernels will still be cached automatically by the OS file system cache. This cache may occasionally be purged due to external factors, in which case kernels will get compiled again.

Pull Request #105186
2023-02-24 17:52:35 +01:00
12cc3ccd72 Merge branch 'blender-v3.5-release' 2023-02-24 17:09:29 +01:00
f30c395a7c Fix make_update switching branches with multiple upstreams
If repository has multiple remotes with the same name of branch
checking out to the branch using simple `git checkout branch` exists
with an error: this is because there is ambiguity w.r.t which remote
to track.

Now the code explicitly provides remote to track, preferring to use
"origin" first (which is to be used for Blender style of workflow,
and Github style workflow when there is a fork available), and use
"upstream" if there is no origin.

Pull Request #105176
2023-02-24 17:08:46 +01:00
be94fefeb1 Merge branch 'blender-v3.5-release' 2023-02-24 16:43:17 +01:00
2c5434c3f5 Fix: crash in Spline Parameter node with single-point-curves
This was caught by our tests when they are run in a debug build with asserts.
2023-02-24 16:42:02 +01:00
45bbee340e Cleanup: Draw Manager: Update outdated comment 2023-02-24 16:30:10 +01:00
30efdbfc62 Merge branch 'blender-v3.5-release' 2023-02-24 16:27:26 +01:00
3d10dfb0a3 Fix #105166: Sample UV Surface node does not take index mask into account
The `call` method was reading from and writing to memory that it was
not supposed to access based on the passed in `mask`.
2023-02-24 16:26:07 +01:00
3e0a1cafa7 Merge branch 'blender-v3.5-release' 2023-02-24 15:53:18 +01:00
9b70039014 Fix paths in the auto-formatting tools
Those got missed in the submodule change commit.

Pull Request #105178
2023-02-24 15:52:34 +01:00
d5e45c8b92 Merge branch 'blender-v3.5-release' 2023-02-24 13:20:39 +01:00
b8359ede7d Fix #105168: Entering vertexpaint creates a non-default color attribute
Caused by 6514bb05ea

The new attribute was set active, but not default (camera icon).
Now set it default as well.

Pull Request #105169
2023-02-24 13:19:10 +01:00
ac93598dd1 Fix #105011: Cannot remove user preset when its name is translated
The preset names were translated before building the UI. This meant
that the translated name was passed to the operator responsible for
deleting the preset file, instead of the original name.

Pull Request #105155
2023-02-24 03:39:08 -08:00
47d4ec5aef Fix #105011: Cannot remove user preset when its name is translated
The preset names were translated before building the UI. This meant
that the translated name was passed to the operator responsible for
deleting the preset file, instead of the original name.

Pull Request #105155
2023-02-24 12:00:19 +01:00
718f78cfca Sculpt: Fix #104618 (again).
SculptAttributeParams.stroke_only wasn't being
    applied to existing attributes properly.
2023-02-24 00:04:50 -08:00
cb7d450de6 Sculpt: Fix 104618: Topology automasking errors
Sculpt island tags are now invalidated whenever the PBVH
    is rebuilt.
2023-02-24 00:04:03 -08:00
0534fff5ab Sculpt: fix 104174, clicking over empty space always pushes undo.
This was actually caused by two problems.  The first is that the
    code actually deliberately detects if nothing happened and pushed
    an undo step, a bugfix for a problem that no longer exists.

    The second was that SCULPT_test_location sometimes does a closest
    point search instead of ray casting and didn't check the result
    against the brush radius.
2023-02-24 00:01:41 -08:00
e9bb3510a1 Sculpt: Fix #104475, data transfer not respecting vgroup for float colors
This might've been a merge error, the result of color mixing
    was being overwritten by a simple copy of source to destination
    inside of layerCopyValue_propcol.
2023-02-24 00:00:22 -08:00
2491cd5e16 Cleanup: Move two subdiv headers to C++ 2023-02-23 18:30:47 -05:00
cfb112edcb UI: Widen Search Boxes When Necessary
Make floating search boxes wider when there is a linked scene or are
otherwise showing more information than a simple list.

Pull Request #104603
2023-02-24 00:07:16 +01:00
470e8ce1f4 BLF: Revert Glyph Clipping Changes
Revert #104679. We are just too used to the old behavior, especially
the incorrect vertical clipping. Some uses rely on setting the min and
max of the clipping rect the same. Will have to revisit this later
to only correct for horizontal positioning for full hinting.

Pull Request #105157

Own Code.
2023-02-23 23:44:17 +01:00
1b72712283 Fix: Global buffer overflow of enum property items on startup
RNA enum items arrays need to end with a null entry.
2023-02-23 15:53:10 -05:00
5b1f94f05a Fix: Use of uninitialized mesh size variables after recent cleanup 2023-02-23 15:52:42 -05:00
c065e8dd7f Merge branch 'blender-v3.5-release' 2023-02-23 15:31:29 -05:00
f9f29eefc7 Fix #105150: Mesh.vertex_colors.new() returns existing active layer
In 6514bb05ea I misinterpreted the function's intended
behavior when there was already an existing active layer. The data from
the active layer is just meat to be copied, the function should always
add a new attribute.
2023-02-23 15:30:27 -05:00
2bd097a58d Fix: Debug build failure and warnings after recent cleanup commit 2023-02-23 13:21:24 -05:00
4369627e71 Mesh: replace 'BKE_mesh_merge_verts' algorithm
Blender currently has 2 algorithms for merging vertices:
- `BKE_mesh_merge_verts`;
- `blender::geometry::create_merged_mesh`

`BKE_mesh_merge_verts` has a simplified algorithm to work with Array,
Mirror and Screw modifiers. It doesn't support merge results that would
create new faces. However it has shortcuts to be more efficient in
these modifiers.

`blender::geometry::create_merged_mesh` tries to predict all possible
outcomes. So it's a more complex. But it loses in performance to
`BKE_mesh_merge_verts` in some cases.

The performance comparison between these two depends on many factors.
`blender::geometry::create_merged_mesh` works with a context that has
only the affected geometry. Thus a smaller region of the mesh is read
for duplicate checking. Therefore, the smaller the affected geometry,
the more efficient the operation.

By my tests `blender::geometry::create_merged_mesh` beats
`BKE_mesh_merge_verts` when less than 20% of the geometry is affected
in worst case `MESH_MERGE_VERTS_DUMP_IF_EQUAL` or 17% in case of
`MESH_MERGE_VERTS_DUMP_IF_MAPPED` .

For cases where the entire geometry is affected, a 30% loss was noticed,
largely due to the creation of a context that represents the entire mesh.

Co-authored-by: Germano Cavalcante <germano.costa@ig.com.br>
Pull Request #105136
2023-02-23 19:10:01 +01:00
8e50539f1b Merge branch 'blender-v3.5-release' into main 2023-02-23 17:26:52 +01:00
a1f899754b Fix #105106: inconsistent order of settings in 3D viewport shading popover
Put compositing settings at the bottom for both Cycles and Eevee.
2023-02-23 17:24:45 +01:00
b88428a301 Fix: Frame Channel when using normalized view
When using the frame channel operators from #104523
the framing would fail under the following circumstance.
* In the graph editor
* Using normalized view
* with a curve that has a y-extent of less than the focus threshold of 0.01

The issue was the the clamping code was
before the normalization multiplication.

Pull Request #105121
2023-02-23 17:23:03 +01:00
8a8c1988bd Fix: Using "Frame Channel" in Dope sheet resets view to top
When using the "Frame Channel" operator in the Dope Sheet
the view would always go back to the top.

Fix it by copying the y bounds when in the Dope Sheet.

Pull Request #105123
2023-02-23 17:17:26 +01:00
cb62ab5b28 Cleanup: Access mesh edges, faces, and loops with spans
Using spans instead of raw pointers helps to differentiate ararys from
pointers to single elements, gives bounds checking in debug builds, and
conveniently stores the number of elements in the same variable.

Also make variable naming consistent. For example, use `loops` instead
of `mloop`. The plural helps to clarify that the variable is an array.

I didn't change positions because there is a type mismatch between
C and C++ code that is ugly to manage. All remaining code can be
converted to C++, then that change will be simpler.

Pull Request #105138
2023-02-23 17:14:03 +01:00
a74fd9f2ae Cleanup: Remove unnecessary copying of mesh data outside CustomData
This code seems to be left over from before edges, polys, and loops were
stored in CustomData. They are already copied by the CustomData copy
calls directly above, which already deal with every other layer.
2023-02-23 17:14:02 +01:00
1851a69014 Merge branch 'blender-v3.5-release' 2023-02-23 15:57:34 +01:00
763f1897c2 Fix #103865: keep IDProperties overridable when setting them with Python
Previously, the overridable status was lost when assigning a new value
to a custom property.

Pull Request #105130
2023-02-23 15:55:42 +01:00
6403bc28cd Merge branch 'blender-v3.5-release' 2023-02-23 15:16:33 +01:00
e2f0a63e55 Fix #105118: Wrong point size in sculpt density overlay
Missed the GPU_program_point_size call in acd5889e50
2023-02-23 15:15:35 +01:00
25a5ff7670 Merge branch 'blender-v3.5-release' into main 2023-02-23 14:57:40 +01:00
afd0ab5cce Vulkan: Initial VKUniformBuffer.
Only supports uploading data to a uniform buffer.
Requirement for push constants #104880.

Pull Request #105129
2023-02-23 14:51:34 +01:00
f5c0b2433f Vulkan: Resolve Builtin Uniform(Block).
Resolving builtin uniforms and uniform blocks when creating
shader interface. This maps builtin uniforms to uniforms
defined by the shader. Works the same as the OpenGL
builtin uniforms.

Pull Request #105128
2023-02-23 14:50:49 +01:00
dc9e0f300e GPU: Fix Potential Error in Builtin Resolution.
When using ShaderCreateInfo with builtin uniform(blocks) there are
cases where the current implementation could not find an existing
block. The reason is that it uses name matching and name matching
requires that the shader inputs are sorted based on the name hash.

This change fixes this by first for the sorting of the shader
inputs before resolving the builtins.

Pull Request #105127
2023-02-23 14:40:40 +01:00
4bfe4e5d49 Fix: Cycles display without OpenColorIO not working for Metal
Cycles fallback display shader previously did not use viewport.
This would crash or cause the display not to show when using
GPU backends other than OpenGL, if another display shader
was unavailable.

Now use ShaderCreateInfo for Cycles fallback display.

Authored by Apple: Michael Parkin-White

Ref #96261

Pull Request #104987
2023-02-23 14:25:08 +01:00
90f5b2f0ce Vulkan: Get access to physical device limits.
This patch will give access to the physical device limits
of the device associated with the context. In vulkan each
device has different limits and the application is
responsible to match these limits as the vulkan driver
just ignores calls that don't match these limits.

Those limits are GPUBackend specific and therefore are not
added to GPU_capabilities.

Pull Request #105125
2023-02-23 13:47:29 +01:00
fcdfc0a85b Fix #105089: Curves sculpt add creates invalid resolution
If the resolution attribute exists, it needs to be set to a non-zero
value for the newly added curves. While it might also make sense
to interpolate the value from neighbor curves, for now it's
simplest to just set it to the default value of 12.

Pull Request #105094
2023-02-23 13:46:39 +01:00
78a54f23db Merge branch 'blender-v3.5-release' 2023-02-23 13:30:53 +01:00
059ba28b29 Fix #105026: Texture space operators in transform menu
In curves edit mode, the "Move Texture Space" and "Scale Texture Space"
operators where shown in the "Curves > Transform" menu.

Since these are not implemented, the fix removes these operators
from the menu.
2023-02-23 13:30:15 +01:00
be777c9657 Fix: remove unnecessary assert
The code below has to handle the case when `sample_length` is greater
or equal to the total length already anyway, so we can just make that
a valid input. Currently, the snake hook brush for curves also makes
use of passing in larger sample lengths which current results in crashes
in debug builds.
2023-02-23 13:18:05 +01:00
e2ba7f902d Merge branch 'blender-v3.5-release' 2023-02-23 13:15:44 +01:00
2e7bd1dfb1 Fix #105044: Crash when rotating hair curves
When trying to rotate in curves edit mode using proportional editing
and connected only mode, Blender would crash.

This was because the `TransData` structs for disconnected elements
did not have the location field populated, resulting in a null pointer
access.

The fix skips these elements entirely using `TD_SKIP`.
2023-02-23 13:14:00 +01:00
f93f743ffc Fix #105043: Add shortcut for proportional editing 2023-02-23 12:24:23 +01:00
061d191677 Fix #105043: Add shortcut for proportional editing 2023-02-23 12:21:39 +01:00
c8ed48d5ca Merge remote-tracking branch 'origin/blender-v3.5-release' 2023-02-23 11:28:02 +01:00
f2250b7a5b Fix #105078: Regression: Memory leak in driver UI drawing code
Just a missing call to `MEM_freeN()`.

The issue was introduced in c592bff047.
2023-02-23 11:22:04 +01:00
482fb791ce Fix #105100: Metal using wrong kernels in multi-pass renders
This fixes issue [#105100](blender/blender#105100) where multi-pass renders can be incorrect due to kernels using stale specialisation constants (e.g. when rendering Pokedstudio).

This patch adds a new group of md5 hashes (`global_defines_md5`) to track whether the injected block of #defines is stale and regenerate the source string as appropriate. It also renames the existing group of md5 hashes from `source_md5` to `kernels_md5` to clarify that these refer to a specific kernel set rather than just the source (which might build an arbitrarily large number of kernel sets).

Pull Request #105103
2023-02-23 11:07:28 +01:00
4cd00b1a71 Merge branch 'blender-v3.5-release' 2023-02-23 10:44:54 +01:00
e410fb4d3c Fix #105067: Error drawing Copy Rotation Constraint UI
The translation contexts module wasn't imported after c7611d61e8,
which caused an error and prevented some constraints' UI from being
displayed.

Pull Request #105095
2023-02-23 10:42:03 +01:00
7267682017 Animation: Paste Keys in Graph Editor with value offset
Extend the `GRAPH_OT_paste` operator with an enum to define the value offset.

Options are:

| Option              | Effect                                                                        |
| ------------------- | ----------------------------------------------------------------------------- |
| No Offset           | use the same key values as the copied keys                                    |
| Cursor Value        | align the leftmost key with the cursor value                                  |
| Current Frame Value | Evaluate the curve under the cursor align the leftmost key with it            |
| Right Key           | Align the rightmost key with the first key that is to the right of the cursor |
| Left Key            | Align the leftmost key with the first key that is to the left of the cursor   |

Pull Request #104512
2023-02-23 09:46:47 +01:00
8756671084 Animation: Add Slider operators to hotkey menu
Before that patch, the slider operators for the Graph Editor are not easily accessible since they don't have a hotkey.
This adds the "d" hotkey for the already existing slider operator menu.

Using the popup menu means that your last used operator will always be under the cursor, so it's quick to access.

Pull Request #104530
2023-02-23 09:29:18 +01:00
ddcf718640 Sculpt: Fix #104475, data transfer not respecting vgroup for float colors
This might've been a merge error, the result of color mixing
was being overwritten by a simple copy of source to destination
inside of layerCopyValue_propcol.
2023-02-22 23:31:44 -08:00
45731fd987 Refactor: Weight Paint Select Linked Faces
When implementing the operator to select linked vertices in weight paint mode, the new `AtomicDisjointSet` was used.
In order to keep the code consistent, and also prepare it to add things like Extending/Shrinking selection, the select linked faces logic was also updated.

It now also makes use of the `AtomicDisjointSet` by connecting all edges of each poly. In order to find connecting Faces you then have to check if edges of that poly share a connection.

Pull Request #104577
2023-02-23 08:26:32 +01:00
2c391f8877 GPU: Patch GPencil shader for metal support.
The stoke shader of grease pencil uses a geometry shader stage. Apple
devices don't support shaders with geometry shader stage. In the
OpenGL driver there was a pass-through implemented so it didn't fail.

When using the metal backend this needs to be solved more explicitly.
This change patches the grease pencil shader to support both the
backends supporting a geometry stage and those without.

Fixes #105059

Pull Request #105116
2023-02-23 08:26:01 +01:00
4eb90fc15c Sculpt: Fix #104618 (again).
SculptAttributeParams.stroke_only wasn't being
applied to existing attributes properly.
2023-02-22 23:04:53 -08:00
7f256e0d33 Sculpt: fix 104174, clicking over empty space always pushes undo.
This was actually caused by two problems.  The first is that the
code actually deliberately detects if nothing happened and pushed
an undo step, a bugfix for a problem that no longer exists.

The second was that SCULPT_test_location sometimes does a closest
point search instead of ray casting and didn't check the result
against the brush radius.
2023-02-22 22:37:28 -08:00
e497a50aa2 Merge branch 'blender-v3.5-release' 2023-02-22 21:03:17 +01:00
c760248fc5 Metal: Improve AMD EEVEE Performance
Complex EEVEE nodegraphs, particularly those combining
multiple principledBSDF shader nodes have a tendancy
to require a large number of simultaneous live registers
due to function call depth. In some instances, this
causes substantial performance drop and corruption if
the stack gets too large.

To mitigate this, splitting calls to closure_eval such
that only a single individual closure is evaluated in each
call reduces the number of live registers required. This
is preferred over using compound closure evaluation
functions which require a large amount of in-flight data.

Note that this is generally not more optimal, if the stack
does not spill, as there is an increased instruction count.
The specific trade-off depends on the exact architecture
in question. Hence, this is limited to AMD GPUs.

Authored by Apple: Michael Parkin-White

Ref #96261
Pull Request #104985
2023-02-22 20:57:24 +01:00
8693f1fdd2 Merge branch 'blender-v3.5-release' 2023-02-22 13:36:04 -05:00
defd95afcd Win32: Auto-Raise and -Focus Windows on Hover
On the Windows platform, raise windows and give them focus as the mouse
hovers over them. This allows keyboard shortcuts for the area under the
mouse without having to click the window caption to make them active.

Pull Request #104681
2023-02-22 10:26:43 -08:00
11766574a4 Fix #104842: Incorrect cyclic curve parameter node factor
66dda2b902 made an incorrect change to account for the special
case for NURBS. Instead, make the step that turns the lengths into
parameters more explicit, and pass the correct total length for each
curve, even in the cyclic case.

Pull Request #105079
2023-02-22 13:16:30 -05:00
8b45f583a2 Fix: No default for NURBS weights in realize instances and join nodes
This resulted in disappearing NURBS curves when joining them with other
curve types in some cases. The attribute has to be handles similarly to
the radius and resolution attributes rather than as simple generic data.
2023-02-22 13:10:29 -05:00
4ba73b50d0 Fix: Set curve type node creates unnecessary nurbs weight attribute
The attribute was retrieved when converting to Bezier curves when it
wasn't necessary. Instead copy it like a regular attribute if any of the
result curves are NURBS. Also fix a check for an empty span for the
attribute which was never false.
2023-02-22 13:10:29 -05:00
54fa3b124f BLF: Glyph Clipping Corrections
Improvements to how glyphs are tested against the font clipping rect.

Pull Request #104679
2023-02-22 10:00:37 -08:00
967662eda4 Merge branch 'blender-v3.5-release' 2023-02-22 18:50:54 +01:00
6466c247c9 Fix: Overlay regression after d165d6aa2a 2023-02-22 18:50:04 +01:00
acd5889e50 Fix #105042: Regression: Sculpt density overlay not working
Fix regression after d165d6aa2a
2023-02-22 18:49:47 +01:00
915e436574 Merge branch 'blender-v3.5-release' 2023-02-22 18:43:17 +01:00
423291eaf2 Fix #102882: Geometry Nodes: crash when using viewer in invalid group
Invalid node trees (e.g. when nodes are linked in a cycle) can not be
evaluated and the viewer is not available in them. This commit just adds
some null checks to handle this case more gracefully.
2023-02-22 18:42:15 +01:00
775b51a847 Merge branch 'blender-v3.5-release' 2023-02-22 17:38:59 +01:00
cbb4f8a9ba UI: Add color selector to Bone Groups list
Expose the color selector on each item in the list, so it's easier to see
at a glance the Bone Groups color theme and change it.

Also avoids having color widgets grayed out when not in Custom Colors mode.

Pull Request #105036
2023-02-22 17:34:44 +01:00
18614b6b0b Fix #103269: node group asset description not showing as tooltip in the Add menu
Pull Request #104968
2023-02-22 17:33:04 +01:00
Sonny Campbell
1b7076bd4f USD import: extract read_mesh params into a struct.
This is a small initial refactor to extract the
USDGeomReader::read_mesh parameters into a separate struct.
This will allow for adding extra parameters to handle importing
velocities for #104462 which was brought over from

https://archive.blender.org/developer/D15430

Original patch was being reviewed here:

https://archive.blender.org/developer/D15435

Pull Request 104459
2023-02-22 11:22:48 -05:00
d58e422ac3 UI: Properly cancel dragging on escape or right-click
This is refering to drag & drop within Blender which is using the
drop-box system.

Previously Escape would cancel the dragging, but still pass on the event
to other event handlers, which could trigger other behavior. For example
cancelling dragging a file in a file browser dialog would also cancel
the file browser operation and close the window. Right-click didn't
cancel anything even though we usually use both Escape and right-click
as a way to cancel the operation.

Now both escape and right-click both cancel the dragging and the event
is not passed on further.

Pull Request: #104838
2023-02-22 16:54:07 +01:00
11f52a4017 Cleanup: Remove wrapper functions in spline parameter node
Do the domain check directly in the field input class to avoid the need
for another function to do it elsewhere. Also move one function to
be closer to a similar one, rename some functions, and avoid the need
for two intermediate span variables.
2023-02-22 10:41:11 -05:00
629fe69c4c Fix #104918: EEVEE: Resolve cache warming assertion.
Erroneous cache warming case where the generated material is
identical to default material and cached shader is re-used,
resulting in case where the parent shader is identical to the
source.

Authored by Apple: Michael Parkin-White

Ref #96261
2023-02-22 16:37:00 +01:00
d6a61bc864 Merge branch 'blender-v3.5-release' 2023-02-22 15:27:57 +01:00
acfafeed88 Fix #103761: creating a color attribute doesn't make it active
Originally caused by 6514bb05ea

More cases where the active/default color attributes were not set
correctly:

[1] Using the old Python vertex_colors API (vertex_colors.new)
[2] OBJ importer
[3] Collada importer
[4] Data Transfer layout (both standalone operator and "Generate Data
    Layers" from the modifier)

Similar to 101d04f41f.

Brought over from https://archive.blender.org/developer/D16977, see
discussion there why some of the code for data transfer is not for the
genereal attribute API.

Pull Request #105020
2023-02-22 15:18:15 +01:00
8c03410ebd Vulkan: Refactor shader interface.
Descriptor set locations are now determined in the
VKShaderInterface. Issues with the previous solution:

- Due to legacy code in GPU module the locations/bindings
  must be the same. Using one for something else might
  result in undesired lookups, incorrect resource
  bindings.
- Images/Textures reuses the same namespace, that didn't
  work as expected when looking up the resources via
  its binding.

This refactoring is required for adding support for
push constants.

Pull Request #105073
2023-02-22 14:42:01 +01:00
709013dca4 Cleanup: Move rna_access.c to C++
See #103343

Pull Request #105060
2023-02-22 14:04:57 +01:00
140a663f6f Cleanup: Move area.c to C++
See #103343

Pull Request #105061
2023-02-22 14:04:23 +01:00
e1f6587f12 VSE: Add retiming tool
This tools allows to change strip playback speed by manipulating
retiming handles. More handles can be added to single strip to create
variable playback speed.

This tool replaces Speed Factor property in time panel, with exception
of sound strips. Support for sound strips is still in review.

Pull Request #104523
2023-02-22 13:16:32 +01:00
50ebe21dd3 Merge branch 'blender-v3.5-release' 2023-02-22 11:37:42 +01:00
e5a0a14a27 Fix #101518: Curves sculptmode Stabilize Stroke misses indicator line
Drawing code `paint_draw_smooth_cursor` would be called correctly, it
was just the color not being initialized.

This is usually done with `BKE_paint_init`, but in the case of curves
sculpting brushes this would create an additional (unnamed) brush which
should be avoided since the workspace toolsystem creates the "right"
brush anyways.

So this patch just does the minimal work to get the Stabilize Stroke
indicator line to draw (which is initializing the color).

Brought over from https://archive.blender.org/developer/D16793

(cherry picked from commit 612a4382c443bcd02e0bb5ffd1b1fdbb251f6e7b)

Pull Request #105021
2023-02-22 11:31:40 +01:00
ad124d15e2 Merge remote-tracking branch 'upstream/blender-v3.5-release' 2023-02-22 10:05:03 +01:00
14368f4d09 Fix/Update to the i18n module settings after git submodule changes. 2023-02-22 10:02:27 +01:00
612965497e Curves: Avoid unnecessary allocation when calculating offsets
Arrays for curve handle types were allocated even when there were no
Bezier curves. This saves 0.5ms of the total 0.9ms spent creating the
evaluated curve offsets, which happens every time the topology
of non-poly curves change.
2023-02-21 22:32:36 -05:00
05637254da Cleanup: Use simpler syntax to return panel open status 2023-02-21 21:45:41 -05:00
8b63966236 Revert 104438: Windows Spanning Multiple Monitors
Revert of commits that allowed non-temp Blender windows to be saved
and restored that spanned multiple monitors on the Windows platform.
This causes problems with temp windows (like Preferences & Render) that
cannot currently be fixed.

See 104956 for much more details.

This change is being redone after it was accidentally reverted.

Differential Revision: blender/blender#104956

Reviewed by Ray Molenkamp
2023-02-21 15:45:45 -08:00
b874a0ead8 msgfmt: fix runtime requirements
msgfmt has a TBB dependency though bf_blenlib, now for a release build
The MSVC linker is smart enough to realize none of the TBB code is
actually used and discards it. In debug mode the linker is a bit more
conservative and doesn't, leaving msgfmt with a runtime dependency
on TBB. The problem here is, we only copy the runtime dlls during
the install phase, and msgfmt runs long long before that.

For this reason when we run msgfmt we should make sure any runtime
needs it could have are met in the path, there already is a handy
variable for that since oslc has similar requirements.

Pull Request #105048
2023-02-21 23:00:34 +01:00
7216eb8879 UI: UIList Hover Highlighting
Add mouse hover highlighting for items in UILists, in both list mode
and preview tile mode.

See 104677 for more details

Differential Revision: blender/blender#104677

Reviewed by Brecht Van Lommel
2023-02-21 13:03:17 -08:00
ac160a270f Merge branch 'blender-v3.5-release' 2023-02-21 19:29:13 +01:00
6693c50ace Fix #104947: Missing depsgraph update on UV map deletion
Since changing UV map deletion to be handled via the attribute api,
the object wasn't tagged for depsgraph updating.

Pull Request #105040
2023-02-21 19:27:23 +01:00
e82d4f1f93 Merge branch 'blender-v3.5-release' 2023-02-21 18:41:43 +01:00
e28a9a87c9 Fix references to the /release/scripts directories
Those were moved to the /scripts
2023-02-21 18:40:47 +01:00
720dbea429 Fix #104902: Use forward compatible integers for boolean RNA properties
Write RNA properties backed by IDProperties with the `IDP_INT` type like
before ef68a37e5d. That keeps forward compatibility, because
earlier versions don't support the boolean type. At some point in a future
release we can remove the forward compatibility. 4.0 is a good time to
do that because forward compatibility will be broken in other ways.

This commit also adds support for reading integer arrays for boolean
property defaults, which was only half-way supported before.

Pull Request #104995
2023-02-21 11:59:15 -05:00
1b96dd535a Merge branch 'blender-v3.5-release' 2023-02-21 17:20:34 +01:00
d355f3ed2b Cleanup: Spelling in warning message 2023-02-21 17:20:03 +01:00
78825783cc Merge branch 'blender-v3.5-release' 2023-02-21 17:18:47 +01:00
144f74230f Make update: Fix empty message of "Blender repository skipped" 2023-02-21 17:17:46 +01:00
ade37c0212 Merge branch 'blender-v3.5-release' into main 2023-02-21 17:13:43 +01:00
46153f1898 Fix #104899: Gpencil rotation of dots fails using subdivision
The values were not calculated in the subdivision modifier.
2023-02-21 17:12:27 +01:00
996eb1bd5f Cleanup: Remove unused UV map deletion functions
The attribute API is now used instead.
2023-02-21 10:53:29 -05:00
7fe42ea566 Merge branch 'blender-v3.5-release' 2023-02-21 16:50:35 +01:00
dd65e9901f Fix Light Tree option causing wrong renders on macOS AMD
The light tree itself is disabled on the AMD GPUs due to a compiler issue.

There are couple of places where this was not fully checked:

- The `light_sample` function in the kernel.
- The light threshold during synchronization

The former one is solved as easy as just adding an ifdef block.
The latter one is solved by delaying the threshold assignment for
later on.

Pull Request #105022
2023-02-21 16:50:06 +01:00
b02778147d Merge branch 'blender-v3.5-release' 2023-02-21 10:46:45 -05:00
d1b6f16906 Fix #104980: Apply All Shape Keys operator not working
Caused by inverted arguments to `memcpy` in 1af62cb3bf.
Replace with use of spans to make the copying direction more obvious.
2023-02-21 10:43:15 -05:00
ecb88eff7e Merge branch 'blender-v3.5-release' 2023-02-21 16:41:47 +01:00
03806d0b67 Re-design of submodules used in blender.git
This commit implements described in the #104573.

The goal is to fix the confusion of the submodule hashes change, which are not
ideal for any of the supported git-module configuration (they are either always
visible causing confusion, or silently staged and committed, also causing
confusion).

This commit replaces submodules with a checkout of addons and addons_contrib,
covered by the .gitignore, and locale and developer tools are moved to the
main repository.

This also changes the paths:
- /release/scripts are moved to the /scripts
- /source/tools are moved to the /tools
- /release/datafiles/locale is moved to /locale

This is done to avoid conflicts when using bisect, and also allow buildbot to
automatically "recover" wgen building older or newer branches/patches.

Running `make update` will initialize the local checkout to the changed
repository configuration.

Another aspect of the change is that the make update will support Github style
of remote organization (origin remote pointing to thy fork, upstream remote
pointing to the upstream blender/blender.git).

Pull Request #104755
2023-02-21 16:39:58 +01:00
92dc89e28a Fix tests for macOS storage_apple.mm functions.
Pull Request #105000
2023-02-21 16:06:42 +01:00
6a5caf9d88 Vulkan: Fix mismatch in shader and resource types. 2023-02-21 15:36:11 +01:00
e9f8020f75 Cleanup: added empty line between methods. 2023-02-21 15:36:11 +01:00
a55e38e05d Fix duplicated code after merge from release branch
a280554b75 was committed to fix this in main, b5fa180d5d for the release
branch. Only one is needed though :)
2023-02-21 15:27:51 +01:00
7fb1f060ff Vulkan: Initial Compute Shaders support
This patch adds initial support for compute shaders to
the vulkan backend. As the development is oriented to the test-
cases we have the implementation is limited to what is used there.

It has been validated that with this patch that the following test
cases are running as expected
- `GPUVulkanTest.gpu_shader_compute_vbo`
- `GPUVulkanTest.gpu_shader_compute_ibo`
- `GPUVulkanTest.gpu_shader_compute_ssbo`
- `GPUVulkanTest.gpu_storage_buffer_create_update_read`
- `GPUVulkanTest.gpu_shader_compute_2d`

This patch includes:
- Allocating VkBuffer on device.
- Uploading data from CPU to VkBuffer.
- Binding VkBuffer as SSBO to a compute shader.
- Execute compute shader and altering VkBuffer.
- Download the VkBuffer to CPU ram.
- Validate that it worked.
- Use device only vertex buffer as SSBO
- Use device only index buffer as SSBO
- Use device only image buffers

GHOST API has been changed as the original design was created before
we even had support for compute shaders in blender. The function
`GHOST_getVulkanBackbuffer` has been separated to retrieve the command
buffer without a backbuffer (`GHOST_getVulkanCommandBuffer`). In order
to do correct command buffer processing we needed access to the queue
owned by GHOST. This is returned as part of the `GHOST_getVulkanHandles`
function.

Open topics (not considered part of this patch)
- Memory barriers & command buffer encoding
- Indirect compute dispatching
- Rest of the test cases
- Data conversions when requested data format is different than on device.
- GPUVulkanTest.gpu_shader_compute_1d is supported on AMD devices.
  NVIDIA doesn't seem to support 1d textures.

Pull-request: #104518
2023-02-21 15:04:52 +01:00
02c2970983 Cycles: add NanoVDB support for Metal on Apple Silicon
Contributed by Yulia Kuznetcova at Apple.

NanoVDB is patched to give add address spaces required by Metal. We hope that
in the future Metal will support the generic address space.

For AMD and Intel this is currently not available since it causes a performance
regression also on scenes without volumes.

Pull Request #104837
2023-02-21 15:03:52 +01:00
8b8d8acc84 Merge branch 'blender-v3.5-release' 2023-02-21 08:45:46 -05:00
3e721195b0 Fix #104975: Essentials assets missing from node link-drag search
Alternatively this could use `ASSET_LIBRARY_ALL` like
`add_node_search.cc`, but then it would need a different
method for skipping duplicate local assets.
2023-02-21 08:44:52 -05:00
b5fa180d5d Fix: Missing essentials path in internal assets function 2023-02-21 08:42:02 -05:00
68a8f96cca Merge branch 'blender-v3.5-release' 2023-02-21 13:21:13 +01:00
2fef2f707a Fix: Unable pick select first point/curve in Curves
Because of an off-by-one error, it was not possible
to select the fist point or curve using the pick_select
operator in the Curves object.
2023-02-21 13:20:47 +01:00
a280554b75 Fix new essentials asset library not being covered in library path query 2023-02-21 12:20:09 +01:00
a91c6e71db Brush: Add writing and reading ID preview for Brushes.
Mandatory change for the Brush Assets project, from quick test does not
seem to break anything (more) in existing 'old' brushes...

Re. #101908.

Pull Request #105016
2023-02-21 12:15:33 +01:00
fdf6252b5a Merge branch 'blender-v3.5-release' 2023-02-21 12:04:30 +01:00
6583acb880 Fix Cycles MetalRT access of macOS 11 features when unavailable
After recent changes in 2d994de.

Pull Request #104976
2023-02-21 12:03:21 +01:00
6eccea7a6f Gitea: more updates for new scoped label syntax 2023-02-21 11:16:52 +01:00
5b0cb65a56 Gitea: update for new scoped label syntax 2023-02-21 11:13:22 +01:00
8a135a9a5f Curves: Add cursor snapping support
This adds support for cursor snapping for the new curves object.

It implements a function `transverts_from_curves_positions_create` (to separate the logic from the `Curves` object type). That function is then C wrapped by `ED_curves_transverts_create` and finally used in `ED_transverts_create_from_obedit`.

Pull Request #104967
2023-02-21 11:04:40 +01:00
ad7f8a1fa5 Merge branch 'blender-v3.5-release' 2023-02-21 11:02:30 +01:00
33cbd063d3 Curves: Fix proportional editing not working
This adds proper support for proportional editing for the Curves object.

Co-authored-by: Hans Goudey <h.goudey@me.com>
Pull Request #104620
2023-02-21 11:01:30 +01:00
e1b58be9e2 Merge branch 'blender-v3.5-release' 2023-02-21 10:17:13 +01:00
5db40f5747 Cleanup: Mark overriden virtual call as such
Fixes the `-Winconsistent-missing-override` warning.

In theory the `virtual` is redundant in such case, but this is how
it is done in may other areas of USD code.

Pull Request #104977
2023-02-21 10:16:30 +01:00
c38cac9682 Merge branch 'blender-v3.5-release' into main 2023-02-21 10:05:50 +01:00
f1f3ff0237 Fix #104979: GPencil Dot-hash only affects first frame with Time mod
The active frame must be recovered using `BKE_gpencil_frame_retime_get`
2023-02-21 10:04:45 +01:00
4ab91dc0c9 Fix: Channel clamping when markers are used
Previously when markers were used, the newly introduced clamping code (#104516) would stop the last channel from being shown.

This patch fixes that by modifying the `v2d->tot.ymin` calculation.

This is a bit counterintuitive since the `v2d->tot` height is calculated in `action_draw.c`. But the advantage of doing it there is that it also works for the channels region.

Pull Request #104892
2023-02-21 09:23:59 +01:00
2d34a09043 Tests: Address imbuf_save failures on ARM64 builds
This does 2 things to address the ARM64 failures:
- Increases the threshold to be inline with what Cycles uses
- Disables the 2 problematic WebP variations (#105006 will track)
2023-02-20 21:36:19 -08:00
ece43dd716 Cleanup: format 2023-02-21 17:07:02 +13:00
7699c7407d Tests: Add tests for image format saving and loading
This adds saving and loading tests for our supported image formats.

**Saving - bf_imbuf_save.py**
There are 2 template images which are loaded anew for each file save
attempt.  One is an 8-bit RGBA image and the other 32-bit. This is
required as many formats use a variety of factors to determine which of
`ibuf->rect` or `ibuf->rectfloat` to use for processing.  The templates
are constructed to have alpha transparency as well as values > 1 (or
clamped to 1 for the case of the 8-bit template).

Test flow:
 - Load in an appropriate template image
 - Save it to the desired format with the desired set of options
 - Compare against the reference image

Notes:
 - 98 references are used totaling ~3.6MB
 - 10-12 second test runtime
 - Templates can be reconstructed with the create-templates.blend file

**Loading - bf_imbuf_load.py**
Test flow:
 - Load in each of the reference images
 - Save them back out as .exr
 - Save additional metadata to a secondary file (alpha mode, colorspace etc)
 - Compare the saved out .exr with another set of reference .exrs
 - Compare the saved out file metadata with set of reference metadata

Notes:
 - 98 exr references are used totaling ~10MB
 - 10-12 second test runtime as well

A HTML report is not implemented. The diff output organization is very
similar to the other tests so it should be somewhat easy to do in the
future if we want.

The standard set of environment variables are implemented for both:
BLENDER_TEST_UPDATE, BLENDER_VERBOSE, and BLENDER_TEST_COLOR

Pull Request #104442
2023-02-20 19:06:38 -08:00
ff3fd5f1ce Sculpt: Implement mesh filter cancel
Added new function sculpt_mesh_filter_cancel in sculpt_filter_mesh.cc
for cancelling mesh filters. It currently is unused pending a
revamped modal map for mesh filter (see pull req 104718).
2023-02-20 18:09:05 -08:00
3e049973ee BMesh: fix invalid existence check in BM_mesh_bm_to_me
Remember that the null customdata layer index is -1,
not 0.
2023-02-20 17:46:45 -08:00
07ae1feed2 Fix test
Pull Request #104934
2023-02-20 23:04:10 +01:00
ba6c9a6f59 BLI_math: fix parameter aliasing in mul_m3_series and mul_m4_series
No functional changes.
2023-02-20 23:04:10 +01:00
7c1e26dd64 Merge branch 'blender-v3.5-release' 2023-02-20 21:24:48 +01:00
5a86193b1c Fix #82936: Make Geometry Nodes modifier icon blue in outliner
In the outliner, the icons for modifiers are tinted blue. This didn't
work for the geometry nodes modifier icon.

Defining the icon with the macro `DEF_ICON_MODIFIER` also
defines the appropriate theme color so it's now tinted blue
when drawn in the outliner like the other modifier icons.

Pull Request #104957
2023-02-20 21:22:11 +01:00
cc925b9282 Nodes: Allow adding multiple search items per type in add menu
Add a per node type callback for creating node add search operations,
similar to the way link drag search is implemented (11be151d58).

Currently the searchable strings have to be separate items in the list.
In a separate step, we can look into adding invisible searchable text
to search items if that's still necessary.

Resolves #102118

Pull Request #104794
2023-02-20 19:17:03 +01:00
DESKTOP-ON14TH5\Sonny Campbell
ceba1854f9 BLI: add function for changing working directory
Add `BLI_change_working_dir(path)` to change the current working directory.

This change is required for adding USDZ support to Blender. When exporting to that format, we are required to do a weird change of directory because of a quirk with the USD library's USDZ functionality. If an absolute filepath is passed into the `UsdUtilsCreateNewUsdzPackage` function, the USDZ archive will store that full path.

macOS uses `NSFileManager` through some new Mac-only wrapper functions.

Ref #99807

Pull Request #104525
2023-02-20 15:58:38 +01:00
8abef86217 Merge branch 'blender-v3.5-release' 2023-02-20 15:37:02 +01:00
c7d7175270 Cleanup: Remove check for this pointer not being nullptr
The check was triggering the 'this' pointer cannot be null in
well-defined C++ code

We do not check for this pointer in any other areas. If it is
needed due to possible opaque pointer cast to the check prior
to the cast.

Pull Request #104974
2023-02-20 15:35:24 +01:00
9b7eb57cf7 Merge branch 'blender-v3.5-release' 2023-02-20 15:33:44 +01:00
46b9dbc3f8 Cleanup: Remove unused fields from ShadowPunctual
Pull Request #104973
2023-02-20 15:32:06 +01:00
5a85b62bbc Transform Gizmo: calculate matrix_offset when creating the gizmos
That way the `matrix_base` doesn't need to depend on the axis
simplifying the code.

This also fixes an issue in plane scaling gizmos with non-orthogonal
matrix.
2023-02-20 11:28:11 -03:00
82ab491ab5 Merge branch 'blender-v3.5-release' 2023-02-20 12:59:47 +01:00
5fd4d47206 Fix unused variable warnings in release build
The asserts are not needed in this case. Basically includes 77c273ee37,
but in the release branch there was a second one.
2023-02-20 12:56:12 +01:00
e55f8b0b52 Merge branch 'blender-v3.5-release' 2023-02-20 12:47:13 +01:00
c7611d61e8 I18n: add disambiguation contexts
After rBdb87e2a638f9, two contexts were missing:

- VirtualReality, to be used in an add-on
- Constraint, used in the constraints UI

The latter was actually used without being added, which caused errors.
It was reverted in rB31a640027982.
2023-02-20 12:45:00 +01:00
f2121d94bb I18n: make some boid physics messages translatable
A few UI messages were not extracted in the particle physics panels.
2023-02-20 12:32:12 +01:00
79c1dc65a7 I18n: write messages of the vertex group lock operator explicitly
The operator's description used a format string like:

```
BLI_sprintfN(TIP_("%s %s vertex groups of the active object"),
             action_str, target_str)
```

which is almost guaranteed to be impossible to properly localize to
some languages -- I know there are a couple of issues for French
already.

So instead of hoping formatting works, write all possible strings
explicitly, even if it looks stupidly verbose.
2023-02-20 12:22:52 +01:00
dfbbf411d9 Merge branch 'blender-v3.5-release' 2023-02-20 12:13:14 +01:00
248d81fcbf GPencil: Include UV information in simplify->sample modifier.
Simplify modifier sample mode didn't transfer UV parameters, now fixed.

(This is the corrected commit, previous one has multiple other commits merged.)

Pull Request #104964
2023-02-20 12:11:34 +01:00
c437a8aea8 Revert release branch only commit after merge
This is a revert of a revert, because the initial revert is only
supposed to be in the release branch.

This reverts commit 3eed00dc54.
2023-02-20 11:51:16 +01:00
74be1acc7a Merge branch 'blender-v3.5-release' 2023-02-20 11:35:11 +01:00
3eed00dc54 Revert "GPencil: Include UV information in simplify->sample modifier."
This reverts commit 19222627c6.

Something went wrong here, seems like this commit merged the main branch
into the release branch, which should never be done.
2023-02-20 11:20:07 +01:00
87e5d7212c Mac: Enable Metal as default gpu backend.
Currently Metal is more stable then the OpenGL backend on apple
devices. Also the Metal backend supports more features then the
OpenGL backend. For example the viewport compositor and rendering
of production files.

This has been validated with users and studios.

This patch will default to the Metal backend when starting
Blender 3.5 for the first time or when loading factory startup. It
is still possible to switch to OpenGL via the user preferences.

It will not automatically select the Metal backend when there is
already user preferences available for Blender 3.5.
2023-02-20 11:03:11 +01:00
c25c46b77b Merge branch 'blender-v3.5-release' 2023-02-20 10:56:00 +01:00
25e57c39b1 Fix 104920: crash when creating node group from script node 2023-02-20 10:49:55 +01:00
488a757c83 Icons: Minor maintenance for the icons source SVG
No design or functional changes. Just rename the layers for the last
two icons that were added so that they follow the naming pattern.
Also, update the layer order for another icon (was not alphabetic).

Pull Request #104954
2023-02-20 10:41:31 +01:00
74bf0c834b Python: Add scissor functions to gpu.state.
This is a missing part of the Metal backend. Metal backend doesn't
support the bgl commands, but it was not possible to use the gpu
module to use scissor testing.

Without this change addon developers would not be able to migrate
their addons to support the Metal backend.

This patch adds:
- `gpu.state.scissor_set`
- `gpu.state.scissor_get`
- `gpu.state.scissor_test_set`

Fix #104911
2023-02-20 09:13:20 +01:00
695b6e3ede Sculpt: Fix workflow issue VDM textures.
Texture clamping is by default off, but for VDM textures this leads
to several artifacts.
- Clamping is done when the image is sampled and when the brush strenght
  is applied.
- VDM textures have negative values that are lost due to clamping
  when clamping during sampling.

This patch fixes this by changing the default clamping of newly
created textures to not clamp anymore.

Textures are mostly being used by sculpt brushes, where clamping is also
implemented on brush level.

Fix #104747
2023-02-20 08:07:55 +01:00
e1e2dae317 Revert 104438: Windows Spanning Multiple Monitors
Revert of commits that allowed non-temp Blender windows to be saved
and restored that spanned multiple monitors on the Windows platform.
This causes problems with temp windows (like Preferences & Render) that
cannot currently be fixed.

See 104956 for much more detail

Differential Revision: blender/blender#104956

Reviewed by Ray Molenkamp
2023-02-19 19:28:08 +01:00
19222627c6 GPencil: Include UV information in simplify->sample modifier.
Simplify modifier sample mode didn't transfer UV parameters, now fixed.

Pull Request #104942
2023-02-19 11:45:22 +01:00
e61566137b Merge branch 'blender-v3.5-release' 2023-02-18 16:44:25 +11:00
46e13cf8a5 Fix #104817: Camera lens gizmo out of sync when navigating via gizmos
Regression in [0] which caused interacting with 2D gizmos not to
update 3D gizmos once the gizmo finished it's modal interaction.

This caused the cameras lens gizmo not to update when navigating using
the viewport navigation buttons.

Resolve by detecting this case and flagging other draw steps to be
updated.

[0]: fb27a9bb98
2023-02-18 16:38:36 +11:00
cc4587a9b4 Merge branch 'blender-v3.5-release' 2023-02-18 05:14:33 +01:00
5cd2be7d54 Fix #104806: Graphical glitches in VSE timeline region
Region background was drawn, but color was set to fully transparent.
2023-02-18 05:09:17 +01:00
be9104f7aa Cleanup: spelling, capitalize tags, use C-style comments & clarification 2023-02-18 14:33:28 +11:00
6bd058189c Cleanup: quiet mypy warnings 2023-02-18 14:22:34 +11:00
162e6c7951 Fix error in project_info when make wasn't found
The warning referenced an undeclared variable.
2023-02-18 14:21:56 +11:00
da9dff053e Build: fix error building xvidcore on Linux
The file renaming seems only to be needed on Windows,
so don't attempt it on other platforms.
2023-02-18 14:10:59 +11:00
d9398bb53f Fix #104188: Screw modifier edges invisible in edit mode wireframe view
Caused by 25237d2625, when the new "template" mesh created
in the modifier started to use the proper default value for CD_ORIGINDEX
layers rather than just zero. Zero isn't correct because it refers to
the first element, not "no element". For that we need to remove the
original index mapping arrays completely. There is some gray area
about whether that is allowed too, but it's best here to just keep the
old behavior working for now.
2023-02-17 16:24:49 -05:00
2ee5560b3f Spreadsheet: Add original indices to mesh debug information
Add the `CD_ORIGINDEX` layer to the columns potentially displayed
with the Blender debug value of 4001 from the debug menu. Also
separate the debug columns to separate functions.
2023-02-17 16:24:49 -05:00
2cd7e70c18 Fix #104604: Potential crash when relinking node links
In the first loop is safe to remove the current element.
The second loop can remove any element, potentially the next.
This triggers a read after freed.

Pull Request #104897
2023-02-17 21:23:35 +01:00
dd2ab55507 Fix 104816: Ensure Win32 visible title bar
When creating Win32 windows, ensure that the caption bar is visible.

Differential Revision: blender/blender#104848

Reviewed by Ray Molenkamp
2023-02-17 20:11:44 +01:00
8806d7551d Merge branch 'blender-v3.5-release' 2023-02-17 13:54:16 -05:00
8b416f7f60 Fix #104869: Crash converting UV maps to legacy format
When the new UV to legacy format conversion happens, the mesh is in
the middle of being written and is an at best "complicated", at worst
invalid state. The attribute API looks at other domains and is a bit
less forgiving in that respect, and shouldn't really be used here. Use
the CustomData API instead. Also sort the layers the same way as
b642dc7bc7.
2023-02-17 13:41:44 -05:00
d6774174e9 Fix compile error due to previous changes 2023-02-17 19:14:47 +01:00
4b6ce4512c Merge remote-tracking branch 'origin/blender-v3.5-release' 2023-02-17 18:50:52 +01:00
d891b38776 Fix #104850: Create Geometry Nodes operators fails if not in English
Note that the node group has its sockets names translated, while the
built-in nodes don't. So we need to use data_ for the built-in nodes
names, and the sockets of the created node groups.

Pull Request #104889
2023-02-17 18:49:36 +01:00
4ec9aff2af Revert "Fix #104850: Create Geometry Nodes operators fails if not in English"
This reverts commit 68181c2560.

I merged 3.6 into 3.5 by mistake. Basically I had a PR against main,
 then changed it in the last minute to be against 3.5 via the
 web-interface unaware that I shouldn't do it without updating the
 patch.

 Original Pull Request: #104889
2023-02-17 18:45:42 +01:00
68181c2560 Fix #104850: Create Geometry Nodes operators fails if not in English
Note that the node group has its sockets names
translated, while the built-in nodes don't.

So we need to use data_ for the built-in nodes names,
and the sockets of the created node groups.

Pull Request #104889
2023-02-17 18:39:17 +01:00
d7dd7ee24c Animation: Add "Frame Channel" operators
When animating it is often useful to frame the Graph Editor/Dope Sheet to whatever frames are in a given channel.
This patch adds the option to frame on selected channels OR frame on whatever channel is under the cursor.

If a preview range is set it will only focus on keys in that range.

Supports FCurve and keyframe data

Frame to selected is called with
* Right click in the channel section -> Frame Selected Channels
* or in Channel → Frame Selected Channels
* or hitting . on the numpad

Frame to channel under cursor is done with

ALT + Middle Mouse Button

Co-authored-by: Christoph Lendenfeld <chris.lenden@gmail.com>
Pull Request #104523
2023-02-17 18:10:58 +01:00
e95ba8a70e Nodes: Add 'Online Manual' to context menu
Finding the documentation for nodes can be time consuming.
By adding the online manual to the right click context menu in the node
editor the user gets easier access to the documentation.

Can also be used by custom nodes add-ons by registering a manual-map.

Pull Request #104833
2023-02-17 16:59:30 +01:00
a797c0c05c Merge branch 'blender-v3.5-release' 2023-02-17 16:44:32 +01:00
64189ea52f UI: "vertex keys" -> "shape keys"
These are generally referred to as "shape keys"

Pull Request #104887
2023-02-17 16:43:26 +01:00
0e4312ceec Merge branch 'blender-v3.5-release' 2023-02-17 16:33:59 +01:00
2753cc6e39 Fix: python error in Particle Properties without a psys
Code added in 94a54ab554 wasnt checking if there was a particle system
on the object at all.

Pull Request #104819
2023-02-17 16:32:37 +01:00
08f24553dc Cleanup: Remove accidentally merged TODO comment 2023-02-17 15:05:39 +01:00
9b129e5533 Fix #104347: Loop Cut Tool becomes impressive with GPU Subdivision
When updating a mesh, the GPU Subdivision code makes calls to
`GPU_indexbuf_bind_as_ssbo()`.

This may cause the current VAO index buffer to change due to calls from
`glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo_id_)` in
`GPU_indexbuf_bind_as_ssbo()`.

The solution is to unbind the VAO (by calling `glBindVertexArray(0)`)
before creating the index buffer IBO.

Co-authored-by: Germano Cavalcante <grmncv@gmail.com>
Pull Request #104873
2023-02-17 10:53:39 -03:00
7838eb12c6 Merge branch 'blender-v3.5-release' 2023-02-17 14:37:35 +01:00
54b1e71dda Make update: Allow amd64 architecture
Apparently, the 65bit Intel architecture is presented differently
on Linux and Windows.

Allow both variants for the command line, so that semantically the
command line argument can be seen as a lower case platform.machine.
2023-02-17 14:35:53 +01:00
69677827ff Fix #104347: Loop Cut Tool becomes impressive with GPU Subdivision
When updating a mesh, the GPU Subdivision code makes calls to
`GPU_indexbuf_bind_as_ssbo()`.

This may cause the current VAO index buffer to change due to calls from
`glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo_id_)` in
`GPU_indexbuf_bind_as_ssbo()`.

The solution is to unbind the VAO (by calling `glBindVertexArray(0)`)
before creating the index buffer IBO.

Co-authored-by: Germano Cavalcante <grmncv@gmail.com>
Pull Request #104873
2023-02-17 14:30:29 +01:00
42f636f7e8 Merge branch 'blender-v3.5-release' 2023-02-17 13:43:17 +01:00
60abeddc55 Make update: Add --architecture command line attribute
Possible values are x86_64 and arm64.

Allows to use make_update.py in a cross-compile environment, like
building x86_64 macOS Blender from Apple Silicon machine.

Pull Request #104863
2023-02-17 13:42:15 +01:00
cb95f8aea7 Animation: Clamp V2D so keyframes cannot go offscreen
In the Dope Sheet and the Timeline, it was possible to drag the view until the keyframes were completely out of view.
(Important to drag in the region with the keyframes, dragging in the channel box already did clamping)

This patch adds a clamping mechanism matching that of the channel box. That means the last channel will stick to the bottom of the view.

Co-authored-by: Christoph Lendenfeld <chris.lenden@gmail.com>
Pull Request #104516
2023-02-17 12:47:45 +01:00
d4480fdfa3 Merge branch 'blender-v3.5-release' 2023-02-17 11:45:49 +01:00
6ffaee8d9a Fix #95400: Crash when running Euler Filter on baked Curves
Fix a crash when using the Euler Filter from the Graph Editor on baked curves.

The crash happened because baked curves have no bezt array.
Skipping any curves where that was missing fixes the issue.

Co-authored-by: Christoph Lendenfeld <chris.lenden@gmail.com>
Pull Request #104858
2023-02-17 11:45:11 +01:00
bf7ccd43ca Cleanup: use PI and PI/2 in compatible_eul
3.2 and 1.6 where used as rough equivalents to M_PI & M_PI_2, however
this raised questions about the significance of these values.

Running thousands of tests with generated euler inputs I wasn't able to
detect a difference so use M_PI & M_PI_2 instead.
2023-02-17 21:18:30 +11:00
773903f43c Docs: add doc-string for compatible_eul & improve code-comments 2023-02-17 21:18:30 +11:00
9b3ce950e6 Fix #95400: Crash when running Euler Filter on baked Curves
Fix a crash when using the Euler Filter from the Graph Editor on baked curves.

The crash happened because baked curves have no bezt array.
Skipping any curves where that was missing fixes the issue.

Co-authored-by: Christoph Lendenfeld <chris.lenden@gmail.com>
Pull Request #104858
2023-02-17 11:05:57 +01:00
f6c6805226 Merge branch 'blender-v3.5-release' 2023-02-17 10:56:41 +01:00
a4b92a6814 Fix #104829: Clip editor has poor performance when Metadata panel is closed
According to the report it is a regression since 3.2, but it is tricky
to pin-point which exact commit caused it.

The root of the issue is that under certain circumstances frame might
be read and processed twice, depending on the order in which panels and
the main area is drawn: the footage information panel skips cache, so
it it is drawn prior to the main area it leads to 2 frame reads. Opening
the Metadata panel triggers code path which forces frame to be put to
the cache, solving the double frame read.

Solution is simple: do not skip cache when acquiring image buffer for
the footage information: the same frame will be needed for the main
area as well.

Pull Request #104860
2023-02-17 10:56:10 +01:00
932148ec54 Merge branch 'blender-v3.5-release' 2023-02-17 10:15:28 +01:00
09b9106e3d Make update: Use BKE_blender_version to detect release branches
On a user level there are no expected changes, other than being able
to update submodules and libraries from a main repository at a detached
HEAD situation (which did not work before).

On the infrastructure level of things this moves us closer to ability
to use the main make_update.py for the buildbot update-code stage, and
to remove the update-code section from the pipeline_config.yaml.

The initial idea of switching make_update to the pipeline config did
not really work, causing duplicated work done on blender side and the
buildbot side. Additionally, it is not easy to switch make_update.py
to use pipeline_config.yaml because the YAML parser is not included
into default package of Python.

There will be few more steps of updates to this script before we can
actually clean-up the pipeline_config: the changes needs to be also
applied on the buildbot side to switch it to the actual make_update.

Switching buildbot to the official make_update.py allows to much more
easily apply the submodules change as per #104573.
2023-02-17 10:04:37 +01:00
0250b40750 Cleanup: Silence compiler warning in VKShader. 2023-02-17 09:54:57 +01:00
c6ea00de3c BLI_math: correct the threshold for wrapping rotation in compatible_eul
Having a threshold well above PI would result in discontinuity in some
cases.

The discontinuity can be measured by generating euler values (both
random and interpolated rotations), then comparing the accumulated
difference.
Changing the threshold for wrapping rotations produces at least as good
or more compatible results.

This was reported as #17297 and fixed in [0], however the change was
only applied for the game-engine.

Ref !104856

[0]: ab44742cf3
2023-02-17 19:52:15 +11:00
1a6943d553 Merge branch 'blender-v3.5-release' 2023-02-17 09:38:18 +01:00
c624e56ffc Fix #104810: Appending a camera does not pull in background movie clip
This was broken even before 0649e63716 and was always expanding the
`Image`, not the movie clip (even if the source was set to
`CAM_BGIMG_SOURCE_MOVIE`)

Now the rule here seems to be to always expand unconditionally, so
remove checking the source and always expand image and movie clip.

Co-authored-by: Philipp Oeser <philipp@blender.org>
Pull Request #104815
2023-02-17 09:36:16 +01:00
5de9a5dea5 Sculpt: Fix 104618: Topology automasking errors
Sculpt island tags are now invalidated whenever the PBVH
is rebuilt.
2023-02-16 22:37:20 -08:00
9808d6abd8 Cleanup: loop over axes in compatible_eul
There is no need to inline the loop.
2023-02-17 16:18:43 +11:00
6b84636ff2 Cleanup: unused warning 2023-02-17 16:18:31 +11:00
a52c0a252f Cleanup: fix warnings from last commit 2023-02-16 21:14:27 -08:00
c352eeb213 Sculpt: Add support for last operator panel to mesh filter operator
* Repeat last operator now works for mesh filters.
* Added an iteration_count property to repeat the filter.
  This is especially useful when compounded with the repeat
  last operator tool.
* The mouse event history is stored for mesh filters
  with more advanced user input (mostly Smooth and Relax
  filters).
2023-02-16 20:54:56 -08:00
ef60b13c1f Deps: Optimize meson based deps
meson defaults to debug builds [0] unless you tell it differently, this
diff changes the options for

- epoxy
- fribidi
- harfbuzz
- wayland
- wayland_protocols

to be optimized, mesa was already optimized

[0] https://mesonbuild.com/Builtin-options.html#core-options

Pull Request #104802
2023-02-17 01:43:25 +01:00
9c79875f65 Cleanup: use BitSpan instead of BitVector where possible
Passing a `BitSpan` is generally better because then the caller is not
forced to allocate the bits with a `BitVector`. Also, the `BitSpan` can
be stored in the stack, which removes one pointer indirection compared
to accessing bits through a `BitVector &`.
2023-02-17 00:47:02 +01:00
891f47b801 BLI: new bit span data structure
This adds `BitSpan` and `MutableBitSpan`. They work essentially the same as
the normal `Span` and `MutableSpan`, but work on individual bits instead
(the smallest type `Span` can handle is one byte large).

This also splits up `BLI_bit_vector.hh` and introduces two new headers:
`BLI_bit_ref.hh` and `BLI_bit_span.hh`.

The goal here is to make working with dynamically sized bit masks more
convenient. I'm mainly working on this because I might want to use this
in #104629. It can also be used to cleanup function signatures that
currently take a reference to a `BitVector`. Like with `Span` vs. `Vector`,
it is better to pass a `BitSpan` to function than a `const BitVector &`.

Unit tests for the new code are included.

Pull Request #104671
2023-02-17 00:42:44 +01:00
8094d389f7 Cleanup: format 2023-02-17 11:41:12 +13:00
09d3ebfd72 Merge branch 'blender-v3.5-release' 2023-02-16 17:00:18 -05:00
efc2e5134f Fix #104841: Split function for Cycles for sharp edges ignores attribute
Cycles uses the "split faces" mesh function to support sharp edges
and auto-smooth. However, 75ad8da1ea updated that
function to ignore the edges that are explicitly tagged as sharp and
only use the edge angle. Fix by taking the attribute into account too.
2023-02-16 16:59:58 -05:00
4ebb66864a Fix #104826: Mesh to BMesh with shape keys can corrupt layers
The custom data layer mappings from dfacaf4f40 were created
*before* the BMesh shape key layers were added, invalidating the BMesh
data offsets they stored. Fix by creating the mappings after all layers
have been created.
2023-02-16 16:30:59 -05:00
8a51d61b44 Merge branch 'blender-v3.5-release' 2023-02-16 15:20:00 -05:00
eb5fead5ac Fix: Use proper types in compare node link drag search options
Clean up logic to make it more clear and formalize the way to choose
fixed node data type based on operation. This make possible to more
easily fix wrong node data type for color type and less than ops.

Pull Request #104617
2023-02-16 15:18:56 -05:00
b2a536e9d7 Fix: Remove the rest of the tracks in the BKE_nlatrack_remove_and_free to free up the memory
Fix: The BKE_nlatrack_remove_and_free (#104752) unit test leaks a little memory. Cleaning up the rest of the track list to ensure everything is freed.
Co-authored-by: Nate Rupsis <nrupsis@gmail.com>
Pull Request #104839
2023-02-16 20:24:33 +01:00
77c273ee37 Fix unused variable in release builds
Assert is not needed in this case.
2023-02-16 18:57:50 +01:00
4cdf27cd96 Merge branch 'blender-v3.5-release' 2023-02-16 12:50:11 -05:00
9f41f95c8e Fix #104785: Quick fur keeps asset status of appended node groups
Use the recently added "clear_asset_data" option in the append operator.

Pull Request #104828
2023-02-16 18:14:47 +01:00
c2a0decbf3 Cleanup: Use Span to iterate over nodes instead of ListBase
Similar to 5b8e2ebd97.
2023-02-16 12:12:38 -05:00
851de8170d Cleanup: Nodes: Avoid unnecessary const cast, use early return 2023-02-16 12:11:20 -05:00
4e7a7e613a Cleanup: Fix operator description 2023-02-16 17:47:04 +01:00
bf5a89f4e0 Cleanup: Adding in NLA Track Remove / Remove and free BKE methods
This PR adds 2 new methods:
* BKE_nlatrack_remove
* BKE_nlatrack_remove_and_free

and modifies the existing `BKE_nlatrack_free` to remove the track list parameter.

This refactor splits out the removal / freeing into it's own methods, and provides a higher order method (BKE_nlatrack_remove_and_free) to conveniently call both.

Co-authored-by: Nate Rupsis <nrupsis@gmail.com>
Pull Request #104752
2023-02-16 17:31:09 +01:00
81b53aa507 WM: Add option for clearing asset data to append operator
When appending assets it often isn't expected for the asset tags and
meta-data to be included. Add an option to the append operator to
disable appending the asset data, exposing existing internal options.
2023-02-16 11:17:02 -05:00
55843cd64b Curves: Add select more/less
This adds the "Select More/Less" operators for Curves. Both operators use the `select_adjacent` function to (de)select adjacent points.

Pull Request #104626
2023-02-16 17:02:43 +01:00
1e9564864c Cleanup: Refactor File/Asset Browser button dragging code
Code to set the dragging data for a button was mostly duplicated, they
share it now. The followup commit also needs an easy way to reuse the
logic, which is possible now.
2023-02-16 16:57:10 +01:00
6da512f0bc UI: Refactor how draggable part of button is determined
No longer use the existance of an image pointer inside the button, or
the the type of a button to decide if the entire button should be
draggable, or only its icon. This was rather sneaky, undocumented
behavior. Instead make this a proper option in the public UI API, and
enable it by default in specific cases to match the previous behavior.

This at least makes the behavior known and controllable in the API, and
not something that's just "secretly" done deep down in the button
handling code. I'd argue we should just use the entire button width by
default for dragging, but that would be a bigger change.
2023-02-16 16:57:10 +01:00
9edb1d0a7c Fix #104166: Add redraw for asset marking and unmarking
When the users click the "Mark as Asset" with the mouse hover the fake
user button, the button was not refreshed. In fact, the areas are not
listening to the "NC_ID NA_EDITED", which is the signal emitted after
an asset is marked/unmarked. Because of this, the areas aren't redrawn
(especially the ID buttons).

This little patch adds the event listening for the areas where this
problem is happening  node editor and properties editor.

Pull Request #104694
2023-02-16 16:26:23 +01:00
2ccb820c7e Merge branch 'blender-v3.5-release' 2023-02-16 15:27:40 +01:00
47934b5c2b Curves: Add remove_selection function
This adds a `remove_selection` function that can be used by other
objects that make use of `CurvesGeometry`.

Pull Request #104813
2023-02-16 15:26:13 +01:00
be6847e773 Cleanup: Remove read-only attribute type
After the removal of the "normal" attribute providers, we no longer
use the concept of read-only attributes. Removing this status simplifies
code, clarifies the design, and removes potentially buggy corner cases.

Pull Request #104795
2023-02-16 15:08:28 +01:00
300c673a64 Geometry Nodes: Remove "normal" attribute
The "normal" was added before fields existed because we needed a
way to expose the data to geometry nodes. It isn't really an attribute,
because it's read-only and it's derived rather than original data.

No features have relied on the "normal" attribute existing, except
for the corresponding column in the spreadsheet. However, the
column in the spreadsheet is also inconsistent, since it isn't an
attribute but looks just like the other columns. The normal is
always visible in the spreadsheet.

Pull Request #104795
2023-02-16 15:08:28 +01:00
368559647f Merge branch 'blender-v3.5-release' 2023-02-16 15:01:29 +01:00
c785e7431e Themes: Fix several issues in Blender Light theme
* Fix #92539: Hard to read the breadcrumbs.
* Fix View Item active, hover, and text color (e.g. count numbers in the
  Spreadsheet were almost unreadable).
* Fix mismatching node type colors with the default theme.
  Blender Light is meant to be simply a brighter version of the default,
  so screenshots and tutorials can be followed with both themes.
* Use the same outline color for widgets, so they match when aligned in a row.
* Make panels standout (not fully transparent), like in the default theme.
2023-02-16 14:39:41 +01:00
d705c8ed57 Merge branch 'blender-v3.5-release' 2023-02-16 08:30:52 -05:00
9d15b3f424 Fix #104697: Curves Sculpt: Setting brush shortcuts does not work
The active tools in `_defs_curves_sculpt` don't use names that are
exactly the same as the corresponding brush name with "builtin_brush."
at the beginning, instead they use more standard identifiers without
capitals or spaces.

The "brush_select" utility operator assumed the names matched though.
That can be fixed by manually mapping the brushes to the active tools.

Pull Request #104792
2023-02-16 13:48:39 +01:00
c9285f83ab Fix #104698: Assert and failure adding shortcuts to curves sculpt tools
The keymap name in `WM_keymap_guess_from_context` didn't match the
name of the keymap in the Blender default keymap (`km_sculpt_curves`).
Fix by changing the utility function to match the keymap name.

Before right clicking on any tool in curves sculpt mode gave an assert,
now it shows a context menu.

Pull Request #104791
2023-02-16 13:47:13 +01:00
c39b81d832 UI: Improvement to screen_find_area_xy
In BKE_screen_area_map_find_area_xy (find a ScrArea by 2D location),
ignore edges by using screen verts instead of totrct

Differential Revision: blender/blender#104680

Reviewed by Brecht Van Lommel
2023-02-16 02:38:57 +01:00
6e7242f00c Merge branch 'blender-v3.5-release' 2023-02-16 00:53:04 +01:00
4cb119f533 Fix #104584: Reassigning effect strip input does not update its position
Lookup cache was not invalidated, to update attached effects position, a handle
of a input strip is touched.

To update attached effects, currently the code only does that when strip
position is changed. This is, because effect strip updating is done internally
in sequencer module code and ideally shouldn't be done at all. A TODO comment
with further explanation is added.
2023-02-16 00:48:52 +01:00
10c0c2a156 Windows: allow windows to span multiple monitors
On the Windows platform allow Blender windows to be created that are
spread over multiple adjacent monitors.

---

On Windows we are quite feature-complete and stable for the creation and placement of multiple (non-temp) Blender windows. We correctly do so across multiple monitors no matter their arrangement, resolution, and scale.

However, there is another way that Blender could use multiple monitors - suggested by a core dev - which is to size a window so that it comprises multiple monitors. There are some advantages to this way of working because the one window remains constantly active and in focus. It also allows a single region (like a node editor) to be as large as possible.

But this way of working is not currently possible. That is because during window creation we constrain them to fit within the confines of the nearest single monitor. This has mostly been done for simplicity and safety. We don't want to restore a saved window to a position where it cannot be seen or used.

This patch addresses that. It allows windows to span multiple monitors, and does so safely by constraining the four corners of the window to be within the working area of any active monitor.  This means it allows the creation of single windows as shown below in blue (left two), but does not allow the one in orange (right):

![image.png](/attachments/b2a9dfca-d54c-467a-ab95-717df3b25051)

Note this has been previously (before gitea) reviewed and approved by Brecht.

Co-authored-by: Harley Acheson <harley.acheson@gmail.com>
Pull Request #104438
2023-02-16 00:41:26 +01:00
ab63fe9eab Cleanup: format 2023-02-16 10:04:09 +11:00
a2551f23ad Cleanup: document & improve naming for Wayland's pending window actions 2023-02-16 10:02:23 +11:00
f178e3f849 Merge branch 'blender-v3.5-release' 2023-02-15 23:56:58 +01:00
7a76f2ae77 Fix #104370: Draw: Don't request the same attribute more than once
Avoid running out of attributes when multiple material slots use the same one.

Cleanup:
Removes the return value from drw_attributes_add_request since it shouldn't be modified afterward and it's never used.
Avoid making copies of DRW_AttributeRequest in drw_attributes_has_request.

Co-authored-by: Miguel Pozo <pragma37@gmail.com>
Pull Request #104709
2023-02-15 23:54:51 +01:00
b1abc23899 Fix: Skip anonymous CustomData layers for the python API
Now that the UV map names are read from the evaluated mesh the names of
the anonymous layers would show up in the UV Map node and be accessible
via the python interface.

This changes the collection definition to skip anonymous layers.

Pull Request #104783
2023-02-15 23:54:50 +01:00
043bff144d Merge branch 'blender-v3.5-release' 2023-02-15 17:40:15 -05:00
d465b92823 Cleanup: Make format, fix missing static warning 2023-02-15 17:39:53 -05:00
7ad1d3156c Cleanup: Use simpler attribute transfer API in duplicate elements node
Instead of retrieving which attributes to transfer from the geometry set
which exists at a different abstraction level, get them from accessors
directly with a newer utility function. This removes boilerplate code
and makes the logic clearer for a future even more generic attribute
propagation API.
2023-02-15 17:38:47 -05:00
2cad80b0e5 Merge branch 'blender-v3.5-release' 2023-02-15 16:13:35 -05:00
Colin Marmond
c59d2f3f2d Fix #102529: De-duplicate add node search items with assets
Fix a little omission. The id name has a 2 char prefix which has
to be removed in order to compare to the real name.

Pull Request #104793
2023-02-15 16:10:37 -05:00
1e6ed77896 Merge branch 'blender-v3.5-release' 2023-02-15 13:27:49 -05:00
72a2229848 Fix #104690: Evaluated positions user-after-free for copied poly curves
The evaluated positions cache can live longer than a specific
`CurvesGeometry`, but for only-poly curves, it pointed to the positions,
which are freed when the curves are. Instead, use the same pattern
as the evaluated offsets and don't store the positions span, just return
it when retrieving evaluated positions.
2023-02-15 13:26:06 -05:00
b7e39acfcd Fix #104789: uv_layers.remove() always raises error
A simple typo from 6c774feba2. Also return
so nothing happens when the UV map isn't found.
2023-02-15 13:25:46 -05:00
b07085fe3c Fix #104690: Evaluated positions user-after-free for copied poly curves
The evaluated positions cache can live longer than a specific
`CurvesGeometry`, but for only-poly curves, it pointed to the positions,
which are freed when the curves are. Instead, use the same pattern
as the evaluated offsets and don't store the positions span, just return
it when retrieving evaluated positions.
2023-02-15 11:38:27 -05:00
753eb9c20e Cycles: disable AMD GPU rendering binaries due to compiler bugs
There are known bugs in HIP compiler that are causing random build failures
when making changes to the Cycles kernel. This is preventing developers from
efficiently making improvements to Cycles.

For now Cycles AMD GPU rendering is disabled in Blender 3.6 until a good
solution is found, so that ongoing work like Principled v2 is not blocked.
We hope this can be resolved later on in the 3.6 release cycle.

Ref #104786
2023-02-15 17:24:37 +01:00
05b177b0b3 Revert changes to align asset library labels in menus
This reverts 1116d821dc and part of 5bac672e1a.

The solution was made specifically for the 3.5 release, to avoid
breaking other cases. The previous commit addressed the problem properly
by letting the general menu code align labels where needed.
2023-02-15 16:09:08 +01:00
58752ad93c UI: Ensure menus with icons align all menu item labels
Usually in Blender, we try to align the labels of items within a menu,
if necessary by adding a blank icon for padding. This wasn't done for
menus generated from enum properties (RNA or custom property enums). Now
we do it whenever there is at least one item with an icon.
2023-02-15 16:09:08 +01:00
0f29a65744 Merge branch 'blender-v3.5-release' 2023-02-15 15:59:34 +01:00
1116d821dc Fix weird icon padding in asset library selector menu button
Since the menu doesn't automatically align the labels like other menus
and pulldowns in Blender, I manually made them align using the blank
icon. However the menu button would also include this blank icon now.

This is a specific fix for the 3.5 release. In the main branch I will
replace it with proper support for automatically aligning labels in such
menus.
2023-02-15 15:59:12 +01:00
b9bf4700b0 Fix weird icon padding in asset library selector menu button
Since the menu doesn't automatically align the labels like other menus
and pulldowns in Blender, I manually made them align using the blank
icon. However the menu button would also include this blank icon now.

This is a specific fix for the 3.5 release. In the main branch I will
replace it with proper support for automatically aligning labels in such
menus.
2023-02-15 15:58:40 +01:00
Matti-Ranta
0b63136e63 Cleanup: delete .arcconfig
Now that https://developer.blender.org/ has been decommissioned, arcconfig is no longer needed.

Pull Request #104768
2023-02-15 15:49:22 +01:00
7ae5bc142b Merge branch 'blender-v3.5-release' 2023-02-15 15:37:47 +01:00
a7ccb3df3e Fix possible compiler warning and linker error
Type was forward declared as class, but is a struct. GCC is quiet about this
Clang gives a warning about potential linker errors on MSVC.
2023-02-15 15:37:30 +01:00
a6ebe0ca62 Fix possible compiler warning and linker error
Type was forward declared as class, but is a struct. GCC is quiet about this
Clang gives a warning about potential linker errors on MSVC.
2023-02-15 15:09:22 +01:00
d8112ec1ea Revert "Splash screen for Blender 3.5"
This reverts commit a0b4da2bd0.
2023-02-15 14:17:00 +01:00
6417da28a8 Revert "Blender 3.5 Beta:"
This reverts commit 904b7e4e41.
2023-02-15 14:16:43 +01:00
33193093b1 Merge branch 'blender-v3.5-release' 2023-02-15 14:16:25 +01:00
a0b4da2bd0 Splash screen for Blender 3.5
Credits: Nicole Morena
2023-02-15 14:14:14 +01:00
904b7e4e41 Blender 3.5 Beta:
* BLENDER_VERSION_CYCLE set to beta
* Update pipeline_config.yaml to point to 3.5 branches and svn tags
* Update and uncomment BLENDER_VERSION in download.cmake
2023-02-15 13:56:14 +01:00
d5d48a986b Release cycle: Bump version to 3.6. 2023-02-15 13:49:56 +01:00
5bac672e1a Asset Browser: Add separator line & icon padding for import method menu
Usually when a menu item displays an icon, we indent all other items
with an empty icon so items align nicely. Now with more built-in asset
libraries (the new "Essentials" library), this inconsistency becomes
more apparent.

Also add a separator line between the "All" asset library and the
others, makes the menu look more organized.
2023-02-15 13:11:10 +01:00
e3b5a2ae15 Asset Browser: Hide import method menu for essentials
Essentials always use "Append (Reuse Data)", displaying the menu to
change that doesn't make sense.
2023-02-15 13:03:36 +01:00
0d798ef57c Assets/UI: Use UI-list for asset library preferences UI
The Preferences for asset libraries are becoming more than a simple name
+ path. E.g. there is now an Import Method options, and we previously
also considered a Relative Paths option (which we may still want to
add). The previous UI, while consistent with the Auto Run Python Scripts
UI isn't well suited for less than trivial cases. Using UI lists makes
the UI more scalable and follows usual list UI patterns more. There is
also more space for the path button now.

Part of #104686.
2023-02-15 13:00:17 +01:00
972f58c482 Asset Browser: Rename "Import Type" to "Import Method"
"Type" sounds like you're selecting a thing, not a behavior. So "Method"
should be better. Part of 104686.
2023-02-15 12:58:15 +01:00
ae84a2956e Assets: Preference for default import method for an asset library
The default import method for an asset library can now be determined in
the Preferences. The Asset Browser has a new "Follow Preferences" option
for the importing. The essentials asset library still only uses "Append
(Reuse Data)".

This is part of #104686, which aims at improving the import method
selection, especially for the introduction of the new essentials library
(which doesn't support certain import methods). Further changes are
coming to improve the UI, see #104686.

Pull Request: #104688
2023-02-15 12:51:23 +01:00
4387dbf03e Curves: Replace quick fur operator, add to add menu
The quick fur operator now uses the new hair system. It adds a new
curves object for every selected mesh, and adds geometry nodes
modifiers from the essentials assets that generate curves. A few
settings are exposed in the redo panel, including an option for whether
to apply the modifier to generate the initial curves so that there is
original editable data.

The point of the operator is to give people a sense of how to use the
node groups and to give a very fast way to build a basic setup for
further tweaking.

Pull Request #104764
2023-02-15 12:13:34 +01:00
837ba82402 Fix #90629: VSE: Split selection is determined by menu position
Use the right hand side selection, as it fits the typical workflow
the best.

Arguably, the same would need to be done for the k-shortcut, but
that is another issue to be tackled. As well as making the selection
active.

Pull Request #104777
2023-02-15 12:05:37 +01:00
1a94457586 Fix #104760: GPencil Fill Gap circles no longer disappear when blue line appear
The problem was the alpha channel was set wrongly and the original 0 value was replaced with 1 by error.
2023-02-15 11:55:32 +01:00
35cde8b5fd Curves: move edit mode out of experimental
We (Dalai, Hans, Falk, Simon and me) decided that the curves edit mode
is useful enough to justify moving it out of experimental now. So far it
supports the following features:
* Various selection tools. The selections are synced with sculpt mode.
* Transform tools.
* Delete curves/points.

More functionality of the old curve edit mode will be ported over in
future releases.
2023-02-15 11:43:55 +01:00
ef46f735f3 Cleanup: LineArt: Remove lineart_cpp_bridge.cc
Removed this file because lineart_cpu.cc is already c++.

Pull Request #104736
2023-02-15 11:33:37 +01:00
7481a36d51 EEVEE: Remove unnecessary material optimization assertion.
Fix unreported assert in basic scenes.

Authored by Apple: Michael Parkin-White

Pull Request #104775
2023-02-15 11:27:25 +01:00
3807a0981e Curves: Add delete operator to edit mode
This implements the delete operator in curves edit mode. The behavior
is similar to the delete operator in the edit mode of legacy curves,
i.e. it's actually dissolving and doesn't split curves. This is also
the behavior that we generally want for the hair use case.

The operator is added to the `Curves` menu and can be accessed via
the keyboard using `X` or `Del`.

Pull Request #104765
2023-02-15 10:50:01 +01:00
ddc6815b1a Curves: add Curve Parameter Falloff to comb brush
This adds a new `Curve Falloff` popover to the comb brush tool settings.
The curve control allows changing the brush weight along the curve to
e.g. affect the tip more than the root. This is a relative way to get
something like stiffness for short hair.

This functionality could potentially be added to some other brushes,
but the comb brush is the most important one, so that is added first.

I did add the buttons add the buttons to choose a curve map preset.
However, I did not add the preset dropdown, because that just adds
some unnecessary complexity in the code now and is redundant.

Pull Request #104589
2023-02-15 10:42:30 +01:00
fc6d13eced Cleanup: extract the check to save a blend file into a function
Part of D11422 by @filedescriptor, makes it convenient to run a funciton
when the file cannot be saved.
2023-02-15 16:19:49 +11:00
e424931cf7 Cleanup: rename Byte to Bytes in Python string utilities
These functions operate on byte arrays, not a single byte,
match naming for CPython's PyBytes_AS_STRING.
2023-02-15 16:19:14 +11:00
6661342dc5 Mesh: Set active attribute values edit mode operator
This patch adds a simple operator to set values of the active
attribute for the selected element. The aim is to give simple control
over attribute values in edit mode rather than to provide the fastest
workflow for most cases. Eventually this operator might be less
important compared to more advanced attribute editing tools, but for
now, exposing a little bit of functionality is low hanging fruit and
will help to see the possibilities.

The implementation mostly consists of boilerplate to register the
necessary property types for the operator and draw their UI.
Beyond that, we just loop over selected elements and set a value.

Pull Request #104426
2023-02-15 04:34:53 +01:00
02c3889b1c Cleanup: quiet clang warnings
Quiet unused argument, shadow, array-bounds & range-loop-bind-reference
warnings.
2023-02-15 13:26:54 +11:00
8d35b28f2a Cleanup: spelling in comments 2023-02-15 13:11:14 +11:00
00a7344f27 Cleanup: quiet warnings from shellcheck, correct indentation 2023-02-15 13:11:06 +11:00
8de121ffc6 Cleanup: use 'show_' prefix for RNA sculpt booleans
Follow naming conventions from
https://wiki.blender.org/wiki/Source/Architecture/RNA
2023-02-15 13:11:04 +11:00
c3b53abc10 Fix #84057: Delete operator removes unexpected strip
Caused by strips being flagged for removal, but the flag was never
cleared. As far as I can tell, this issue is not reproducible anymore,
but there may be files with this flag still set.
2023-02-15 01:25:38 +01:00
dcc80748d3 Fix overlay_uniform_color_clipped inheritance
overlay_uniform_color_clipped was inheriting from overlay_depth_only, which doesn't
make much sense.
I've changed it to inherit from overlay_uniform_color instead, which is consistent
with other \*\_clipped variants of shaders.

Pull Request #104761
2023-02-14 22:21:59 +01:00
7b9d1cb51f Eevee: GPU Material node graph optimization.
Certain material node graphs can be very expensive to run. This feature aims to produce secondary GPUPass shaders within a GPUMaterial which provide optimal runtime performance. Such optimizations include baking constant data into the shader source directly, allowing the compiler to propogate constants and perform aggressive optimization upfront.

As optimizations can result in reduction of shader editor and animation interactivity, optimized pass generation and compilation is deferred until all outstanding compilations have completed. Optimization is also delayed util a material has remained unmodified for a set period of time, to reduce excessive compilation. The original variant of the material shader is kept to maintain interactivity.

Also adding a new concept to gpu::Shader allowing assignment of a parent shader from which a shader can pull PSO descriptors and any required metadata for asynchronous shader cache warming. This enables fully asynchronous shader optimization, without runtime hitching, while also reducing runtime hitching for standard materials, by using PSO descriptors from default materials, ahead of rendering.

Further shader graph optimizations are likely also possible with this architecture. Certain scenes, such as Wanderer benefit significantly. Viewport performance for this scene is 2-3x faster on Apple-silicon based GPUs.

Authored by Apple: Michael Parkin-White

Ref T96261
Pull Request #104536
2023-02-14 21:51:03 +01:00
db2eaa5c86 OBJ: fixed some faces wrongly skipped in invalid face validation logic (#104593)
The logic for looping over imported OBJ faces and checking whether any
of them are "invalid" (duplicate vertices) was wrongly skipping
validation of the next face right after some invalid face. It
was the previously invalid face, moving the last into its place,
but then the loop was incrementing the face index and that just-moved
face was not properly validated.

Fixes #104593 - importing attached obj file (which contains some faces
that have duplicate indices). Added test coverage with a much smaller
obj file.
2023-02-14 21:49:25 +02:00
e1a29b58bb Fix: Curve resolution input node missing default
When the attribute doesn't exist, the node should give the default
of 12, as defined by the accessor method for `bke::CurvesGeometry`.

Pull Request #104674
2023-02-14 19:59:37 +01:00
87f96b7664 Fix wrong variable being used as plan in 'gizmo_3d_dial_matrixbasis_calc'
A plane must be `float[4]`.
2023-02-14 15:39:32 -03:00
a755e6e63f Revert "MSVC: lower C4100 warning level from 4 to 3"
This reverts commit db4e7616f3.

Caused many issues when compiling mantaflow.
2023-02-14 15:36:35 -03:00
f72d28d7e7 Gizmo: use the final matrix for the dial3D clip plane
Dial3D uses the `matrix_basis` for the clip plane.

This can cause inconsistencies if the gizmo has `matrix_offset` or
`matrix_space`.
2023-02-14 15:31:30 -03:00
db4e7616f3 MSVC: lower C4100 warning level from 4 to 3
This better aligns with OSX/Linux warnings.

Although `__pragma(warning(suppress:4100))` is not the same as
`__attribute__((__unused__))` in gcc (which only affects the attribute
instead of the line), it still seems to be better to use it than to
hide the warning entirely.
2023-02-14 14:38:18 -03:00
f4db58844d GPU: Fix wrong 2D shader used from 3D drawing
Regression introduced by d165d6aa2a.
2023-02-14 18:32:42 +01:00
acf7f46b77 Fix #104748: GPencil: Fill tool is not working at all
Caused by missing color uniform update.
2023-02-14 18:32:42 +01:00
4fbc9c42e5 Curves: Add transform tools to toolbar
This commit also makes `ED_transform_calc_gizmo_stats` work
for curves.

Pull Request #104750
2023-02-14 18:24:24 +01:00
5ca65001ea Geometry Nodes: Operator to wrap a modifier's node group
As described in #104171, add an operator that creates a new node group
that contain the current node group and named attribute nodes to deal
with the outputs. This saves manual work when moving a high-level
modifier to the node editor for better procedural control.

Pull Request #104546
2023-02-14 18:21:50 +01:00
c9f02569c7 Curves: cage overlay for sculpt mode
This adds a new overlay for curves sculpt mode that displays the curves that the
user currently edits. Those may be different from the evaluated/original curves
when procedural deformations or child curves are used.

The overlay can clash with the evaluated curves when they are exactly on top of
each other. There is not much we can do about that currently. The user will have
to decide whether the overlay should be shown or not on a case-by-case basis.

Pull Request #104467
2023-02-14 18:10:11 +01:00
eb9647c53d Cleanup: rename vertex buffer attribute to be more specific
This renames `data` and `color` to `selection`. This is better because
it's actually what the corresponding buffers contain. Using this
more correct name makes sharing vertex buffers between different
gpu batches for different shaders easier.
2023-02-14 17:53:20 +01:00
7ba59c8a62 Assets: show all assets by default instead of current file
The "current file" mode is only useful when creating new assets.
However, the far more common use case and the one that should require
fewer steps is to use existing assets.

There is a risk that this causes freezing if the file browser preview
caching does not work properly. So we'll have to keep an eye on the bug
tracker to see if this is an issue in practice.

Pull Request #104749
2023-02-14 17:44:41 +01:00
b3fb73f325 Assets: bundle Essentials with Blender
This patch adds an "Essentials" asset library that is bundled with Blender.
Also see #103620. At build time, the `lib/assets/publish` folder is copied
to `datafiles/assets` in the build directory.

In the UI, the "Essentials" library can be accessed like other custom asset
libraries with the exception that assets from that library cannot be linked.

The immediate impact of this is that Blender now comes with some geometry
node groups for procedural hair grooming.

Pull Request #104474
2023-02-14 17:35:29 +01:00
459c210154 Fix #104652: UV Face Dots randomized
Match the check from before 75db4c082b,
where we just checked that the face dots bitmap wasn't null.
2023-02-14 11:27:34 -05:00
715acf758c Curves: Use deformed points in edit mode overlay
Uses the deformed crazyspace to populate the position buffer for Curves edit mode overlay.

Pull Request #104705
2023-02-14 16:33:38 +01:00
cfe828b452 OBJ: Support polylines with more than 2 vertices.
The OBJ spec (page B1-17) allows "l" entries to specify
polylines with more than 2 vertices, optionally with texture
coordinates.

Previously, only the first 2 vertices of each polyline
were read and added as loose edges, failing when texture
coordinates were present.

This adds support for proper polylines, reading but ignoring
texture coordinates.

Pull Request #104503
2023-02-14 16:30:50 +01:00
4cc94679dd MSVC: suppress additional warnings out of external headers
In 161908157d we moved all warnings
coming out of the library folder to /W0 as many of them do not follow
our code-style nor can we force them to.

When i made this change, i took `/external:templates-` to mean
"and that goes for you too, templates" and it decisively does the
opposite leading to /W3 warnings coming out of openvdb

This change removes the flag as it should have never have been added
in the first place.
2023-02-14 07:56:14 -07:00
Robin Hohnsbeen
39f63c8c08 Sculpting: Vector displacement for the sculpting draw brush
Sculpt: Added vector displacement for the sculpting draw brush (area plane mapping only for now)

Vector displacement maps (VDM) provide a way to create complex displacements that can have overhangs in one brush dab.
This is unlike standard displacement with height maps that only displace in the normal direction.
Forms like ears, curled horns, etc can be created in one click if VMDs are used.
There is a checkbox on the draw brush in the texture settings "Vector Displacement" that enables/disables this feature.

Technical description: The RGB channels of a texture in a brush stroke are read and interpreted as individual vectors, that are used to offset vertices.
As of now, this is only working for the draw brush using the area plane mapping. Symmetry and radial symmetry are working.

A few things to consider when making VD-Maps:
* UVs need to stay intact for the bake mesh (e.g. voxel remeshing can't be used to create VD Meshes)
* When exporting a VD Map it should be in the file format OpenEXR (for positive and negative floating point values).
* Export resolution can be 512x512 or lower (EXR files can get very large, but VDM brushes don't need a high resolution)

And when using them:
* Inside Blender clamping needs to be unchecked on the texture
* The brush falloff should be set to constant (or nearly constant)

This patch was inspired by this [right-click-select proposal](https://blender.community/c/rightclickselect/WqWx/) Thanks for the post!

(Moved [this patch](https://archive.blender.org/developer/D17080) to here.)

Co-authored-by: Robin Hohnsbeen <robin@hohnsbeen.de>
Pull Request #104481
2023-02-14 15:29:27 +01:00
d4f7f1dfe4 Fix memory leak in view3d_select
There was an unintentional early return in the click select
execute function that caused the operator properties not
to be freed.
2023-02-14 14:59:07 +01:00
a76b5d3a07 Curves: change collision radius for consistency with default radius
Offset distance for curve collision  will be matched with default curve
radius for better visibility.

Pull Request #104648
2023-02-14 14:15:04 +01:00
59b9a88a35 Fix: duplicate elements node does not update curve type counts
Curve type counts are updated eagerly but it was missing in this
node leading to a crash further down the line where the counts
were expected to be correct.
2023-02-14 13:32:00 +01:00
4126284e46 Allocator: Fail building when trying to MEM_delete a void pointer
`MEM_delete()` is designed for type safe destruction and freeing, void
pointers make that impossible.
Was reviewing a patch that was trying to free a C-style custom data
pointer this way. Apparently MSVC compiles this just fine, other
compilers error out. Make sure this is a build error on all platforms
with a useful message.
2023-02-14 12:48:26 +01:00
1fd0c80725 Build: correct forwarding jobs argument to make_deps_wrapper.sh 2023-02-14 22:26:59 +11:00
5215543280 Constraints: use a dimensionless unit prop for Maintain Volume
The Volume property of the Maintain Volume constraint was marked as a
distance, which made it confusing--especially with non-metric units.

The volume can actually be understood as a factor of the initial
volume, so it should be dimensionless.

Additionally, the volume had a range of 0.001 to 100.0. This is wide
enough in most cases, but sometimes you may need to go orders of
magnitude higher or lower to consider vast or thin objects, and there
should be no drawback to extending the limits, provided they stay
positive.

Pull Request #104489
2023-02-14 12:19:53 +01:00
1e449bee21 Cycles: Temporary fix for Principled Hair albedo
The proper fix (bb9eb262d4) caused compilation problems with HIP, so we're
delaying it until 3.6.
To fix the original bug report (#104586), this is a quick workaround that'll
hopefully not upset the compiler.

Pull Request #104723
2023-02-14 12:18:10 +01:00
5040c39d1a Fix T103354: Author extents on UsdGeomMesh
A properly authored USD file will have the extent attribute authored on all prims conforming to UsdGeomBoundable.
This cached extent information is useful because it allows the 3D range of prims to be quickly understood without reading potentially large arrays of data. Note that because the shape of prims may change over time, extent attributes are always evaluated for a given timecode.

This patch introduces support for authoring extents on meshes and volumes during export to USD.

Because extents are common to multiple kinds of geometries, the main support for authoring extents has been placed in USDAbstractWriter, whose new author_extent method can operate on any prim conforming to pxr::UsdGeomBoundable. The USD library already provides us the code necessary to compute the bounds for a given prim, in pxr::UsdGeomBBoxCache::ComputeLocalBound.
Note that not all prims that are imageable are boundable, such as transforms and cameras.

For more details on extents, see https://graphics.pixar.com/usd/release/api/class_usd_geom_boundable.html#details.

Note that when new types of geometries are introduced, such as curves in https://developer.blender.org/D16545, we will need to update the USD writer for that geometry such that it calls this->author_extent.

Update on Feb 2: This patch has been updated to include a unit test to ensure authored extents are valid. This test requires new test assets that will need to be submitted via svn. The test assets are attached in the d16837_usd_test_assets.zip file. To use, unzip and merge the contents of this zip into the lib/tests/usd folder.

This unit test also addresses #104269 by validating compliance of exported USD via UsdUtils.ComplianceChecker.

Pull Request #104676
2023-02-14 12:11:53 +01:00
a3e6cb5dab Gizmo: press shift key to scale cage2d gizmo uniformly
Reviewed by: Campbell Barton
Pull Request #104418
2023-02-14 11:08:54 +01:00
fe0a219b5b Revert: Formatting changes space_toolsystem_toolbar 2023-02-14 10:30:49 +01:00
09498264f6 Deps: build one at a time, each using all available cores on Linux
Use a MAKE wrapper for 'make deps' on Linux that ensures dependencies
are built one at a time. This is preferable because building many
dependencies at once made troubleshooting impractical and had the
downside that large deps such as LLVM would bottleneck on a single core.

This may be used for macOS, so far it's only tested on Linux.
2023-02-14 16:37:04 +11:00
46c34ba1f6 GNUmakefile: include install directory in 'make deps' message
Avoids uncertainly, ensure deps are copied from the right place.
2023-02-14 13:26:30 +11:00
d02f863b18 Update RNA to User manual mappings 2023-02-14 13:19:18 +11:00
d851c91856 PyDocs: update links in generated API docs for GITEA migration
- Correct broken link for undocumented modules.
  Point to the contributing page, it seems #51062 was lost with the
  GITEA task migration.
- Correct Blender Version link to the SHA1.
2023-02-14 12:41:51 +11:00
a6dcf6e6cb Cleanup: avoid redundant sqrt when picking reroute nodes 2023-02-14 12:26:29 +11:00
818c16ef1f Cleanup: pass a const argument to CustomData_get_elem_size 2023-02-14 12:26:01 +11:00
750e278fd1 Cleanup: line wrapping in USERPREF_PT_experimental_new_features
Changing from Phabricator links caused poor formatting.
Also remove blank lines between comment and it's function.
2023-02-14 12:13:04 +11:00
85f8ba9db7 Cleanup: include missing header, sort CMake file lists 2023-02-14 11:52:14 +11:00
1ac80e8338 Cleanup: quiet unreachable-code warning, use ARRAY_SIZE macro 2023-02-14 11:50:00 +11:00
6dc88682ea License headers: add missing license identifier 2023-02-14 11:47:13 +11:00
36937e523a Fix #66863: Bisect plane rotation behavior bugged for side/cut view
The matrix of the rotation gizmo is somewhat confusing.

Attaching to the Z axis has more predictable results.
2023-02-13 21:15:38 -03:00
0fa34aa0ec Cleanup: spelling in comments, reference enum types in doc-strings
Also use doxy formatting for structs in sculpt_uv.c.
2023-02-14 10:29:48 +11:00
e928dd300b Cleanup: format 2023-02-14 10:29:46 +11:00
dc46465490 Cleanup: use typed enum (eDirEntry_SelectFlag) where appropriate 2023-02-14 10:29:44 +11:00
1d7bf4f826 BLI_utildefines: add ^= operator to ENUM_OPERATORS macro 2023-02-14 10:29:42 +11:00
Erik Abrahamsson
526f2273c6 Docs: improve online manual lookup time time
Matching the RNA id's to the search pattern is slow because
of the function `fnmatchcase`. This patch first checks the string
prefix without any special characters used by fnmatch,
if the `startswith` check fails, there is no need to check `fnmatchcase`.
Before the optimization, an online manual lookup took about 400ms
which is quite noticeable, with this patch applied it's under 10ms.

Ref !104581.
2023-02-14 10:29:40 +11:00
bb9eb262d4 Revert "Cycles: Clean up the Principled Hair BSDF implementation"
This reverts commit cb77865c21.

Appears to break HIP compilation, so delay until 3.6.
2023-02-13 23:32:53 +01:00
1f615690e6 Cycles: Add support for CUDA 12
CUDA 12 no longer supports sm_3*, in particular 35 and sm_37,
so skip building those if only CUDA 12+ is available.

Pull Request #104713
2023-02-13 23:04:02 +01:00
6a0b1eae8c Fix #104097: re-enable Cycles AMD Vega support
The internal compiler error appears to be gone. Unclear why it appeared in the
first place and why it's gone now. Just random kernel code changes causing it.

Pull Request #104719
2023-02-13 22:53:08 +01:00
cb77865c21 Cycles: Clean up the Principled Hair BSDF implementation
- Rename roughness variables for more clarity - before, the SVM/OSL code would
  set s and v to the linear roughness values, and the setup function would over-
  write them with the distribution parameters. This actually caused a bug in the
  albedo code, since it intended to use the linear roughness value, but ended up
  getting the remapped value.
- Deduplicate the evaluation and sample functions. Most of their code is the
  same, only the middle part is different.
- Changed albedo computation to return the sum of the intensities of the four
  BSDF lobes. Previously, the code applied the inverse of the color->sigma
  mapping from the paper - this returns the color specified in the node, but
  for very dark hair (e.g. when using the Melanin controls) the result is
  extremely low (e.g. 0.000001) despite the hair still reflecting a significant
  amount of light (since the R lobe is independent of sigma). This causes issues
  with the light component passes, so this change fixes #104586.
- There's quite a few computations at the start of the evaluation function that
  are needed for sampling, evaluation and albedo computation, but only depend on
  the view direction. Therefore, just precompute them - we still have space in
  PrincipledHairExtra after all.
- Fix a tiny bug - the direction sampling code did not account for the R lobe
  roughness modifier.

Pull Request #104669
2023-02-13 22:49:01 +01:00
7dbf2e2e95 Curves: Draw point overlay only in point selection mode
In case the selection domain is `ATTR_DOMAIN_CURVE` then do not draw the points.

Pull Request #104715
2023-02-13 22:25:06 +01:00
c92c52f0c9 Cleanup: Move draw_attributes.hh to C++
In order to experiment with different storage types for `DRW_Attributes`
and for general cleanup (see #103343). Also move a curves header to C++.

Pull Request #104716
2023-02-13 20:56:24 +01:00
dfacaf4f40 Fix: Incorrect BMesh to Mesh attribute copying
The existing logic to copy `BMesh` custom data layers to `Mesh`
attribute arrays was quite complicated, and incorrect in some cases
when the source and destinations didn't have the same layers.
The functions leave a lot to be desired in general, since they have
a lot of redundant complexity that ends up doing the same thing for
every element.

The problem in #104154 was that the "rest_position" attribute overwrote
the mesh positions since it has the same type and the positions weren't
copied. This same problem has shown up in boolean attribute conversion
in the past. Other changes fixed some specific cases but I think a
larger change is the only proper solution.

This patch adds preprocessing before looping over all elements to
find the basic information for copying the relevant layers, taking
layer names into account. The preprocessing makes the hot loops
simpler.

In a simple file with a 1 million vertex grid, I observed a 6%
improvement animation playback framerate in edit mode with a simple
geometry nodes modifier, from 5 to 5.3 FPS.

Fixes #104154, #104348

Pull Request #104421
2023-02-13 20:52:02 +01:00
0dfc102531 Fix #104588: Initialize Face Sets from edit mode selection broken
Mistake in da4bd24c3e
2023-02-13 14:16:23 -05:00
1e794d9a92 BMesh: Add flexibility for future lazily created UV selection
Don't crash on nonexisting uv selection layers. Add an assert
because for now it is a bug if they don't exist. But when converting
back to Mesh it is preferable to accept in release mode, as opposed to
crashing.

Pull Request #104600
2023-02-13 20:08:30 +01:00
684789c815 Fix #104501: Clear CD_FLAG_NOCOPY after use
When generating a Mesh from a BMesh the uv map bool layers are not
copied if all elements are false. To suppress the copying the flag
CD_FLAG_NOCOPY is set in the layer flags. However these layers *do*
need to be copied to other BMeshes (for example undo steps). So we
need to clear them afterwards.
2023-02-13 20:08:29 +01:00
72a85d976a USD Import: USD Shapes support
This commit adds the ability to import USD Shape primitives (Gprims).
They are imported as Blender Meshes using the USD API to convert, so
that they appear the same as they would in other applications. USD
Shapes are important in many workflows, particularly in gaming, where
they are used for stand-in geometry or for collision primitives.

Pull Request #104707
2023-02-13 19:49:24 +01:00
8d20db0594 Curves: Fix curve segment selection
Make sure that in curve selection mode, the segments are checked
for intersection instead of only the points.

Pull Request #104703
2023-02-13 19:05:28 +01:00
64f83f80c6 Fix #104373: Motion Tracker solve with anamorphic footage not working
The issue was caused by rather recent refactor in 7dea18b3aa.

The root of the issue lies within the fact that the optical center was updated
on the Blender side after the solution was run. There was a mistake in the code
which double-corrected for the pixel aspect ratio.

Added a comment in the code about this, so that it does not look suspicious.

Pull Request #104711
2023-02-13 18:49:45 +01:00
9b7d71cec2 Cleanup: Remove redundant translation markers in context poll message
`CTX_wm_operator_poll_msg_set()` is covered by the translation script
and always translates these strings. Checked with Bastien, he prefers
not having the redundancy here.
2023-02-13 18:41:38 +01:00
64e4aede7f Fix bug report including rB commit hash prefix not needed for Gitea 2023-02-13 18:34:13 +01:00
675717eb79 Cleanup: fix a few typos in UI messages
Issues reported by @Joan-Pujolar in #43295.

Pull Request #104672
2023-02-13 18:24:53 +01:00
c2a5c592fe Fix #103397: Vector UI control shader UBO alignment fix.
Replace float3 with packed_float3 when using additional type padding.

Authored by Apple: Michael Parkin-White

Ref #96261
Pull Request #104699
2023-02-13 18:16:38 +01:00
0e1a6f6033 Cleanup: Add in NLAStrip / NLATrack remove / clean methods
## Cleanup: Refactor NLATrack / NLAStrip Remove

This PR adds 3 new methods:
* BKE_nlatrack_remove_strip
* BKE_nlastrip_remove
* BKE_nlastrip_remove_and_free

These named BKE methods are really just replacements for BLI_remlink, but with some added checks, and enhanced readability.

Co-authored-by: Nate Rupsis <nrupsis@gmail.com>
Pull Request #104437
2023-02-13 18:10:13 +01:00
d42c803f5b Cleanup: add comment explaining #interpf is performing lerp 2023-02-13 17:32:19 +01:00
218a909dec GPencil: Fix unreported Eyedropper color difference in Materials
The color selected was converted wrongly for materials. The undo of the conversion must be done only for palettes.

Also, some code cleanup done.
2023-02-13 17:30:20 +01:00
bea1eff3a5 Fix: No update setting curve selection domain with all selected
Send a notification and tag for an update even if the selection doesn't
exist, which is still necessary for drawing that depends on the
selection domain.
2023-02-13 11:22:31 -05:00
d5c60fb685 Cleanup: add comment to cage gizmo scaling regarding the boundary 2023-02-13 17:08:23 +01:00
9fecf1f8b8 Cycles: Replace resolution divider loop with an analytical formula
As a side effect of this change, more resolution divisions are now available.
Before this patch the possible resolution divisions were all powers of two.
Now the possible resolution divisions are the multiples of pixel_size.

This increase in possible resolution divisions is the same idea proposed in https://archive.blender.org/developer/D13590.
In that patch there were concerns that this will increase the time between a user navigating
and seeing the 1:1 render. To my knowledge this is a non-issue and there should be
little to no increase in time between those two events.

Pull Request #104450
2023-02-13 13:02:47 +01:00
99e71ec1f2 Assets: Store pointer to owning asset library in asset representation
This is needed to be able to query asset library information from an
asset. This again is relevant especially for the "All" asset library,
where you can't just directly access the library itself, which is
different for different assets.

The current design is that an asset representation is owned by exactly
one asset library, so having this pointer is perfectly compatible with
the design.

Reviewed by: Julian Eisel
2023-02-13 12:57:03 +01:00
4f19e99cb1 Tests: add unit test for BLI_strnlen
It wasn't there. Now it is.
2023-02-13 12:54:35 +01:00
147c75b831 Cleanup: EEVEE-Next: Fix typo 2023-02-13 12:49:51 +01:00
0d9fbfe7fe GPUShader: Fix compilation caused by designated initializers in C++ 2023-02-13 12:49:22 +01:00
da0c182a61 Cycles: Fix compilation after recent GPU cleanups 2023-02-13 12:17:46 +01:00
dd171f7743 Cleanup: GPUShader: Rename GPU_shader_uniform_vector
Rename to `GPU_shader_uniform_float/int_ex` to make more sense as a
general purpose function.
2023-02-13 11:22:38 +01:00
b68bac7ced Cleanup: GPUShader: Remove GPU_shader_uniform_int/float
Simplify the API, leaving only one function to set uniform without the
uniform name.
2023-02-13 11:22:38 +01:00
173a8f4ac9 GPU: Removes GPU_shader_get_builtin_ssbo
Simplify the API. Use hardcoded ssbo location instead.
2023-02-13 11:22:38 +01:00
164f591033 Cleanup: GPU: Rename some functions for consistency 2023-02-13 11:22:38 +01:00
83a6642045 Cleanup: GPU: Move eGPUKeyframeShapes to shader shared
Removes code duplication.
2023-02-13 11:22:38 +01:00
158f87203e Cleanup: GPUShader: Reorganize GPU_shader.h to separate depecated API
This avoid confusion to what to use nowadays.
Also improves documentation.
2023-02-13 11:22:38 +01:00
d92c28582a Cleanup: GPUShader: Split Builtins to their own header
Also improve documentation and cleanup.
2023-02-13 11:22:38 +01:00
d165d6aa2a GPU: Remove GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR
This replaces `GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR` by
GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA`.

None of the usage made sense to not use the AA shader.
Scale the point size to account for the rounded shape.
2023-02-13 11:22:38 +01:00
5f3c97b999 GPU: Move gpu_shader_builtin.c to C++
This also removes all unused part of it now that we have converted all
shaders to use create infos.
2023-02-13 11:22:38 +01:00
afd6358fc0 Gizmo: add gizmos for spot and point light radius
Ref #104280

Pull Request #104410
2023-02-13 11:18:21 +01:00
701f90c677 Gizmo: make cage gizmo follow the cursor exactly when scaling
Ref #104280
The scaling of area light / spot light blend was wrong because it is
calculated for pivot at the edges. The new implementation in theory
works for all `abs(pivot) <= 0.5f`, although we only have -0.5, 0, and
0.5.
- Axis constraint for box cage was only applied when there is translate
flag, now the same logic is applied regardless of the translate flag,
this means when dragging the edge, the scaling in the other axis stays
the same; when dragging the corners, it applies free-form scaling.
- Due to the existence of margin, `data->orig_mouse` does not lie
exactly on the boundary. Using that value to compute the scaling causes
the error to accumulate over distance. The new implementation uses the
original dimension of the object instead, and only uses
`data->orig_mouse` to determine the side of the original cursor relative
to the pivot.
- For circular gizmo with unsigned scaling, the gizmo only follow the
cursor exactly when the cursor stays in the original quadrant, otherwise
it's hard to handle the logic when we should clamp the scaling.
2023-02-13 10:48:31 +01:00
9f4ee75c9b Fix #80307: Underline shortcut not working in enum context menus
The buttons of enum context menus are of type `UI_BUT_ROW`. They
are part of the set of buttons we create underline shortcuts for in
`ui_menu_block_set_keyaccels`.
But since they weren't handled in `ui_handle_button_activate_by_type`,
pressing the underline shortcuts didn't do anyting in those cases.

Co-authored-by: Leon Schittek <leon.schittek@gmx.net>
Co-authored-by: Brecht Van Lommel <brecht@noreply.localhost>
Pull Request #104433
2023-02-13 10:43:36 +01:00
2e19aa1399 UI: add camera passepartout color to theme
Currently the passepartout color is hardcoded to black. While a
sensible default for cinema, it may make less sense for other media,
whether video, print, web, etc. It greatly affects viewing conditions
of the image and should be user selectable, much like painting
programs allow.

Pull Request #104486
2023-02-13 09:15:34 +01:00
918cf6cd77 Fix #104341: Handle edge case in Curve to Mesh node
Don't create caps when using cyclic profile splines with two or fewer
points.
This case wasn't handled, yet, leading to invalid meshes or crashes.

Co-authored-by: Leon Schittek <leon.schittek@gmx.net>
Pull Request #104594
2023-02-13 09:03:00 +01:00
af8941e6a8 Vulkan: Use guardedalloc for driver allocations.
Vulkan has a pluggable memory allocation feature, which allows internal
driver allocations to be done by the client application provided
allocator. Vulkan uses this for more client application allocations
done inside the driver, but can also do it for more internal oriented
allocations.

VK_ALLOCATION_CALLBACKS initializes allocation callbacks for host allocations.
The macro creates a local static variable with the name vk_allocation_callbacks
that can be passed to vulkan API functions that expect
const VkAllocationCallbacks *pAllocator.

When WITH_VULKAN_GUARDEDALLOC=Off the memory allocation implemented
in the vulkan device driver is used for both internal and application
oriented memory operations.

For now this would help during the development of Vulkan backend to
detect hidden memory leaks that are hidden inside the driver part
of the stack. In a later stage we need to measure the overhead and
if this should become the default behavior.

Pull Request #104434
2023-02-13 08:37:35 +01:00
f828ecf4ba GPU: Use same read back API as SSBOs
The GPU module has 2 different styles when reading back data from
GPU buffers. The SSBOs used a memcpy to copy the data to a
pre-allocated buffer. IndexBuf/VertBuf gave back a driver/platform
controlled pointer to the memory.

Readback is done for test cases returning mapped pointers is not safe.
For this reason we settled on using the same approach as the SSBO.
Copy the data to a caller pre-allocated buffer.

Reason why this API is currently changed is that the Vulkan API is more
strict on mapping/unmapping buffers that can lead to potential issues
down the road.

Pull Request #104571
2023-02-13 08:34:19 +01:00
86b3073c9e Cleanup: Quiet unused variable warning
Also name another argument for consistency.
2023-02-12 22:27:07 -05:00
2a7440176e Fix: Missing const specifier for curve field input
Mistake in 000e722c7d, which probably made the viewer node
auto-domain detection behave differently when the special case was used.
2023-02-12 20:17:41 -05:00
6ea3fdebc8 Fix: Workbench Next: Extruded frustum binding 2023-02-12 23:40:28 +01:00
77963ff778 Fix #104637: EEVEE Displacement regression after #104595
Keep using the 3 evaluations dF_branch method for the Displacement output.
The optimized 2 evaluations method used by node_bump is now on its own macro (dF_branch_incomplete).
displacement_bump modifies the normal that nodetree_exec uses, so even with a refactor it wouldn’t be possible to re-use the computation anyway.
2023-02-12 23:06:21 +01:00
f0669ff8ba BLI: use larger integer type in BitVector
Using larger integer types allows for more efficient code, because we
can use the hardware better. Instead of working on individual bytes,
the code can now work on 8 bytes at a time. We don't really benefit
from this immediately but I'm planning to implement some more optimized
bit vector operations for #104629.

Pull Request #104658
2023-02-12 18:00:48 +01:00
3f40962414 Cleanup: use sized int types for polyfill_2d
Also correct building when USE_CLIP_EVEN is disabled.
2023-02-12 16:35:24 +11:00
32149f8d7a Tests: add polyfill2d test to ensure the result has no zero area tris
Add a test to address the issue raised in #103913, where zero area
triangles could be created from polygons that have co-linear edges
but were not degenerate.
2023-02-12 16:26:34 +11:00
91346755ce Cleanup: use '#' prefix for issues instead of 'T'
Match the convention from Gitea instead of Phabricator's T for tasks.
2023-02-12 14:56:05 +11:00
a02fa6c40d Cleanup: spelling in comments 2023-02-12 14:23:16 +11:00
10354b043f Fix crash selecting faces in wire-frame mode
Regression in [0] didn't account for the mesh not having
subdivision surface is applied.

[0]: 75db4c082b
2023-02-12 14:20:52 +11:00
c7456272b1 Cleanup: EEVEE-Next: Add LIGHT_FOREACH macros to clang-format exceptions 2023-02-12 01:41:54 +01:00
77aa9e8809 Cleanup: GPU: Remove commented lines without any comments or purpose
These were added during a big refactor. They were supposed to be
uncommented at some point but the new code does not even need a default
world.
2023-02-12 01:21:53 +01:00
d33960aead Cleanup: remove whole-archive linking for USD
Since USD is no longer statically linked these linker tricks
are no longer needed.

Co-authored-by: Ray Molenkamp <github@lazydodo.com>
Pull Request #104627
2023-02-11 19:48:47 +01:00
085c854b2a Fix curves selection toggling 2023-02-11 19:23:48 +01:00
82867753cf Transform: Hide trackball gizmo while dragging
It was accidentally displayed in a38d99e0b2.
2023-02-11 15:22:57 -03:00
232e02282e Fix circular transform gizmo always displaying Global orientation
The Global orientation comes from the mode's default orientation
(without the constraints).

It's not really exposed.
2023-02-11 15:20:38 -03:00
b9fa32cccd Fix #104587: 'Extrude To Cursor' snapping ignoring 'Target Selection'
Although not a transform operator, `Extrude to Cursor` depends on some
snapping settings.

So it should use the `Target Selection` options as well.
2023-02-11 14:50:37 -03:00
197eee6e04 Fix transform gizmos not changing in Automatic Constraint mode 2023-02-11 13:56:06 -03:00
e732580fcc Nodes: change order of Hide Value and Hide in Modifier
Based on the review comment in #104517.
2023-02-11 16:14:38 +01:00
158f809dcb Geometry Nodes: Add option to hide input in modifier
When building a node group that's meant to be used directly in the
node editor as well as in the modifier, it's useful to be able to have
some inputs that are only meant for the node editor, like inputs that
only make sense when combined with other nodes.

In the future we might have the ability to only display certain assets
in the modifier and the node editor, but until then this simple solution
allows a bit more customization.

Pull Request #104517
2023-02-11 16:11:10 +01:00
19ea673260 Cleanup: Remove const keyword in declarations 2023-02-11 15:05:55 +01:00
b723a398f3 Curves: initial surface collision for curves sculpt mode
During hair grooming in curves sculpt mode, it is very useful when hair strands
are prevented from intersecting with the surface mesh. Unfortunately, it also
decreases performance significantly so we don't want it to be turned on all the time.

The surface collision is used by the Comb, Pinch and Puff brushes currently.
It can be turned on or off on a per-geometry basis.

The intersection prevention quality of this patch is not perfect yet. This can
be improved over time using a better solver. Overall, perfect collision detection
at the cost of bad performance is not necessary for interactive sculpting,
because the user can fix small mistakes very quickly. Nevertheless, the quality
can probably still be improved significantly without too big slow-downs depending
on the use case. This can be done separately from this patch.

Pull Request #104469
2023-02-11 13:46:37 +01:00
0f708fa2e3 Geometry Nodes: use smooth normals in Distribute Points on Faces node
Previously, the node used the "true" normal of every looptri. Now it uses the
"loop normals" which includes e.g. smooth faces and custom normals. The true
normal can still be used on the points by capturing it before the Distribute node.

We do intend to expose the smooth normals separately in geometry nodes as well,
but this is an important first step.

It's also necessary to generate child hair between guide hair strands that don't
have visible artifacts at face boundaries.

For perfect backward compatibility, the node still has a "Legacy Normal" option
in the side bar. Creating the exact same behavior with existing nodes isn't
really possible unfortunately because of the specifics of how the Distribute
node used to compute the normals using looptris.

Pull Request #104414
2023-02-11 13:25:59 +01:00
6478eb565a Cleanup: format 2023-02-11 14:26:56 +11:00
fefc6a73b3 Fix pep8 checker operating on dot-files
Temporary editor files were included which could make the checker fail.
2023-02-11 14:12:43 +11:00
9f4edf8c2a Cleanup: remove unused variables 2023-02-11 14:04:35 +11:00
ce44953933 Cleanup: various C++ cleanups 2023-02-11 14:04:35 +11:00
343bb4a5a3 Cleanup: Use const char * for layer names in collada exporter
CustomData layer names should not be written except via the CusomData
api. Therefore use const char * instead of char * when referencing the
layer name.

Pull Request #104585
2023-02-11 01:13:38 +01:00
efabe81c91 Fix #103903: Bump Node performance regression
Avoid computing the non-derivative height twice.
The height is now computed as part of the main function, while the height at x and y offsets are still computed on a separate function.
The differentials are now computed directly at node_bump.

Co-authored-by: Miguel Pozo <pragma37@gmail.com>
Pull Request #104595
2023-02-10 21:06:53 +01:00
0e6da74e98 Fix #104282: Resolve Depth read for D24_S8 types in Metal.
Fixes incorrect spotlight gizmo orientation when moving.

Authored by Apple: Michael Parkin-White

Related to #96261

Pull Request #104537
2023-02-10 20:40:07 +01:00
8a32d56056 Tests: Fix device list of benchmark script only showing a single GPU
Pull Request #104583
2023-02-10 19:38:37 +01:00
7351f533e0 Curves: Add lasso and circle select
This adds a `select_lasso` and a `select_circle` function for the Curves object. It is used in the `view3d_lasso_select` and `view3d_circle_select` operator.

Co-authored-by: Falk David <falkdavid@gmx.de>
Pull Request #104560
2023-02-10 19:06:08 +01:00
5c4e1ed578 UI: Make text nomenclature and ordering consistent
"Center" -> "Middle" when describing vertical alignment.
"Align X" -> "Horizontal Alignment"
"Align Y" -> "Vertical Alignment"
Vertical alignment options rearranged to be consistently top-most to
bottom-most.

---

Co-authored-by: joshua-maros <60271685+joshua-maros@users.noreply.github.com>
Pull Request #104493
2023-02-10 19:05:37 +01:00
6f8c441950 Curves: Add select linked
This adds a new `select_linked` function that selects all the points
on a curve if there is at least one point already selected.
This also adds a keymap for the operator.

Co-authored-by: Falk David <falkdavid@gmx.de>
Pull Request #104569
2023-02-10 18:58:08 +01:00
d411be8a99 Cleanup: Use utility function to find groups in node tree
Add `contains_group` method in python api for `NodeTree` type, cleanup
`ntreeHasTree` function, reuse `ntreeHasTree` in more place in code.
The algorithm has been changed to not recheck trees by using set.

Performance gains from avoiding already checked node trees:
Based on tests, can say that for large files with a huge number
of trees, the response speed of opening the search menu in the
node editor increased by ~200 times (for really large projects
with 16 individual groups in 6 levels of nesting). Group insert
operations are also accelerated, but this is different in some cases.

Pull Request #104465
2023-02-10 17:30:55 +01:00
fae661a1ab Revert "Un-ignore modules in .gitmodules configuration"
This reverts commit aab707ab70.

A different solution to the submodule problem is being considered in #104573.
Revert to the previous behavior that developers are familiar with for now.
2023-02-10 17:15:28 +01:00
923152d180 Geometry Nodes: improve parallelization in Delete/Separate Geometry node
This just adds `threading::parallel_for` and `threading::parallel_invoke` in a few
places where it can be added trivially. The run time of the `separate_geometry`
function changes from 830 ms to 413 ms in my test file.

Pull Request #104563
2023-02-10 17:14:30 +01:00
0ea15a6fbb Fix: Inaccessible default for node group image sockets
The type was just skipped when drawing defaults for the image sockets.
2023-02-10 09:22:45 -05:00
284cdbb6cf Cleanup: Use lambdas in mesh mapping callback, remove unused arguments
Using callback functions didn't scale well as more arguments are added.
It got very confusing when to pass tehmarguments weren't always used.
Instead use a `FunctionRef` with indices for arguments. Also remove
unused edge arguments to topology mapping functions.
2023-02-10 08:37:50 -05:00
bad2c3b9ef Geometry Nodes: Experimental option for Volumes
Adds an experimental option under "New Features" in preferences,
which enables visibility of the new Volume Nodes.
Right now this option does nothing but will be used during development.
See #103248

Pull Request #104552
2023-02-10 14:21:01 +01:00
88f9c55f7f Sculpt: Fix Dyntopo Warnings
Because of T95965, some attributes are stored as generic attributes
in Mesh but have special handling for the conversion to BMesh.

Expose a function to tell whether certain attribute names are handled
specially in the conversion, and refactor the error checking process
to use it. Also check for generic attributes on the face domain which
wasn't done before.

Author: Hans Goudey
Reviewed By: Joseph Eagar

Co-authored-by: Joseph Eagar <joeedh@gmail.com>
Pull Request #104567
2023-02-10 13:16:10 +01:00
dc9f7fe64f Fix #104514: GPencil merge down layer misses some frames
When merging two gpencil layers, if the destination layer had a keyframe
where the source layer did not, strokes of the previous keyframe
in source layer were lost in that frame.

This happened because the merge operator was looping through
frames of the source layer and appending strokes in the
corresponding destination layer, but never completing
other frames than the ones existing in the source layer.

This patch fixes it by first adding in source layer
all frames that are in destination layer.

Co-authored-by: Amelie Fondevilla <amelie.fondevilla@les-fees-speciales.coop>
Pull Request #104558
2023-02-10 12:55:06 +01:00
Lucas Tadeu Teixeira
5d30c3994e Sequencer: Don't create undo step when click-select does nothing
When the sequencer is empty (i.e., there are no sequences),
we would have the deselect_all variable set to true called
ED_sequencer_deselect_all to select any existing sequences.

Ref !104453
2023-02-10 21:49:42 +11:00
51ceeb506f Fix #104026: Click-Drag to select graph editor channels no longer working
Box-Selecting channels in the dope sheet with click-drag was no longer possible as of Blender 3.2

Due to the removal of tweak events the box select operator was always shadowed by the click operator.

Original Phabricator discussion here: https://archive.blender.org/developer/D17065

Use `WM_operator_flag_only_pass_through_on_press` on click operator to fix it

Co-authored-by: Christoph Lendenfeld <chris.lenden@gmail.com>
Pull Request #104505
2023-02-10 11:36:01 +01:00
01480229b1 Cycles: Fix MetalRT checkbox not hooked up to device on AMD
(Follow on from D17043)
On AMD Navi2 devices the MetalRT checkbox was not hooked up properly and had no effect. This patch fixes it.

Co-authored-by: Michael Jones <michael_p_jones@apple.com>
Pull Request #104520
2023-02-10 10:55:39 +01:00
b77c82e2bb Tests: minor updates to make bl_rna_manual_reference more useful
- Avoid flooding the output with every match that succeeds.
- Report patterns listed in the manual that don't match anything in
  Blender.
- Disable external URL lookups, this is too slow.
  Instead use a LOCAL_PREFIX (a local build of the manual)
  or skip the test.
2023-02-10 14:04:15 +11:00
c2c62c3618 RNA: return a dummy language value when WITH_INTERNATIONAL=OFF
Without this, every access to "language" would warn that the enum
value didn't match a value in the enum items.

This made the bl_rna_manual_reference.py test output practically
unusable.
2023-02-10 13:18:33 +11:00
a8d951abdd Docs: remove malformed patterns for RNA mapping
The generator now skips these with a warning, they will need to be
corrected in the user manual.

This caused tests/python/bl_rna_manual_reference.py to fail looking
up URL's.
2023-02-10 13:04:27 +11:00
4cbe0bff34 Cleanup: spelling in comments 2023-02-10 11:34:20 +11:00
48d9363fa7 Cleanup: quiet clang compiler warnings
- undeclared variable warning.
- unreachable-code-return warnings.
- array-parameter, mismatch bound.
- 'requires' is a keyword in C++20, (rename to requires_flag).
2023-02-10 11:27:30 +11:00
8ac3096e24 Fix add-on & manual link in Help menu ignoring the current language
Use bpy.utils.manual_language_code() create manual URL's instead of
assuming English.
2023-02-10 11:02:45 +11:00
2ee9c12a23 PyAPI: add bpy.utils.manual_locale_code()
Move the function for getting the language code associated with the
user manual into a utility function (from the generated
rna_manual_reference.py).

This allows other parts of Blender to create a manual URL based on the
current locale preferences and environment.

Ref !104494
2023-02-10 11:01:02 +11:00
2d351e9ee3 Cleanup: format 2023-02-10 10:48:50 +11:00
7e0e07657c GPU: Cleanup GPU_batch.h documentation and some of the API for consistency
Documented all functions, adding use case and side effects.

Also replace the use of shortened argument name by more meaningful ones.

Renamed `GPU_batch_instbuf_add_ex` and `GPU_batch_vertbuf_add_ex` to remove
the `ex` suffix as they are the main version used (removed the few usage
of the other version).

Renamed `GPU_batch_draw_instanced` to `GPU_batch_draw_instance_range` and
make it consistent with `GPU_batch_draw_range`.
2023-02-09 22:46:35 +01:00
5c8edbd99b Cleanup: Move 6 sculpt-session-related files and header to C++
To allow further mesh data structure refactoring. See #103343

Pull Request #104540
2023-02-09 20:35:50 +01:00
2cfc4d7644 Fix #104383: don't update declaration for clipboard copy
When nodes are copied to the clipboard, they don't need their declaration.
For nodes with dynamic declaration that might depend on the node tree itself,
the declaration could not be build anyway, because the node-clipboard does
not have a node tree.

Pull Request #104432
2023-02-09 19:20:39 +01:00
bc0d3c91b1 Fix #104435: Fix rna_NlaStrip_new add strip logic to be correct boolean expression
Fixed #104435: Use correct conditional logic when testing if a new NLA strip can be added in the rna_NlaStrip_new method
2023-02-09 19:09:27 +01:00
50918d44fb Cleanup: Fix const correctness warning in recent commit 2023-02-09 11:26:38 -05:00
Kevin C. Burke
1649921791 Fix: Sequencer "Pan" label using incorrect keyword 'heading_ctxt'
Oversight in db87e2a638

Reviewed By: ISS
Differential Revision: https://archive.blender.org/developer/D17213
2023-02-09 16:33:50 +01:00
50dfd5f501 Geometry Nodes: Edges to Face Groups Node
Add a new node that groups faces inside of boundary edge regions.
This is the opposite action as the existing "Face Group Boundaries"
node. It's also the same as some of the "Initialize Face Sets"
options in sculpt mode.

Discussion in #102962 has favored "Group" for a name for these
sockets rather than "Set", so that is used here.

Pull Request #104428
2023-02-09 16:27:20 +01:00
bfa7f9db0e Assets: Implement viewport drag and drop for geometry nodes
Currently there's no way to assign a geometry node group from the asset
browser to an object as a modifier without first appending/linking it
manually. This patch adds a drag and drop operator that adds a new
modifier and assigns the dragged tree.

Pull Request #104430
2023-02-09 16:04:14 +01:00
b8e15a4a84 Fix: Add missing "-" in logic to get the channel height
This was missed when doing the refactoring in #104500
It didn't seem to have any effect until I worked on clamping the view
2023-02-09 15:59:57 +01:00
7ca651d182 Mesh: Remove unnecessary edge draw flag
As described in #95966, replace the `ME_EDGEDRAW` flag with a bit
vector in mesh runtime data. Currently the the flag is only ever set
to false for the "optimal display" feature of the subdivision surface
modifier. When creating an "original" mesh in the main data-base,
the flag is always supposed to be true.

The bit vector is now created by the modifier only as necessary, and
is cleared for topology-changing operations. This fixes incorrect
interpolation of the flag as noted in #104376. Generally it isn't
possible to interpolate it through topology-changing operations.

After this, only the seam status needs to be removed from edges before
we can replace them with the generic `int2` type (or something similar)
and reduce memory usage by 1/3.

Related:
- 10131a6f62
- 145839aa42

In the future `BM_ELEM_DRAW` could be removed as well. Currently it is
used and aliased by other defines in some non-obvious ways though.

Pull Request #104417
2023-02-09 15:56:05 +01:00
3bed78ff59 Curves: Add box selection
This adds a `select_box` function for the `Curves` object. It is used in the `view3d_box_select` operator.

It also adds the basic selection tools in the toolbar of Edit Mode.

Authored-by: Falk David <falkdavid@gmx.de>
Pull Request #104411
2023-02-09 15:53:42 +01:00
22edf04458 I18n: use format strings for Cycles version error messages
The required version numbers for various devices was hardcoded in the
UI messages. The result was that every time one of these versions was
bumped, every language team had to update the message in question.

Instead, the version numbers can be extracted, and injected into the
error messages using string formatting so that translation updates
need happen less frequently.

Pull Request #104488
2023-02-09 15:48:19 +01:00
666c2ea012 Refactor: remove yscale from bAnimContext
`bAnimContext` had a float property called `yscale_fac` that was used to define the height of the keyframe channels.

However the property was never set, only read so there really is no need to have it in the struct.

Moreover it complicated getting the channel height because `bAnimContext` had to be passed in.

Speaking of getting the channel height. This was done with macros. I ripped them all out and replaced them with function calls.

Originally it was introduced in this patch: https://developer.blender.org/rB095c8dbe6919857ea322b213a1e240161cd7c843

Co-authored-by: Christoph Lendenfeld <chris.lenden@gmail.com>
Pull Request #104500
2023-02-09 14:28:04 +01:00
ca183993a5 Fix freeing uninitialized pointer in GHOST/Wayland + X11 fallback
Freeing the timer manager didn't account for Wayland being partially
initialized.
2023-02-09 23:41:03 +11:00
0e196bab76 Build: disable LTO for Python builds
LTO compiled libpython3.10.a failed to link with GCC 12.0,
disable since these libraries are intended for developers to link
against.
2023-02-09 23:00:08 +11:00
f222fe6a3a Build: enable Python optimizations (PGO & LTO) on Linux
This is used for most Python release builds and has been reported to
give a modest 5-10% speedup (depending on the workload).

This could be enabled on macOS too but needs to be tested.
2023-02-09 20:59:08 +11:00
8b35db914e GPU: Fix assert when using light gizmo.
Blender was reporting that the GPU_TEXTURE_USAGE_HOST_READ wasn't set.
This is used to indicate that the textures needs to be read back to
CPU. Textures that don't need to be read back can be optimized by the
GPU backend.

Found during investigation of #104282.
2023-02-09 08:36:27 +01:00
1883e782cb Spelling: Assert message in GPU_texture_read. 2023-02-09 08:11:11 +01:00
7effc6ffc4 Cleanup: solve compiler warnings.
Classes were predefined as structs.
2023-02-09 08:01:33 +01:00
f3d7de709f Cycles: update Intel Graphics Compiler to 1.0.13064.7 on Linux
Linux side of 8afcecdf1f.

Reviewed by: LazyDodo, sergey, campbellbarton
Ref !104458, 16984
2023-02-09 15:43:23 +11:00
3c8f7b1a64 Cleanup: Remove unused/redundant includes from BKE_curves.hh
Avoid including headers that are obviously redundant, and don't
include BLI_task.hh in the header file, since it isn't really related.
2023-02-08 20:29:52 -05:00
0381fe7bfe Cleanup: update username in code-comments: campbellbarton -> ideasman42
Gitea migration changed my username, update code-comments.
2023-02-09 11:33:48 +11:00
5f842ef336 Cleanup: spelling in comments 2023-02-09 11:24:50 +11:00
5b110548eb Cleanup: enum conversion compiler warnings 2023-02-09 11:18:32 +11:00
9fd71d470e PyAPI: minor change to rna_manual_reference loading
- Use bpy.utils.execfile instead of importing then deleting from
  sys.modules.
- Add a note for why keeping this cached in memory isn't necessary.

This has the advantage of not interfering with any scripts that import
`rna_manual_reference` as a module.
2023-02-09 11:18:15 +11:00
94d280fc3f EEVEE-Next: Shadows: Add global switch
This allow to bypass all cost associated with shadow mapping.

This can be useful in certain situation, such as opening a scene on a
lower end system or just to gain performance in some situation (lookdev).
2023-02-09 00:48:33 +01:00
9103978952 EEVEE-Next: Shadow: Fix issue with last merge
The merge with master updated the code to use the new matrix API. This
introduce some regressions.

For sunlights make sure there is enough tilemaps in orthographic mode
to cover the depth range and fix the level offset in perspective.
2023-02-08 23:45:12 +01:00
9c03a1c92f Fix Cycles link error with debug/asan builds after recent bugfix
Pull Request #104487
2023-02-08 23:20:29 +01:00
a0f5240089 EEVEE-Next: Virtual Shadow Map initial implementation
Implements virtual shadow mapping for EEVEE-Next primary shadow solution.
This technique aims to deliver really high precision shadowing for many
lights while keeping a relatively low cost.

The technique works by splitting each shadows in tiles that are only
allocated & updated on demand by visible surfaces and volumes.
Local lights use cubemap projection with mipmap level of detail to adapt
the resolution to the receiver distance.
Sun lights use clipmap distribution or cascade distribution (depending on
which is better) for selecting the level of detail with the distance to
the camera.

Current maximum shadow precision for local light is about 1 pixel per 0.01
degrees.
For sun light, the maximum resolution is based on the camera far clip
distance which sets the most coarse clipmap.

## Limitation:
Alpha Blended surfaces might not get correct shadowing in some corner
casses. This is to be fixed in another commit.
While resolution is greatly increase, it is still finite. It is virtually
equivalent to one 8K shadow per shadow cube face and per clipmap level.
There is no filtering present for now.

## Parameters:
Shadow Pool Size: In bytes, amount of GPU memory to dedicate to the
shadow pool (is allocated per viewport).
Shadow Scaling: Scale the shadow resolution. Base resolution should
target subpixel accuracy (within the limitation of the technique).

Related to #93220
Related to #104472
2023-02-08 21:18:44 +01:00
0ab3ac7a41 BLI: Math: Fix vector operator * with MutableMatView
This was caused by operator priority trying to use
`friend VecBase operator*(const VecBase &a, FactorT b)`.

Adding tests as these were not covered.
2023-02-08 19:38:53 +01:00
a1282ab015 Fix Cycles debug build error after host falback changes
Introduced in dcfb6df9ce6.

Co-authored-by: Lucas Tadeu Teixeira <lucas@lucastadeu.com>

Pull Request #104454
2023-02-08 19:27:40 +01:00
43f308f216 Make update: Ignore submodules
The previous change in the .gitmodules made it so the `make update`
rejects to do its thing because it now sees changes in the submodules
and rejected to update, thinking there are unstaged changes.

Ignore the submodule changes, bringing the old behavior closer to
what it was.
2023-02-08 14:05:50 +01:00
aab707ab70 Un-ignore modules in .gitmodules configuration
The meaning of the ignore option for submodules did change since our
initial Git setup was done: back then it was affecting both diff and
stage families of Git command. Unfortunately, the actual behavior did
violate what documentation was stating (the documentation was stating
that the option only affects diff family of commands). This got fixed
in Git some time after our initial setup and it was the behavior of the
commands changed, not the documentation. This lead to a situation when
we can no longer see that submodules are modified and staged, and it is
very easy to stage the submodules.

For the clarity: diff and status are both "status" family, show and
diff are "diff" family.

Hence this change: since there is no built-in zero-configuration way
of forbidding Git from staging submodules lets make it visible and
clear what the state of submodules is.

We still need to inform people to not stage submodules, for which
we can offer some configuration tips and scripts but doing so is
outside of the scope of this change at it requires some additional
research. Current goal is simple: make it visible and clear what is
going to be committed to Git.

This is a response to an increased frequency of incidents when the
submodules are getting modified and committed without authors even
noticing this (which is also a bit annoying to recover from).

Differential Revision: https://developer.blender.org/D13001
2023-02-08 11:32:32 +01:00
4ed8a360e9 Fix references to the main branch in the .gitmodules 2023-02-08 11:01:01 +01:00
4d3bfb3f41 Subdivision Surface: fix a serious performance hit when mixing CPU & GPU.
Subdivision surface efficiency relies on caching pre-computed topology
data for evaluation between frames. However, while eed45d2a23
introduced a second GPU subdiv evaluator type, it still only kept
one slot for caching this runtime data per mesh.

The result is that if the mesh is also needed on CPU, for instance
due to a modifier on a different object (e.g. shrinkwrap), the two
evaluators are used at the same time and fight over the single slot.
This causes the topology data to be discarded and recomputed twice
per frame.

Since avoiding duplicate evaluation is a complex task, this fix
simply adds a second separate cache slot for the GPU data, so that
the cost is simply running subdivision twice, not recomputing topology
twice.

To help diagnostics, I also add a message to show when GPU evaluation
is actually used to the modifier panel. Two frame counters are used
to suppress flicker in the UI panel.

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

Pull Request #104441
2023-02-08 10:27:22 +01:00
d781e52ee0 Cleanup: use enum literals, order likely case first in polyfill_2d 2023-02-08 17:06:54 +11:00
09eb4fe19a Fix #103913: Triangulate sometimes creates degenerate triangles
The ear clipping method used by polyfill_2d only excluded concave ears
which meant ears exactly co-linear edges created zero area triangles
even when convex ears are available.

While polyfill_2d prioritizes performance over *pretty* results,
there is no need to pick degenerate triangles with other candidates
are available. As noted in code-comments, callers that require higher
quality tessellation should use BLI_polyfill_beautify.
2023-02-08 16:59:42 +11:00
6aa1b5d031 Cleanup: format 2023-02-08 00:21:57 +01:00
5c994d7846 Fix #104297: Cycling geometry nodes viewer ignores sockets
Sockets after the geometry socket were ignored when cycling through
the node's output sockets. If there are multiple geometry sockets, the
behavior could still be refined probably, but this should at least make
basic non-geometry socket cycling work.
2023-02-07 16:01:54 -05:00
53b057aa09 Cleanup: Move 18 sculpt files to C++
To allow further mesh data structure refactoring. See #103343

Pull Request #104436
2023-02-07 21:56:45 +01:00
e817cff009 Release: support generating LTS release notes from Gitea
Now a single script to generate both links and release notes. It also includes
the issue ID for the LTS releases, so only the release version needs to be
specified.

Pull Request #104402
2023-02-07 21:23:24 +01:00
41ddd3d732 Fix: Experimental Panel links modified for Gitea
Modifies the links to point to the new developer site.

Pull Request #104425
2023-02-07 19:54:43 +01:00
f5552d759c Fix compiler error 2023-02-07 18:32:24 +01:00
f01bf82480 Curves: Add select pick operator
This adds the `select_pick` function for to `Curves` objects.
It is used in the common `view3d_select` operator.

Pull Request #104406
2023-02-07 17:50:39 +01:00
8d9d16fb53 Fix #104396: Blender crashes when moving Keyframes in Graph Editor
`t->region->gizmo_map` can be `nullptr`.

Caused by 19b63b932d
2023-02-07 12:59:35 -03:00
349350b304 Fix T104390: Regression: Object selection in viewport is not working
Caused by alignment difference between C and C++. Asan caught the issue
on startup.

Removing the unused view matrix storage copy avoids this problem.
2023-02-07 16:45:47 +01:00
cb5318b651 Docs: change Git URLs to point projects.blender.org instead of git.blender.org 2023-02-07 14:23:05 +01:00
bd6b0bac88 Update references to the new projects platform and main branch 2023-02-07 14:18:19 +01:00
3002670332 Fix T104368: Incorrect tooltip text in Blender 3.4.1's Preferences > File Paths > Scripts field.
Use backticks to cleary identify 'path' parts of this tooltip.
2023-02-07 09:50:50 +01:00
f086cf3cea Cleanup: remove redundant parenthesis 2023-02-07 17:34:20 +11:00
2609ca2b8e Cleanup: tweaks to cycles/metal preferences
- Auto-format.
- Use raw string for regex.
- Remove redundant assignment.
- Remove duplicate arm64 check.
- Break early out of loop.
2023-02-07 17:30:13 +11:00
b-init
7e8153b07d Keymap: support default shortcut to toggle overlays in all space-types
UV Editor, Image Editor & Sequencer didn't have a shortcut for toggling
overlays. Use the same shortcut as the 3D viewport.

Ref D16959
2023-02-07 16:54:06 +11:00
622cad7073 Cleanup: minor tweak to recent fix for T10438
Minor change to [0], prefer calling em_setup_viewcontext,
even though there is no functional difference at the moment,
if this function ever performs additional operations than assigning
`ViewContext.em`, it would have to be manually in-lined in
`view3d_circle_select_recalc`.

[0]: 430cc9d7bf
2023-02-07 16:18:30 +11:00
44daeaae7d Cleanup: use arg instead of param for generated sphinx docs 2023-02-07 15:14:22 +11:00
db8b5a2316 PyDoc: remove deprecated dpi argument from BLF example 2023-02-07 15:12:05 +11:00
dbca0cc9d5 Fix crash on exit under Wayland
Order of free error from [0] caused the timer manager
to be freed before the timer.

[0]: 7de1a4d1d8
2023-02-07 15:12:05 +11:00
e4f77c1a6c Cleanup: format 2023-02-07 16:57:35 +13:00
Jon Denning
e27c89c7c7 Docs: added missing documentation for WindowManager methods
Added missing documentation for `draw_cursor_add` and
`draw_cursor_remove` methods for `WindowManager`.

Differential Revision: https://developer.blender.org/D14860
2023-02-06 22:40:10 -05:00
af5706c960 Docs: improve doc-string for WM_operator_flag_only_pass_through_on_press
The doc-string didn't provide any context for how the funciton is
intended to be used.
2023-02-07 14:18:59 +11:00
a99022e22d Cleanup: spelling in comments 2023-02-07 14:17:01 +11:00
d5af895419 Fix missing matrix includes 2023-02-07 14:07:21 +11:00
Jason Fielder
8703db393b Metal: Ensure explicit return after discard to eliminate differences in behaviour between GPUs.
Discard is not always treated as an explicit return and flow control can continue for required derivative calculations. This behaviour is different in Metal vs OpenGL. Adding return after discards ensures consistency in expectation as behaviour is well-defined.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D17199
2023-02-07 00:58:06 +01:00
Jason Fielder
f152159101 Metal: Guard advanced command buffer debugging behind OS version flag.
Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D17181
2023-02-07 00:51:16 +01:00
d3500c482f Cleanup: Move DRW_pbvh.h header to C++
For continued refactoring of the Mesh data structure. See T103343.
2023-02-06 16:52:02 -05:00
3a1583972a Fix T104256: Curve to points node skips curve domain attributes
7536abbe16 forgot to port the curve domain attributes.
2023-02-06 16:30:25 -05:00
6dcfb6df9c Cycles: Abstract host memory fallback for GPU devices
Host memory fallback in CUDA and HIP devices is almost identical.
We remove duplicated code and create a shared generic version that
other devices (oneAPI) will be able to use.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D17173
2023-02-06 22:19:32 +01:00
b0b9e746fa BLI: Use BLI_math_matrix_type.hh instead of BLI_math_float4x4.hh
Straightforward port. I took the oportunity to remove some C vector
functions (ex: copy_v2_v2).

This makes some changes to DRWView to accomodate the alignement
requirements of the float4x4 type.
2023-02-06 21:25:45 +01:00
8be3fcab7e Fix tests after recent commit.
`9c14039a8f4b5f` broke blenlib tests in release builds, due to how
`EXPECT_BLI_ASSERT` works (in release builds it just calls the given
function, so if that crashes then the test fails).

For now remove that check in the test.
2023-02-06 21:14:20 +01:00
d20f992322 Mesh: Avoid copying positions in object mode modifier stack
Remove the use of a separate contiguous positions array now that
they are stored that way in the first place. This allows removing the
complexity of tracking whether it is allocated and deformed in the
mesh modifier stack.

Instead of deferring the creation of the final mesh until after the
positions have been copied and deformed, create the final mesh
first and then deform its positions.

Since vertex and face normals are calculated lazily, we can rely on
individual modifiers to calculate them as necessary and simplify
the modifier stack. This was hard to change before because of the
separate array of deformed positions.

Differential Revision: https://developer.blender.org/D16971
2023-02-06 14:34:29 -05:00
a38d99e0b2 Fix (unreported): Transform gizmo not restoring when changing mode
When activating a rotation with the Transform gizmo for example, some
gizmos are hidden but they don't reappear when changing the mode.

Make sure the gizmos corresponding to the mode always reappear.
2023-02-06 16:20:12 -03:00
75db4c082b Cleanup: Use BitVector instead of BLI_bitmap for subsurf face dot tags
For better type safety and more automatic memory management.
2023-02-06 14:13:53 -05:00
Michael Jones
2d994de77c Cycles: MetalRT optimisation for subsurface intersection queries
This patch optimises subsurface intersection queries on MetalRT. Currently intersect_local traverses from the scene root, retrospectively discarding all non-local hits. Using a lookup of bottom level acceleration structures, we can explicitly query only the relevant instance. On M1 Max, with MetalRT selected, this can give a render speedup of 15-20% for scenes like Monster which make heavy use of subsurface scattering.

Patch authored by Marco Giordano.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D17153
2023-02-06 19:12:29 +00:00
961d99d3a4 Minor comments about current usages of BKE_main_namemap_destroy. 2023-02-06 19:36:36 +01:00
430cc9d7bf Fix T104381: Assert on Circle Select end modal
`em_setup_vivewcontext` cannot be used in this function now as it
expects `obedit` to be a mesh. It also duplicated the viewcontext init.
Instead `BKE_editmesh_from_object` is called only when type is a mesh.
2023-02-06 19:32:14 +01:00
a3551ed878 BKE main namemap: Add a way to clear all namemaps of a given Main.
Existing `BKE_main_namemap_destroy` is too specific when a entire Main
needs to have its namemaps cleared, since it would not handle the
Library ones.

While in regular situation current code is fine, ID management code that
may also edit linked data needs a wider, simpler clearing tool.
2023-02-06 19:29:21 +01:00
288b13b252 BKE lib remapper: Add new util to overwrite an existing mapping.
Current `BKE_id_remapper_add` would not replace an already existing
mapping rule, now `BKE_id_remapper_add_overwrite` allows that behavior
if necessary.
2023-02-06 19:29:21 +01:00
85b2bce037 BKE libremap: do not assert on identity pairs.
If identity pairs (i.e. old ID pointer being same as new one) was
forbidden, then this should be asserted against in code defining
remapping, not in code applying it.

But it is actually sometimes usefull to allow/use identity pairs, so
simply early-return on these instead of asserting.
2023-02-06 19:29:21 +01:00
c7b601c79e Cleanup: Subdiv: Use index instead of pointer
The edge pointer was retrieved from the index and then just
used to calculate the index again. Remove the edge pointer
and only use the index.
2023-02-06 12:29:01 -05:00
81f8d74f6d EEVEE: Cleanup: light power / radiance code and document it
All thanks to @weizhen for spoting the inconsistencies.
2023-02-06 18:23:34 +01:00
9c14039a8f BLI ListBase: Add new 'SplitAfter' given link util.
Allows to easily split a ListBase by moving the part after given link
into a new ListBase.
2023-02-06 17:58:40 +01:00
39e0bbfa55 BKE libquery: Add option to also process ID.lib pointer.
This was never needed before, but upcomming work for Brush Asset project
requires it.
2023-02-06 17:31:01 +01:00
8fe4f3b756 Minor code doc improvement. 2023-02-06 17:19:02 +01:00
Iliya Katueshenock
a86f657692 Fix T104233: crash when deleting a group node that is displayed by other editor
Differential Revision: https://developer.blender.org/D17172
2023-02-06 16:18:16 +01:00
8adebaeb7c Modifiers: measure execution time and provide Python access
The goal is to give technical artists the ability to optimize modifier usage
and/or geometry node groups for performance. In the long term, it
would be useful if Blender could provide its own UI to display profiling
information to users. However, right now, there are too many open
design questions making it infeasible to tackle this in the short term.

This commit uses a simpler approach: Instead of adding new ui for
profiling data, it exposes the execution-time of modifiers in the Python
API. This allows technical artists to access the information and to build
their own UI to display the relevant information. In the long term this
will hopefully also help us to integrate a native ui for this in Blender
by observing how users use this information.

Note: The execution time of a modifier highly depends on what other
things the CPU is doing at the same time. For example, in many more
complex files, many objects and therefore modifiers are evaluated at
the same time by multiple threads which makes the measurement
much less reliable. For best results, make sure that only one object
is evaluated at a time (e.g. by changing it in isolation) and that no
other process on the system keeps the CPU busy.

As shown below, the execution time has to be accessed on the
evaluated object, not the original object.

```lang=python
import bpy
depsgraph = bpy.context.view_layer.depsgraph
ob = bpy.context.active_object
ob_eval = ob.evaluated_get(depsgraph)
modifier_eval = ob_eval.modifiers[0]
print(modifier_eval.execution_time, "s")
```

Differential Revision: https://developer.blender.org/D17185
2023-02-06 15:40:15 +01:00
773a36d2f8 Fix Cycles OneAPI build error after recent changes 2023-02-06 15:36:49 +01:00
cc623ee7b0 Transform: do not save settings when canceling the operation
If we are canceling, the settings must remain the same as before we
start the operation.
2023-02-06 11:18:52 -03:00
deaddbdcff Fix forced snap status being removed when changing transform mode
The `SNAP_FORCED` setting is set to the operation and not the snap
status.

Therefore, this option should not be cleared along with the other
statuses when resetting snapping.

Move then the location of this setting to `TransInfo::modifiers`.
2023-02-06 11:18:52 -03:00
f2538c7173 Fix T104335: MNEE + OptiX OSL results in illegal address error
The OptiX pipeline created for OSL was missing sufficient continuation
stack to handle the MNEE ray generation program.
2023-02-06 15:06:52 +01:00
4bd3b02984 Python: Suppress BGL deprecation messages after 100 times.
BGL deprecation calls used to be reported on each use. As bgl calls
are typically part of a handler that is triggered at refresh this
could lead to overflow of messages and slowing down systems when
the terminal/console had to be refreshed as well.

This patch only reports the first 100 bgl deprecation calls. This
gives enough feedback to the developer that changes needs to be made
. But still provides good responsiveness to users when they have
such add-on enabled. Only the first frames can have a slowdown.
2023-02-06 13:35:29 +01:00
7beb487e9a Fix T104353: Crash on opening sculpting template
`t->region` was `NULL`.

It can happen depending on the context.

Caused by rB19b63b932d2b.
2023-02-06 09:21:04 -03:00
9ad3a85f8b Fix Cycles GPU binaries build error after recent changes for Metal 2023-02-06 13:17:57 +01:00
Michael Jones
654e1e901b Cycles: Use local atomics for faster shader sorting (enabled on Metal)
This patch adds two new kernels: SORT_BUCKET_PASS and SORT_WRITE_PASS. These replace PREFIX_SUM and SORTED_PATHS_ARRAY on supported devices (currently implemented on Metal, but will be trivial to enable on the other backends). The new kernels exploit sort partitioning (see D15331) by sorting each partition separately using local atomics. This can give an overall render speedup of 2-3% depending on architecture. As before, we fall back to the original non-partitioned sorting when the shader count is "too high".

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16909
2023-02-06 11:18:26 +00:00
Michael Jones
46c9f7702a Cycles: Enable MetalRT opt-in for AMD/Navi2 GPUs
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D17043
2023-02-06 11:14:11 +00:00
Michael Jones
be0912a402 Cycles: Prevent use of both AMD and Intel Metal devices at same time
This patch removes the option to select both AMD and Intel GPUs on system that have both. Currently both devices will be selected by default which results in crashes and other poorly understood behaviour. This patch adds precedence for using any discrete AMD GPU over an integrated Intel one. This can be overridden with CYCLES_METAL_FORCE_INTEL.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D17166
2023-02-06 11:13:33 +00:00
Michael Jones
0a3df611e7 Fix T103393: Cycles: Undefine __LIGHT_TREE__ on Metal/AMD to fix perf
This patch fixes T103393 by undefining `__LIGHT_TREE__` on Metal/AMD as it has an unexpected & major impact on performance even when light trees are not in use.

Patch authored by Prakash Kamliya.

Reviewed By: brecht

Maniphest Tasks: T103393

Differential Revision: https://developer.blender.org/D17167
2023-02-06 11:12:34 +00:00
Amelie Fondevilla
6d297c35c8 Fix T104371: GPencil merge down layer duplicates wrong frame
The merge down operator was sometimes copying the wrong frame, which altered the animation.
While merging the layers, it is sometimes needed to duplicate a keyframe,
when the lowest layer does not have a keyframe but the highest layer does.
Instead of duplicating the previous keyframe of the lowest layer, the code
was actually duplicating the active frame of the layer which was the current frame in the timeline.

This patch fixes the issue by setting the previous keyframe of the layer as its active frame before duplication.

Related issue: T104371.

Differential Revision: https://developer.blender.org/D17214
2023-02-06 10:44:17 +01:00
329eeacc66 Cleanup: Cycles: Remove isotropic microfacet closure setup functions
Turns out these are 100% redundant, so get rid of them.
2023-02-06 04:26:36 +01:00
2627635ff3 Cleanup: use nullptr in C++ 2023-02-06 12:50:34 +11:00
d6b6050e5b Cleanup: use function style casts in C++ 2023-02-06 12:35:51 +11:00
731c3efd97 Cleanup: format 2023-02-06 12:32:45 +11:00
9f5c17f4af Cleanup: comments in code 2023-02-06 12:25:04 +11:00
4fcc9f5e7e Cleanup: use back-slash doxygen commands, de-duplicate doc-string 2023-02-06 12:25:04 +11:00
7de1a4d1d8 Fix GHOST/Wayland thread-unsafe timer-manager manipulation
Mutex locks for manipulating GHOST_System::m_timerManager from
GHOST_SystemWayland relied on WAYLAND being the only user of the
timer-manager.

This isn't the case as timers are fired from
`GHOST_System::dispatchEvents`.

Resolve by using a separate timer-manager for wayland key-repeat timers.
2023-02-06 12:25:04 +11:00
d3949a4fdb Fix GHOST/Wayland thread-unsafe key-repeat timer checks
Resolve a thread safety issue reported by valgrind's helgrind checker,
although I wasn't able to redo the error in practice.

NULL check on the key-repeat timer also needs to lock, otherwise it's
possible the timer is set in another thread before the lock is acquired.

Now all key-repeat timer access which may run from a thread
locks the timer mutex before any checks or timer manipulation.
2023-02-06 12:25:04 +11:00
b642dc7bc7 Fix: Incorrect forward-compatible saving of face sets
There were two errors with the function used to convert face sets
to the legacy mesh format for keeping forward compatibility:
- It was moved before `CustomData_blend_write_prepare` so it
  operated on an empty span.
- It modified the mesh when it's only supposed to change the copy
  of the layers written to the file.

Differential Revision: https://developer.blender.org/D17210
2023-02-05 18:09:22 -05:00
501352ef05 Cleanup: Move PBVH files to C++
For continued refactoring of the Mesh data structure. See T103343.
2023-02-05 17:36:47 -05:00
3420c47900 GPU: Fix incorrect implicit datatype conversions in test case shaders. 2023-02-05 22:33:46 +01:00
RiverIntheSky
a094f30a74 Fix T104363: BLI_assert 'attr->comp_len == 3' failed in cage 2d gizmo 2023-02-05 21:21:35 +01:00
3d6ceb737d Geometry Nodes: parallelize part of Duplicate Elements node
This implements two optimizations:
* If the duplication count is constant, the offsets array can be
  filled directly in parallel.
* Otherwise, extracting the counts from the virtual array is parallelized.
  But there is still a serial loop over all elements in the end to compute
  the offsets.
2023-02-05 20:59:39 +01:00
b7034e7280 Cleanup: use boolean instead of int, use const arguments, variable 2023-02-05 21:51:34 +11:00
a97607dcfa Cleanup: use typed enum for the handler flag in wm_event_system 2023-02-05 21:51:34 +11:00
f1314f3d5b Cleanup: make WM_HANDLER_* action flags local to wm_event_system 2023-02-05 21:51:34 +11:00
d6cd7d1138 WM: correct the return flag from wm_handler_fileselect_do
In the unlikely case an area could not be created OPERATOR_CANCELLED
was returned, this has the same value of WM_HANDLER_HANDLED however
break is logical in this situation and both flags work.
2023-02-05 21:51:34 +11:00
b2196ebe28 Win32: Relax Debug Assert in BLI_file_attributes
If GetFileAttributesW returns an error, only debug assert if the reason
is file not found.

See D17204 for more details.

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

Reviewed by Ray Molenkamp
2023-02-04 13:44:10 -08:00
1a13940ef8 Fix T88617: Wrong annotation cursor in Preview of sequencer editor
Allow preview region to change cursor as per the selected tool

Reviewed by: campbellbarton, ISS

Differential Revision: https://developer.blender.org/D16878
2023-02-04 10:22:50 +05:30
62fc001979 Cleanup: silence warning
```
warning C4457: declaration of 'fac' hides function parameter
message : see declaration of 'fac'
```
2023-02-04 00:16:02 -03:00
Germano Cavalcante
06305e5ca8 Cleanup/refactor: split Edge and Vert Slide code into more specific functions
This makes the code more readable.

In this commit also the `int curr_side_unclamp` member was moved to
`EdgeSlideParams` as it is a common value for all "Containers".
2023-02-03 23:01:26 -03:00
789e549dba Geometry Nodes: Tweak menu location of sample nodes
There was an inconsistency between geometry sample nodes and mesh/curve
sample nodes, where the latter didn't have a special "Sample" category,
and we categorized as "Operations", which they were not. Also put the
sample category between "Read" and "Write" since the verb name is
more consistent and sampling is an advanced form of reading.
2023-02-03 16:26:56 -05:00
ab9c34e7e7 Fix T104316: Width of headerless panels on regions with overlap
In some cases panels without headers were drawn too wide in sidebars
with region overlap.

Instead of always using the maximum width the view allows, headerless
panels now also use the width calculated in
`panel_draw_width_from_max_width_get`. The function already returns the
correct width in all cases and also takes care of insetting the panels,
when their backdrop needs to be drawn, which is necessary for headerless
panels, too, when there is region overlap.

Reviewed By: Hans Goudey

Differential Revision: http://developer.blender.org/D17194
2023-02-03 21:40:38 +01:00
90f36fc50e Fix (unreported): snap to object origin not respecting clipping planes
There was an incorrect conversion for local clip planes although the
coordinates used are in world positions.
2023-02-03 17:16:44 -03:00
73000c792d Cycles: Reorganize Fresnel handling in Microfacet closures
This is both a cleanup and a preparation for the Principled v2 changes.
Notable changes:
- Clearcoat weight is now folded into the closure weight, there's no reason
  to track this separately.
- There's a general-purpose helper for computing a Closure's albedo, which is
  currently used by the denoising albedo and diffuse/gloss/transmission color
  passes.
- The d/g/t color passes didn't account for closure albedo before, this means
  that e.g. metallic shaders with Principled v2 now have their color texture
  included in the glossy color pass. Also fixes T104041 (sheen albedo).
- Instead of precomputing and storing the albedo during shader setup, compute
  it when needed. This is technically redundant since we still need to compute
  it on shader setup to adjust the sample weight, but the operation is cheap
  enough that freeing up the storage seems worth it.
- Future changes (Principled v2) are easier to integrate since the Fresnel
  handling isn't all over the place anymore.
- Fresnel handling in the Multiscattering GGX code is still ugly, but since
  removing that entirely is the next step, putting effort into cleaning it up
  doesn't seem worth it.
- Apart from the d/g/t color passes, no changes to render results are expected.

Differential Revision: https://developer.blender.org/D17101
2023-02-03 21:03:48 +01:00
0220bdc2d5 Cycles: Tests: Add option to increase SPP for manual comparisons
Useful for validating changes when sampling/noise changes:
- First run with BLENDER_TEST_UPDATE=1 and e.g. CYCLESTEST_SPP_MULTIPLIER=32
- Apply your change
- Run with only CYCLESTEST_SPP_MULTIPLIER=32
- Compare
- Reset the SVN repo

Differential Revision: https://developer.blender.org/D17107
2023-02-03 21:00:47 +01:00
b454416927 Cycles: add non-uniform scaling to spot light size
Cycles ignores the size of spot lights, therefore the illuminated area doesn't match the gizmo. This patch resolves this discrepancy.
| Before (Cycles) | After (Cycles) | Eevee
|{F14200605}|{F14200595}|{F14200600}|
This is done by scaling the ray direction by the size of the cone. The implementation of `spot_light_attenuation()` in `spot.h` matches `spot_attenuation()` in `lights_lib.glsl`.
**Test file**:
{F14200728}

Differential Revision: https://developer.blender.org/D17129
2023-02-03 18:51:14 +01:00
6590a288b0 Fix number sliders not working
Own mistake in d204830107.

For some buttons the type is changed after construction, which means the button
has to be reconstructed. For example number buttons can be turned into number
slider buttons this way. New code was unintentionally overriding the button
type after reconstruction with the old type again.
2023-02-03 18:46:12 +01:00
23506622a5 Gizmo: add central point to circular 2D cage 2023-02-03 18:30:57 +01:00
7f958217ad Curves: Use shared caches for evaluated data
Use the `SharedCache` concept introduced in D16204 to share lazily
calculated evaluated data between original and multiple evaluated
curves data-blocks. Combined with D14139, this should basically remove
most costs associated with copying large curves data-blocks (though
they add slightly higher constant overhead). The caches should
interact well with undo steps, limiting recalculations on undo/redo.

Options for avoiding the new overhead associated with the shared
caches are described in T104327 and can be addressed separately.

Simple situations affected by this change are using any of the following data
on an evaluated curves data-block without first invalidating it:
- Evaluated offsets (size of evaluated curves)
- Evaluated positions
- Evaluated tangents
- Evaluated normals
- Evaluated lengths (spline parameter node)
- Internal Bezier and NURBS caches

In a test with 4m points and 170k curves, using curve normals in a
procedural setup that didn't change positions procedurally gave 5x
faster playback speeds. Avoiding recalculating the offsets on every
update saved about 3 ms for every sculpt update for brushes that don't
change topology.

Differential Revision: https://developer.blender.org/D17134
2023-02-03 12:19:40 -05:00
dc79281223 Nodes: Add modal keymap for Node link drag
This will add a proper modal keymap for the node link drag operator.
It allows the user to customize the keys used to start drag and so on.
Also it gets rid of the custom status bar message.

Differential Revision: https://developer.blender.org/D17190
2023-02-03 17:41:12 +01:00
1195933ada Fix: Compile error after BMesh conversion commit 2023-02-03 11:09:19 -05:00
a1c01e0c06 Attempt to fix build errors with NDOF enabled 2023-02-03 17:03:29 +01:00
fcc1166821 GPU: Disable verbose GLSL variable names in debug builds
GpuInput::node can be deallocated in some cases. (See T104265)
This is a temp workaround until a proper solution is implemented.
2023-02-03 17:00:35 +01:00
d204830107 UI: Make uiBut safe for non-trivial construction
No user-visible changes expected.

Essentially, this makes it possible to use C++ types like `std::function`
inside `uiBut`. This has plenty of benefits, for example this should help
significantly reducing unsafe `void *` use (since a `std::function` can hold
arbitrary data while preserving types).

----

I wanted to use a non-trivially-constructible C++ type (`std::function`) inside
`uiBut`. But this would mean we can't use `MEM_cnew()` like allocation anymore.

Rather than writing worse code, allow non-trivial construction for `uiBut`.
Member-initializing all members is annoying since there are so many, but rather
safe than sorry. As we use more C++ types (e.g. convert callbacks to use
`std::function`), this should become less since they initialize properly on
default construction.

Also use proper C++ inheritance for `uiBut` subtypes, the old way to allocate
based on size isn't working anymore.

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

Reviewed by: Hans Goudey
2023-02-03 16:35:51 +01:00
ebe8f8ce71 BMesh: Parallelize BMesh to evaluated Mesh conversion
Currently this conversion (which happens when using modifiers in edit
mode, for example) is completely single threaded. It's harder than some
other areas to multithread because BMesh elements don't always know
their indices (and vise versa), and because the dynamic AoS format
used by BMesh makes some typical solutions not helpful.

This patch proposes to split the operation into two steps. The first
updates the indices of BMesh elements and builds tables for easy
iteration later. It also checks if some optional mesh attributes
should be added. The second uses parallel loops over all elements,
copying attribute values and building the Mesh topology.

Both steps process different domains in separate threads (though the
first has to combine faces and loops). Though this isn't proper data
parallelism, it's quite helpful because each domain doesn't affect the
others.

**Timings**
I tested this on a Ryzen 7950x with a 1 million face grid, with no
extra attributes and then with several color attributes and vertex
groups.

| File | Before | After |
| Simple | 101.6 ms | 59.6 ms |
| More Attributes | 149.2 ms | 65.6 ms |

The optimization scales better with more attributes on the BMesh. The
speedup isn't as linear as multithreading other operations, indicating
added overhead. I think this is worth it though, because the user is
usually actively interacting with a mesh in edit mode.

See the differential revision for more timing information.

Differential Revision: https://developer.blender.org/D16249
2023-02-03 10:20:19 -05:00
Germano Cavalcante
19b63b932d Fix transform gizmo not updating according to state
Whenever a transform operation is activated by gizmo, the gizmo
modal is maintained, but its drawing remains the same even if the
transform mode or constrain is changed.

So update the gizmo according to the mode or constrain set.

NOTE: Currently only 3D view gizmo is affected
2023-02-03 11:07:43 -03:00
af0d378177 Cleanup: Move multires reshape header to C++
For continued refactoring of the Mesh data structure. See T103343.
2023-02-03 08:48:00 -05:00
96e37affe5 Cleanup: Remove unused image paint function 2023-02-03 08:18:41 -05:00
5a9d2b872e Cleanup: incorrect naming of storage_buf parameters.
They were named vert.
2023-02-03 14:11:07 +01:00
0f51b5b599 Animation: Add Operator for adding FCurve modifiers to more menus
The operator has the option to add to selected FCurves instead
of only the active, but it was only exposed in the redo panel.
This patch adds the operator to the right-click menu on FCurve channels,
and to the channel menu in the Graph editor.
Both times with configured to add to selected
instead of only the active FCurve

Revied by Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D17066
Ref: D17066
2023-02-03 13:06:15 +01:00
cc23b6abd6 Cleanup: rename cage2d draw style (RECTANGLE -> BOX_TRANSFORM) 2023-02-03 12:01:45 +01:00
3c8c0f1094 Gizmo: add gizmo for adjusting spot light blend
Ref T104280

Differential Revision: https://developer.blender.org/D17171
2023-02-03 11:32:10 +01:00
d335db09e0 Fix T90893: Restoring a key in the keymap editor doesn't work if the key is only disabled
Reset `KMI_INACTIVE` flag when restore-item  button is called

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D16773
2023-02-03 15:45:59 +05:30
ab3e1809b6 Vulkan: Select graphics queue with compute capabilities.
There might be cases that the graphics queue and compute
queue are separated, but that would be something that we
will solve in the future.
2023-02-03 10:16:01 +01:00
a45a881534 Spelling: familly -> family.
Fix spelling mistake originated from tmp-vulkan branch.
2023-02-03 10:16:01 +01:00
9565ea0724 IO: Harmonize UI for selection of axes in OBJ and Collada
Implements T103858: in OBJ importer and exporter, and in Collada
exporter, present axis choices as a dropdown instead of inline button
row.

Reviewed By: Bastien Montagne
Differential Revision: https://developer.blender.org/D17186
2023-02-03 11:14:53 +02:00
2fb0c20f53 Cleanup: remove unreachable return values 2023-02-03 20:02:25 +11:00
307113d744 GPU: Fix incorrect datatype conversions in test case shaders. 2023-02-03 08:23:55 +01:00
11d8965da1 Cleanup: quiet undeclared variable warning 2023-02-03 15:10:58 +11:00
c468aeefb5 PyAPI: updates to bl_ui.generic_ui_list which didn't follow conventions
- Replace type annotations with doc-strings, the current conventions is
  not to use type annotations in startup scripts.
- Replace abbreviation "idx" with "index" in public arguments/properties.
- Replace `len(..) > 0` with boolean checks.
- Add `__all__` to list public members.
- Use `arg` instead of `param` for doc-strings.
- Locate the doc-string so it shows as `__doc__`.
2023-02-03 15:07:14 +11:00
266d8de687 Cleanup: spelling in comments 2023-02-03 12:41:01 +11:00
27e2b32a06 Cleanup: Remove redundant calls to init grids
`BKE_volume_init_grids` gets called in `volume_init_data` that is run
on creating new datablocks so it's unnecessary to run it separately.
2023-02-03 00:14:19 +01:00
023277359f Fix T104053: Limit pbvh recursion
The recursion depth was checked for equality with a maximum depth,
allowing leaves with more primitives if a certain depth was reached.

However, a single leaf must always use the same material (including
set_smooth), so if a leaf contained multiple materials it was split
anyway. This meant that in the next recursion step the depth was
larger than the cutoff value and it would go back to recursing until
the number of primitives was small enough, ignoring the recursion
depth for the rest of the process.

In certain edge cases this could lead to a stack overflow.

Even with the check changed from 'equality' to 'larger or equal'
this could still fail in the pathological case where every primitive
has another material. But that can't be helped, and it wouldn't
realistically happen either.

Differential Revsision: https://developer.blender.org/D17188
2023-02-03 00:09:26 +01:00
b5e00a1482 Revert "BLI: Use BLI_math_matrix_type.hh instead of BLI_math_float4x4.hh"
This reverts commit 52de84b0db.

had some build issues on windows i can't quickly resolve, revert for
now while we fix the problems
2023-02-02 11:46:23 -07:00
f31ad5d98b Cleanup: refactoring BKE_nlastrips_add_strip method to Null check. Adding Unit tests for method
Reviewed By: Sybren

Differential Revision: https://developer.blender.org/D17155
2023-02-02 13:20:25 -05:00
52de84b0db BLI: Use BLI_math_matrix_type.hh instead of BLI_math_float4x4.hh
Straightforward port. I took the oportunity to remove some C vector
functions (ex: `copy_v2_v2`).

This makes some changes to DRWView to accomodate the alignement
requirements of the float4x4 type.
2023-02-02 18:11:35 +01:00
ca99a59605 Fix T104261: crash when trying to draw viewer overlay for empty curve
`BKE_displist_make_curveTypes` only sets `curve_eval` if the final geometry
of the object actually contains curve data, otherwise it's null.
2023-02-02 17:20:57 +01:00
Iliya Katueshenock
fdc81be213 Fix T104223: attribute not propagated to Set Curve Radius node
This declaration change tells the evaluation system that the radius
field is evaluated on the input geometry. Which in turn means that
attributes referenced by the radius field should be propagated to
the geometry.
2023-02-02 17:04:29 +01:00
fc2a64e21a Win32: Better Error Handling in BLI_file_attributes
After Win32 API call GetFileAttributesW, check for
INVALID_FILE_ATTRIBUTES, which is returned on error,
usually if file not found.

See D17176 for more details.

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

Reviewed by Ray Molenkamp
2023-02-02 08:01:43 -08:00
7208938707 Fix T104278: incorrect handling of unavailable linked node groups
The declaration of group nodes using unavailable linked groups contains
a `skip_updating_sockets` tag, which indicates that the node shouldn't
change. This information was not used properly further down the line.
2023-02-02 16:38:53 +01:00
2a19810f97 Fix T104296: crash caused by incorrectly initialized group nodes
Versioning code in `do_versions_after_linking_260` inserted new group input
and output nodes. And (reasonably?) expected sockets to exist on those nodes.
However, `nodeAddStaticNode` did not initialize sockets on nodes with that use
`declare_dynamic` yet. This patch changes it so that `declare_dynamic` is used
in more places, which caused issues during file loading when node groups are
updated in somewhat arbitrary order (not in an order that is based on which
groups use which).

Differential Revision: https://developer.blender.org/D17183
2023-02-02 16:38:53 +01:00
04aab7d516 Animation: Add "Select Linked Vertices" to Weight Paint Mode
Adds two operators to select linked  vertices in weight paint mode.
Similar to how it works in edit mode.
Press "L" to select vertices under the cursor,
or CTRL + "L" to select anything linked to the current selection.

Reviewed by: Sybren A. Stüvel, Hans Goudey, Marion Stalke
Differential Revision: https://developer.blender.org/D16848
Ref: D16848
2023-02-02 16:17:17 +01:00
fe5d54d3d0 Gizmo: add new cage2d draw style for circular shapes
`ED_GIZMO_CAGE2D_STYLE_CIRCLE` now draw circles. The previous `ED_GIZMO_CAGE2D_STYLE_CIRCLE`, which drew rectangles, is renamed to `ED_GIZMO_CAGE2D_STYLE_RECTANGLE`. The meaning of `ED_GIZMO_CAGE2D_STYLE_BOX` is now unclear and probably needs to be renamed too.
Ref T104280

Maniphest Tasks: T104280

Differential Revision: https://developer.blender.org/D17174
2023-02-02 16:15:23 +01:00
c2c6707919 Fix T102690: Object can be animated with a single keyframe
Remove some assumptions that an FCurve with a single keyframe always is
extrapolated in constant fashion. There's no reason for the Beziér handles
to be ignored in such a case.

FCurve evaluation already worked properly, it was just the drawing in the
graph editor and the selectability of the handles that needed adjustments.
2023-02-02 16:01:03 +01:00
c1b85103fe GPU: Added testcase for SSBO/Compute.
Test case is a smaller step towards supporting Vulkan. Other
test cases rely on SSBOs as well so it is better to first satisfy
this step before handling the others.
2023-02-02 14:11:43 +01:00
49ad91b5ab Animation: Enable Pin Icon in the Dope Sheet
Even though the dope sheet respects the pinned channels, it did not show the icon to interact with the pinned state.

This adds the icon to the dope sheet as well.

{F14178715}

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D17061
Ref: D17061
2023-02-02 13:58:13 +01:00
bbc18673f3 Cleanup: make format 2023-02-02 13:16:39 +01:00
d77b87eb93 Fix invalid versioning code for meshes
The issue was introduced in d92edca862: one shall not use
polygon index to index polygon custom data layer.
2023-02-02 13:10:45 +01:00
644d54a193 GPU: Fix memory leak in VkShader.
std::string makes a copy, without taking ownership.
2023-02-02 13:06:10 +01:00
6c66f3e2b3 GPU: Remove prototype without implementation.
`GPUShaderInterface(const ShaderCreateInfo&)` is defined but its
implementation has been removed.
2023-02-02 11:46:29 +01:00
d92edca862 Fix: CustomData layers become unsorted in versioning
n versioning, when converting CD_SCULPT_FACE_SETS to CD_PROP_INT32
the layers were not kept properly ordered by type.

This was discovered while investigating T104053

Differential Revision: D17165
2023-02-02 09:49:25 +01:00
Stephen Seo
e1ee86b63c Change default AV1 encoder for "slowest"
Previously, having the "Encoding speed" set to "slowest" would choose
libaom-av1 first and librav1e second. This change makes Blender choose
librav1e first (and has a fallback to whatever other AV1 codec is
available if librav1e is not installed).

Addresses /T103849 on systems where librav1e codec available.

Reviewed By: sergey, ISS

Maniphest Tasks: T103849

Differential Revision: https://developer.blender.org/D17002
2023-02-02 09:33:25 +01:00
199233eee1 Cleanup: Change VMA from CRLF to LF.
To match the rest of our repository.
2023-02-02 08:23:54 +01:00
5d9971bc63 Vulkan: Fix compilation warning in VMA. 2023-02-02 08:19:17 +01:00
99520a79b6 Viewport Compositor: Platform support message.
In the previous situation the message was shown for Apple devices.
But this is not correct and confusing.

- Apple with Metal backend are supported, OpenGL on Apple isn't
- Legacy devices on Windows or Linux are also not supported.

This change will check that the capabilities of the GPU match the
requirements to use Viewport compositor. Based on those capabilities
a message is shown and the panel is activated.
2023-02-02 07:43:18 +01:00
e2c3bff78b Spelling: 'GPU Back end' -> 'GPU Backend'. 2023-02-02 07:35:32 +01:00
96ea0dd458 Cleanup: spelling in comments 2023-02-02 14:00:32 +11:00
31a6400279 Fix error referencing transition context which doesn't exist
Regression in [0] added reference to constraint which doesn't exist.

[0]: db87e2a638
2023-02-02 13:33:08 +11:00
d82ffb9787 Fix T103530: Allow Recursive File Lists
In File Browser, correct full path creation so that it works correctly
in recursive listings.

See D17175 for more details.

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

Reviewed by Julian Eisel
2023-02-01 14:06:38 -08:00
a4868f2058 Fix T104136: Crash with Mesh to Volume & Simplify
Blender crashes when Simplify is enabled and set to 0.
This is because mesh_to_volume_grid returns nullptr at voxel size 0.
A simple null-check fixes this problem.

Differential Revision: https://developer.blender.org/D17122
2023-02-01 20:50:39 +01:00
9b86741ae7 FIx possible return of string without null character
`WM_modalkeymap_items_to_string` is expected to always return a string.

But in the special case of zero length, the returned string was not
terminated with `'\0'`.

This can cause problems with the header of the knife tool for example.
It always uses the returned string.

(This issue was observed when investigating T103804).
2023-02-01 15:29:21 -03:00
c105c49407 Cleanup: rename places where 3D cage gizmo uses 2D cage enums 2023-02-01 17:28:35 +01:00
19fe5caf87 Geometry Nodes: add support for eye dropper for object input in modifier
Differential Revision: https://developer.blender.org/D17108
2023-02-01 12:53:57 +01:00
5a97b282e9 Fix (unreported) crash when importing data with custom normals.
The usage of `index` was inverted between destination array of vectors
and source vector in rB3a3d9488a1633.
2023-02-01 10:53:53 +01:00
e515f81318 Cleanup: move swapping objects in a collection to a utility function
Including this logic inline complicated D17016 & was noted as a TODO.
2023-02-01 14:41:40 +11:00
345dded146 Revert "Geometry Nodes: hide group inputs with "Hide Value" enabled in modifier"
This reverts commit 11a9578a19.

Reverting this because there was a miscommunication between Simon and me. Shortly
before I committed the change, Simon noticed that there are cases when "Hide Value"
is checked to hide the value in a group node, but we still want to show the value
in the modifier.
2023-01-31 19:28:22 +01:00
3750e7ef0b Sculpt: Don't invert in geodesic mask expand keymap 2023-01-31 10:23:07 -08:00
0a9520ce84 Sculpt: Un-invert expand normal falloff
Normals falloff mask is created inverted compared
to how other falloffs work.  It's now un-inverted
in a final step at the end.

Also exposed the normals falloff smooth steps as
an RNA property.
2023-01-31 10:23:07 -08:00
11a9578a19 Geometry Nodes: hide group inputs with "Hide Value" enabled in modifier
When the "Hide Value" option of a group input is enabled, only its name
is displayed in group nodes. Modifiers should have the same behavior.
However, for modifiers, only showing the name does not make sense
when the user can't edit the value. Therefore the value is not shown at all.
2023-01-31 18:55:06 +01:00
2995165148 Cleanup: simplify wrapping CurvesGeometry in C++ 2023-01-31 18:45:55 +01:00
fa9fc59b56 Fix T104240: OptiX OSL texture loading broken with displacement
The image manager used to handle OSL textures on the GPU by
default loads images after displacement is evaluated. This is a
problem when the displacement shader uses any textures, hence
why the geometry manager already makes the image manager
load any images used in the displacement shader graph early
(`GeometryManager::device_update_displacement_images`).
This only handled Cycles image nodes however, not OSL nodes, so
if any `texture` calls were made in OSL those would be missed and
therefore crash when accessed on the GPU. Unfortunately it is not
simple to determine which textures referenced by OSL are needed
for displacement, so the solution for now is to simply load all of
them early if true displacement is used.
This patch also fixes the result of the displacement shader not
being used properly in OptiX.

Maniphest Tasks: T104240

Differential Revision: https://developer.blender.org/D17162
2023-01-31 16:41:00 +01:00
ce42906b89 Fix wrong spot light blend circle radius in viewport
Was using squared cosine instead of cosine. The problem is obvious for large spread angles.
|before|after
|{F14220946}|{F14220948}
The images are generating by returning `floor(spotmask)` in function `spot_attenuation()` in `lights_lib.glsl`.
2023-01-31 16:26:51 +01:00
1cb04af1df BLI: Fix missing const correctness
This fix incorrect rBa837604d44a0 commit
2023-01-31 15:36:24 +01:00
6de43f6f04 BLI: Fix invalid swizzle commit
This fix incorrect rBa837604d44a0 commit
2023-01-31 14:53:54 +01:00
a837604d44 BLI: Math: Add xy() and xyz() swizzle functions
Thoses are added for better component masking syntax.
This avoids the harder to read `float2(my_vec4)`.

This is not meant to be fully usable swizzling support but could be
extended in the future.
2023-01-31 14:48:19 +01:00
59b7aec9a2 VSE: Add missing NULL check in poll
Commit 90e9406866 forgot to add a NULL check for `ed`
2023-01-31 14:43:17 +01:00
5021f10e65 GPencil: Group similar UI parameters in Offset modifier 2023-01-31 13:13:00 +01:00
c1e5359eba GPencil: Use BLI_math_matrix_type.hh instead of BLI_math_float4x4.hh
Straightforward port. I took the oportunity to remove some C vector
functions (ex: `copy_v2_v2()`).

Reviewed By: antoniov

Differential Revision: https://developer.blender.org/D17160
2023-01-31 12:53:44 +01:00
a71ae981c7 Fix T104243: GPencil Cutter flattening caps on both sides 2023-01-31 11:18:13 +01:00
Jason Fielder
a504058dee Metal: Optimize GLSL to MSL translation. Improve cached compilation
Reduces the GLSL to MSL translation stage of shader compilation from 120 ms to 5 ms for complex EEVEE materials. This manifests in faster overall compilations, and faster cache hits for secondary compilations, as the MSL variant is needed as a key.

Startup time is also improved for both first-run and second-run. Note that this change does not affect shader compilation times within the Metal API.

Also disables shader output to disk

Authored by Apple: Michael Parkin-White

Ref T96261
Depends on D16990

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D17033
2023-01-31 11:06:31 +01:00
Jason Fielder
f3bd5458a3 Metal: Optimise shader texture cache usage and branch reduction via point sampling.
Replace texelFetch calls with a texture point-sample rather than a textureRead call. This increases texture cache utilisation when mixing between sampled calls and reads. Bounds checking can also be removed from these functions, reducing instruction count and branch divergence, as the sampler routine handles range clamping.

Authored by Apple: Michael Parkin-White
Ref T96261

Depends on D16923

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D17021
2023-01-31 10:56:25 +01:00
9f866a92dc Fix T104176: Smooth modifier with vergex group not work for negative factors.
Regression from rBabc8d6b12ce9, over three years ago!

Should be backported to the active LTS releases too.
2023-01-31 09:55:45 +01:00
3d765f6527 GPU: Fix gpu_math_test.glsl test case.
Test results were generated from incorrect code.
Code was fixed, but test results weren't updated.
This patch updates the test results to match the implementation.
- `projection_perspective.w.w == 0.0`
2023-01-31 09:51:08 +01:00
59aefaf3d0 Vulkan: Fix assert when compiling transform feedback shaders.
Transform feedback shaders don't have a fragment shader and should not
fail when it is not given.
2023-01-31 09:50:50 +01:00
d44d165e8a Vulkan: Fix compilation on Linux.
ShaderC was missing and is required for compilation.
2023-01-31 09:23:21 +01:00
d8cd8a0852 Cleanup: remove compilation warning
Unused parameter in vk_backend.
2023-01-31 09:10:18 +01:00
b7e178cb7d GPU: Cross test OpenGL tests to Vulkan.
Enhanced the GPU_TEST macro to also handle Vulkan backend
when WITH_VULKAN_BACKEND compilation option has been
enabled.
2023-01-31 08:48:52 +01:00
6b8fa899ca Metal: Fix compilation of GLSL used in test cases.
Added imageStore for 1d textures.
2023-01-31 08:42:33 +01:00
57efef2635 Fix generating geometry icons for meshes without vertex colors 2023-01-31 16:46:40 +11:00
91263a8b8b Sculpt: Fix T104040: Always update eevee shadows in sculpt modes 2023-01-30 21:29:11 -08:00
79c82fc1c5 Cleanup: trailing space 2023-01-31 15:49:04 +11:00
b18b53eae0 CMake: add missing headers 2023-01-31 14:22:26 +11:00
4f1800d70a Docs: note that delimiting by winding could be supported
Some users requested this behavior since it was removed,
so note that it could be supported again.
2023-01-31 14:22:25 +11:00
6c8c8c20c7 Cleanup: quiet mypy type checking warnings 2023-01-31 14:22:24 +11:00
27b4916b1a Cleanup: spelling in comments
Also minor changes in comments:
- Reference BLENDER_HISTORY_FILE instead of the literal file-name
  (simplifies looking up usage).
- Use usernames in tags, as noted in code-style.
2023-01-31 14:22:23 +11:00
ea8fd343eb Gitea: add merge message templates
To add the pull request # at the end of the commit.
2023-01-30 23:48:41 +01:00
f359a39d11 Fix T100028: Convert USD camera properties to mm from USD units.
Authored by Sonny Campbell.

Currently when importing a USD file, some of the camera properties are
ignored, or the units are not converted correctly from USD world units.
On import we currently set the focal length, but not the camera sensor
size (horizontal and vertical aperture), so the camera field of view
is wrong. The sensor size information is in the USD file, but is ignored
for perspective cameras.

USD uses "tenth of a world unit" scale for some physical camera properties
like focal length and aperture.
https://graphics.pixar.com/usd/release/api/class_usd_geom_camera.html#UsdGeom_CameraUnits

I have added the UsdStage's metersPerUnit parameter to the ImportSettings
so the camera can do the required conversion on import. This will convert from
the USD file's world units to millimeters for Blender's camera settings.

Reviewed by: Sybren and makowalski.

Differential Revision: https://developer.blender.org/D16019
2023-01-30 17:22:26 -05:00
129093fbce Cycles: Fix crash when rendering with OSL on multiple GPUs
The `MultiDevice` implementation of `get_cpu_osl_memory` returns a
nullptr when there is no CPU device in the mix. As such access to that
crashed in `update_osl_globals`. But that only updates maps that are not
currently used on the GPU anyway, so can just skip that when the CPU
is not used for rendering.

Maniphest Tasks: T104216
2023-01-30 19:40:22 +01:00
87a923fdb6 GPU: Add SSBO binding test to new structure.
This test was added to test the shader info structure binding
information for SSBOs. It still used the legacy GLSL structure.
2023-01-30 19:07:33 +01:00
f4deed288b USD export: style fixes to previous commit.
Changed to C-style comments and added braces.
2023-01-30 11:57:28 -05:00
c79b55fc05 USD export: add scale and bias for normal maps.
Changes authored by Michael B Johnson (drwave).

This addresses the issue in T102911.

Add scale and bias inputs to ensure the normals are
in tangent space [(-1,-1,-1), (1,1,1)].

This is following the convention as set in the USD Spec
(https://graphics.pixar.com/usd/dev/spec_usdpreviewsurface.html).

Differential Revision: https://developer.blender.org/D17072
2023-01-30 11:32:03 -05:00
ad083f925c GPencil: Rename init_time to time_start 2023-01-30 16:27:00 +01:00
ce13d0d326 GPU: Only compile test shaders when test cases option is enabled.
The glsl files + create infos of shaders that are only used
during development where still being compiled into blender.

This isn't needed and shouldn't be included. This change will
only include them when WITH_GTEST and WITH_OPENGL_DRAW_TESTS are
enabled. All other cases those files will be skipped.
2023-01-30 15:46:12 +01:00
1a50f814e6 Cleanup: Remove unused variable, use switch, and C++ casting. 2023-01-30 15:41:01 +01:00
Jason Fielder
aca9c131fc Metal: Fix issue with premature safe buffer list flush and optimize memory manager overhead.
Resolve an issue where released buffers were returned to the reusable memory pool before GPU work associated with these buffers had been encoded. Usually release of memory pools is dependent on successful completion of GPU work via command buffer callbacks. However, if the pool refresh operation occurs between encoding of work and submission, buffer ref-count is prematurely decremented.

Patch also ensures safe buffer free lists are only flushed once a set number of buffers have been used. This reduces overhead of small and frequent flushes, without raising the memory ceiling significantly.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D17118
2023-01-30 14:54:39 +01:00
d4d4efd3d3 GPU: Use create info for compute test cases.
Compute test case still used legacy API to construct
GLSL shaders. This change will migrate it to use the
GPUShaderCreateInfo's.

In preparation to run test-cases against non-opengl
back-ends.
2023-01-30 14:45:07 +01:00
62dd0855a9 Cleanup: Remove special handling of 3DCursor in undo code.
Such preserve-across-undo data handling is now done through the IDType
callbacks, see e.g. `scene_undo_preserve` for the 3DCursor case.
2023-01-30 14:40:59 +01:00
Jason Fielder
596ee79a9f Metal: Optimize shader local memory usage.
Due to shader global scope emulation via class interface, global constant arrays in shaders are allocated in per-thread shader local memory. To reduce memory pressure, placing these constant arrays inside function scope will ensure they only reside within device constant memory. This results in a tangible 1.5-2x performance uplift for the specific shaders affected.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D17089
2023-01-30 13:53:00 +01:00
dea924a91f GPU: Fix incorrectly commited test compilation of all shaders 2023-01-30 12:30:21 +01:00
0da74d3ee9 GPU: Fix GLSL compilation on OpenGL backend.
Regression in {d0f55aa671f7}
2023-01-30 12:23:02 +01:00
411345757c Cleanup: Remove unused variable.
Introduced in recent commit.
2023-01-30 12:04:44 +01:00
a36c1cabce Vulkan: Changes to CMake config.
Paths to vulkan libraries, paths and related components were
hardcoded in the platform cmake file. This patch separates
this by using adding CMake modules for Vulkan and ShaderC.

This change has only been applied to the macOs configuration as
that is currently our main platform for development. Other platforms
will be added during the development of the Vulkan back-end.
2023-01-30 12:04:44 +01:00
084dd110c9 Build: Remove unused BLENDER_GL_LIBRARIES.
This CMAKE variable isn't used.
2023-01-30 12:04:44 +01:00
Jason Fielder
6dde185dc4 Metal: Fix edge-case with point primitive restart index removal where all indices are restarts.
Metal backend does not support primtiive restart for point primtiives. Hence strip_restart_indices removes restart indices by swapping them to the end of the index buffer and reducing the length.
An edge-case existed where all indices within the index buffer were restarts and no valid swap-index would be found, resulting in a buffer underflow.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D17088
2023-01-30 11:26:38 +01:00
Jason Fielder
57552f52b2 Metal: Realtime compositor enablement with addition of GPU Compute.
This patch adds support for compilation and execution of GLSL compute shaders. This, along with a few systematic changes and fixes, enable realtime compositor functionality with the Metal backend on macOS. A number of GLSL source modifications have been made to add the required level of type explicitness, allowing all compilations to succeed.

GLSL Compute shader compilation follows a similar path to Vertex/Fragment translation, with added support for shader atomics, shared memory blocks and barriers.

Texture flags have also been updated to ensure correct read/write specification for textures used within the compositor pipeline. GPU command submission changes have also been made in the high level path, when Metal is used, to address command buffer time-outs caused by certain expensive compute shaders.

Authored by Apple: Michael Parkin-White

Ref T96261
Ref T99210

Reviewed By: fclem

Maniphest Tasks: T99210, T96261

Differential Revision: https://developer.blender.org/D16990
2023-01-30 11:06:56 +01:00
d0f55aa671 Vulkan: Fix GLSL compilation errors.
Recent changes in our GLSL libraries didn't compile on Vulkan. This
change reverts a compile directive that was removed, but required
in order to compile using the Vulkan backend.
2023-01-30 10:55:14 +01:00
2ff08d6d9c Cleanup: Pass explicit type to MEM_cnew.
Better avoid fancy implicit typing in this template, and be clear about
what type is actually being allocated.
2023-01-30 10:41:42 +01:00
be8778355a Cleanup: Unused parameters and variables. 2023-01-30 09:45:42 +01:00
3649c05f57 Cleanup: Run make format on codebase. 2023-01-30 09:40:17 +01:00
Damien Picard
db87e2a638 I18n: extract and disambiguate a few messages
Extract:
- EEVEE: Compiling Shaders (the same message exists in EEVEE Next, but
  it uses string concatenation and I don't know yet how to deal with
  those--see T92758)

Disambiguate:
- Pan (audio, camera)
- Box (TextSequence)
- Mix (noun in constraints, GP materials)
- Volume (object type, file system)
- Floor (math integer part, 3D viewport horizontal plane)
  - Impossible to disambiguate the constraint name because
    bConstraintTypeInfo doesn't have a context field.
- Show Overlay (in the sequence editor, use the same message as other
  editors to avoid a confusion with the Frame Overlay feature, also
  called "Show Overlay")

Additionally, fix a few issues reported by Joan Pujolar (@jpujolar)
in T101830.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D17114
2023-01-30 09:38:57 +01:00
Damien Picard
75c772391d I18n: construct report verbosely when moving objects to collection
When moving or linking an object to a collection, the report was not
properly translatable. In French for instance, it would give
nonsensical half-translated sentences such as "<Object> moved vers
<collection>", instead of "<Object> déplacé vers <collection>".

Instead, separate the report into the four possible translations (one
or multiple objects, linking or moving). This is very verbose and less
legible, but it ensure the sentences can be properly translated,
including plurals in languages which use grammatical agreement.

In addition, use BKE_collection_ui_name_get() to get the collection
name, because the Scene Collection's name is hardcoded, but it can be
localized.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D17112
2023-01-30 09:31:38 +01:00
90e9406866 VSE: Add Update scene frame range operator
This operator updates scene strip internal length to reflect target
scene length. Previously scene strip had to be deleted and added from
scratch. Scene strip length in timeline will not be changed.
2023-01-30 07:56:53 +01:00
ad146bd17a Fix T103852: Muting timeline channel does not update image
Add RNA update function to invalidate cache for all strips in channel.
2023-01-30 06:48:01 +01:00
11de4aa0ce Update RNA to User manual mappings 2023-01-29 19:00:47 -05:00
042775ad48 Sculpt: Fix T104068, depth calculation error in trim tools
Also made the coplanar padding factor relative.
2023-01-28 16:10:02 -08:00
e497da5fda Fix: off by one error in previous commit
Fixes rB90253ad2e753acde161b38d82bd650d54d3f6581.
2023-01-29 00:13:37 +01:00
52ed8bcb27 Gitea: fix pull request template so commit body can be set as description 2023-01-28 18:11:51 +01:00
90253ad2e7 Geometry Nodes: avoid creating a lazy function many times
It's better to use some statically allocated functions instead
of dynamically allocating them all the time.
2023-01-28 15:28:55 +01:00
b2534fb866 Fix: anonymous attribute output requested even though it's not used
The code removed here was intended to be an optimization that
avoids creating an additional node to join multiple attribute sets.
However, that optimization did not work, because it did not take
into account whether the single attribute set is required or not.
2023-01-28 14:55:39 +01:00
904357d67a Fix: assert when converting between incompatible field types
This results in a compile time error now which hopefully prevents
this specific kind of mistake in the future.
2023-01-28 14:52:15 +01:00
89aae4ac82 Node Editor: Controlled node link swapping
Allow to explicitly swap node links by pressing the alt-key while
reconnecting node links. This replaces the old auto-swapping based on
matching prefixes in socket names.

The new behavior works as follows:

* By default plugging links into already occupied (single input)
  sockets will connect the dragged link and remove the existing one.
* Pressing the alt-key while dragging an existing node link from one
  socket to another socket that is already connected will swap the
  links' destinations.
* Pressing the alt-key while dragging a new node link into an already
  linked socket will try to reconnect the existing links into another
  socket of the same type and remove the links, if no matching socket
  is found on the node. This is similar to the old auto-swapping.

Swapping links from or to multi input sockets is not supported.

This commit also makes the link drag tooltip better visible, when using
light themes by using the text theme color.

Reviewed By: Hans Goudey, Simon Thommes

Differential Revision: https://developer.blender.org/D16244
2023-01-28 10:07:29 +01:00
fe5c3a0ab3 GNUmakefile: add convenience target 'check_wiki_file_structure'
This target ensures https://wiki.blender.org/wiki/Source/File_Structure
follows Blender's source tree.
2023-01-28 16:41:12 +11:00
4e9c6929c1 VSE: Handle drivers when duplicating strips
Most operations where strips are duplicated use `SEQ_animation` API,
which handles keyframe animation. Now drivers are handled as well.

When group of strips is duplicated and driver references other strip,
it will still reference original strip. However, this is much better,
than previous behavior, when strip duplication results in "transfer" of
driver from original strip to duplicated one.

Fixes T104141
2023-01-28 03:24:44 +01:00
3a9e589142 Fix (Unreported): VSE side panel flickering when tweaking offset value
Panel was split by factor calculated from property value string length.
Since these properties have float type now, calculated length was
incorrect.
2023-01-28 00:25:56 +01:00
d7e914270f Fix (unreported): Pasted strip is not active
Broken by renaming strip before comparing name to reference.
2023-01-28 00:08:07 +01:00
cef03c867b UV: cleanup winding
Simplify `BM_uv_element_map_create` by using `BM_face_calc_area_uv_signed`.

Remove unused UV winding code in `BM_uv_vert_map_create`.

Fixes unlikely memory leak in `BKE_mesh_uv_vert_map_create`.

No functional changes.

Differential Revision: https://developer.blender.org/D17137
2023-01-28 11:03:45 +13:00
8336de03a6 Cleanup: VSE: use context->for_render instead of G.is_rendering 2023-01-27 22:50:38 +01:00
9facc5067a Cleanup: Simplify mesh and point cloud conversion
Since mesh positions are stored as a generic attribute,
the attribute doesn't need special handling here.
2023-01-27 14:34:10 -06:00
Colin Basnett
328772f2d9 Mesh: Add operator to flip quad tessellation
This adds a new operator: bpy.ops.mesh.flip_quad_tessellation()

This operator rotates the internal loops of the selected quads, allowing
the user to control tessellation without destructively altering the
mesh.

{F14201995}

This operator can be found in the "Face" menu (Ctrl+F) under "Face
Data".

{F14201997}

Reviewed By: campbellbarton, dbystedt

Differential Revision: https://developer.blender.org/D17056
2023-01-27 11:02:55 -08:00
f5e76aa39e Cleanup: Array types, const, math API in workbench code
Some miscellaneous cleanups left over from a fix/cleanup combo:
- Use const variables
- Use the C++ `math` namespace functions
- Use `std::array` for arrays with size known at compile time
- Use `MutableSpan` instead of reference to array

Differential Revision: https://developer.blender.org/D17094
2023-01-27 11:35:08 -06:00
0050d6d399 Cleanup: move function to file where it is used
`drawLine` is only used for constraint, so it should be in
`transform_constraints.c`
2023-01-27 14:10:43 -03:00
8343e841fd Cleanup: Quiet unused variable warning in non-debug builds 2023-01-27 09:59:59 -06:00
179605bd2d Fix T104168: No active UV when reading auto-save files
Similar to 6d12d43a05, we should skip the
legacy to generic conversion if there's nothing to convert.
2023-01-27 09:59:59 -06:00
000e722c7d Geometry Nodes: Optimize start point case of Points of Curve node
In the node groups for T103730, the "Points of Curve" node is often used to
retrieve the root point of every curve. Since the curve point offsets array
already contains that data directly, we can detect this as a special case and
avoid all the other work.

Differential Revision: https://developer.blender.org/D17128
2023-01-27 09:59:59 -06:00
e99ae0a75d Vulkan: Tweaks to CMake configuration.
MoltenVK wasn't found as it was previous part of lib/vulkan.
as lib/vulkan now doesn't contain
the full sdk, we will use a moltenvk folder.

At this moment the moltenvk folder isn't filled, but will eventually be.
2023-01-27 16:58:14 +01:00
b67b84bd5d Fix T103984: USD exports pass usdchecker
These changes were authored by Michael B Johnson (drwave).

The default Blender USD export currently produces files that trigger
errors in the usdchecker that ships with USD 22.11.

The changes are:

- Set the defaultPrim if no defaultPrim is set. This sets it to the
first prim in the hierarchy which matches the behaviour of Pixar's
referencing (where referencing a USD layer without a defaultPrim will
pick the first prim) as well as matches the logic in Pixar's Maya USD
exporter code.

- Applies the MaterialBindingAPI to prims with material binding
attributes. This is a relatively new requirement for USD as it will
help for efficiency with upcoming changes to Hydra.

- Removes the preview scope in the USD shader hierarchy, because it
is no longer valid for shaders to have any non-container ancestors in
their hierarchy up until the enclosing Material prim.

Reviewed by: Michael Kowalski

Differential Revision: https://developer.blender.org/D17041
2023-01-27 10:29:58 -05:00
4635dd6aed Fix T104157: Deleting an active OSL node causes issues
Removing all OSL script nodes from the shader graph would cause that
graph to no longer report it using `KERNEL_FEATURE_SHADER_RAYTRACE`
via `ShaderManager::get_graph_kernel_features`, but the shader object
itself still would have the `has_surface_raytrace` field set.
This caused kernels to be reloaded without shader raytracing support, but
later the `DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE`
kernel would still be invoked since the shader continued to report it
requiring that through the `SD_HAS_RAYTRACE` flag set because of
`has_surface_raytrace`.
Fix that by ensuring `has_surface_raytrace` is reset on every shader update,
so that when all OSL script nodes are deleted it is set to false, and only
stays true when there are still OSL script nodes (or other nodes using it).

Maniphest Tasks: T104157

Differential Revision: https://developer.blender.org/D17140
2023-01-27 16:14:25 +01:00
2590de913d Cleanup: Silence compilation warning (unused parameter). 2023-01-27 15:50:52 +01:00
46c68c46a5 3D Texturing: Adding more cases where seams can be fixed.
Case added where a corner in uv space share the same edge in 3d space.
This used to work, but was lost when implementing
the new approach.
2023-01-27 15:49:10 +01:00
3d7697b325 Tweak to previous commit: move checks on DNA deprecated data at the end of readfile code.
BKE blendfile should not be allowed to deal with DNA deprectaed data, so
move recent check in rB138b3815e528 into BLO readfile, in a new
`blo_read_file_checks` util that is being called at the very end of main
readfile code (`blo_read_file_internal` and `library_link_end`).
2023-01-27 15:32:44 +01:00
138b3815e5 Fix (unreported) missing clear of deprecated Window data on fileread.
rB7f564d74f9ed (6 years ago!) forgot to clear the deprecated
`Window->screen` pointer on file read for recent-enough .blend files.

This is required since a valid value is always written in .blend files
for that pointer, to ensure backward compatibility.

The issue was never detected so far because that pointer is explicitely
reset to NULL after filewrite, which includes any memfile undostep
write, and usually existing UI data is re-used instead of loading the
one from the .blend file, so thedden  assert in `blo_lib_link_restore`
would never be triggered.

Now moved the assert at the end of `setup_app_data` to ensure it always
get checked.
2023-01-27 15:14:55 +01:00
1fd1d24265 Revert accidental changes to sub-modules
When committing via VSCode's Git UI,
my commit 073cf46b2e
seems to have affected sub-modules.
Gotta be more careful!
2023-01-27 15:05:44 +01:00
073cf46b2e Fix Generic List move ops clickable with 1 element
Meant to include this piece of feedback from Sybren in D14119.
2023-01-27 14:56:53 +01:00
75d6228583 PyAPI: Generic UIList for CollectionProperties
This patch adds a draw_ui_list() function, which is a wrapper around
layout.template_list(). It implements generic add/remove/move buttons,
passing the correct "row" integer to template_list(), as well as a
drop-down menu, if provided, making it a complete solution for
consistent UILists for addons.

Differential Revision: https://developer.blender.org/D14119
2023-01-27 14:51:13 +01:00
Iliya Katueshenock
454057f9df Fix T104175: adding Blur Attribute node with link drag search fails
The node does not support blurring booleans, but that was not handled
property in link drag search.

Differential Revision: https://developer.blender.org/D17139
2023-01-27 14:48:29 +01:00
79f70e48eb Fix: crash in mesh topology nodes
This was broken in rBd6c9cd445cb41480b40.
2023-01-27 12:40:08 +01:00
d5b026a16c Fix incorrect RNA path for GPencil brush settings, and add it for Curves brush settings.
RNA paths should be relative to their owner ID, not to some other ID!
2023-01-27 11:11:18 +01:00
0cce653892 Cleanup: Pass double2 by reference.
Just to be sure if compilers aren't inlining the function that at
least the parameter isn't copied.
2023-01-27 10:25:39 +01:00
71d7c919c0 ImBuf: Limit transform region to pixels that are affected by the transformation.
Only the area where the source buffer will be drawn on the destination buffer
will be evaluated. This will improve performance in sequencer and image editors as
less calcuations needs to happen.
2023-01-27 09:56:19 +01:00
b3fd169259 ImBuf: Precalc subsamples to reduce branching.
Micro improvement to store delta uv per subsample. This reduces
branching that might happen on the CPU, but also makes it possible
to add other sub-sampling filters as well.

No changes for the end-user.
2023-01-27 08:39:26 +01:00
2b4bafeac6 UV: add "similar object" and "similar winding" to uv "select similar"
Adds new options to UV Face selection in the UV Editor, with UV > Select > Select Similar

In multi object edit mode, "Similar Object" selects faces which have the same object.

"Similar Winding" will select faces which have the same winding, i.e. are they
facing upwards or downwards.

Resolves: T103975
Differential Revision: https://developer.blender.org/D17125
2023-01-27 17:58:07 +13:00
6c8db7c22b Fix T103868: render uv transform gizmo even if it has zero area
Change the 2D Gizmo drawing function to provide a usable transform matrix,
if it would otherwise be degenerate.

Differential Revision: https://developer.blender.org/D17113
2023-01-27 17:06:14 +13:00
34a6591a07 Fix T98594: missing uv editor redraw with geometry nodes modifier
If an object has a geometry nodes modifier, the UVs on that object might change
in response to any change on any other object.

Now we will redraw the UV editor on any object change, not just the active object.

Differential Revision: https://developer.blender.org/D17124
2023-01-27 16:53:14 +13:00
d76004f48f Sculpt: Fix sculpt expand not switching falloff types properly 2023-01-26 17:54:10 -08:00
742c2e46bb Cleanup: format 2023-01-27 14:45:37 +13:00
e735bf02cb Fix linux/mac compiler warning. 2023-01-26 20:16:07 -05:00
647cffc001 Sculpt: Add numpad aliases for number keymap entries in expand modal map 2023-01-26 16:57:28 -08:00
Aaron Carlisle
3e90390918 Sculpt: Resolve Shift R shortcut conflicts
Based on T99607:
- Existing Angle Control shortcuts are removed
- Voxel, Dyntopo and Hair resolution shortcuts are remapped to `R`

Since voxel remeshing is not compatible with dyntopo, each can use the shortcut `R` for the remeshing resolution without causing a conflict.
The shortcut `R` is not currently used for anything important.
The angle control menu is commonly not used.
And sculpt mode is only coincidentally inheriting the rotate operator shortcut on `R` because nothing else is mapped to the key.

Reviewed By: Julien Kaspar and Hans Goudey and Joseph Eagar
Differential Revision: https://developer.blender.org/D16511
Ref D16511
2023-01-26 16:55:03 -08:00
cdef135f6f USD import: Support importing USDZ.
This addressed feature request T99811.

Added the following features to fully support importing USDZ archives:

- Added .usdz to the list of supported extensions.
- Added new USD import options to copy textures from USDZ archives. The
textures may be imported as packed data (the default) or to a directory
on disk.
- Extended the USD material import logic to handle package-relative texture
assets paths by invoking the USD asset resolver to copy the textures from
the USDZ archive to a directory on disk. When importing in Packed mode,
the textures are first saved to Blender's temporary session directory
prior to packing.

The new USD import options are

- Import Textures: Behavior when importing textures from a USDZ archive
- Textures Directory: Path to the directory where imported textures will
be copied
- File Name Collision: Behavior when the name of an imported texture file
conflicts with an existing file

Import Textures menu options:

- None: Don't import textures
- Packed: Import textures as packed data (the default)
- Copy: Copy files to Textures Directory

File Name Collision menu options:

- Use Existing: If a file with the same name already exists, use that
instead of copying (the default)
- Overwrite: Overwrite existing files

Reviewed by: Bastien

Differential Revision: https://developer.blender.org/D17074
2023-01-26 18:08:45 -05:00
Iliya Katueshenock
9a4c54e8b0 Fix: Curve to Points node has wrong field interface status
In 7536abbe16 changes make possible to input field as Count field.
But changes of declaration probably was forgotten. So now this input
can take field and node will be work. But input link was red. This
patch resolves this issue.

Differential Revision: https://developer.blender.org/D17131
2023-01-26 13:01:03 -06:00
d6c9cd445c Geometry Nodes: Skip sorting in topology nodes if possible
When the sort weights are a single value, they have no effect,
so sorting the relevant indices for the element will be wasted work.
The sorting is expensive compared to the rest of the node. In my
simple test of the points of curve node, it became 6 times faster
when the weights are a single value.
2023-01-26 12:34:28 -06:00
Germano Cavalcante
3b4486424a Fix repeated transform constraint orientations
On some occasions, as in cases where transform operations are triggered
via gizmos, the constrain orientations that can be toggled with
multiple clicks of X, Y or Z were repeated.

There is no use in maintaining repeated orientations.
2023-01-26 14:54:48 -03:00
f19f50d288 USD export test format fixes. 2023-01-26 10:35:14 -05:00
1fd54204b0 Enable commented out code.
Code was disabled for debugging purposes.
2023-01-26 15:17:37 +01:00
c412c38f0d Fix missing code-paths in previous sequence/imbuf commits. 2023-01-26 15:15:21 +01:00
3b17d6c619 Sequencer: Made subsampling a transform option.
There are cases where automatic selection of subsampling doesn't work
This patch move adds a filtering option that
can enable this.
2023-01-26 15:03:19 +01:00
f210842a72 Sequencer: Improve Image Transform Quality When Exporting.
Image Transform use linear or nearest sampling during editing and exporting.
This gets sampling is fine for images that aren't scaled. When sequencing
however you mostly want use some sort of scaling, that leads to poorer
quality.

This change will use sub-sampling to improve the quality. This is only
enabled when rendering. During editing the subsampling is disabled to
keep the user interface reacting as expected.

Another improvement is that image transform is stopped at the moment
it hadn't sampled at least 4 samples for a scan line. In that case we
expect that there are no further samples that would change to result.

In a future patch this could be replaced by a ray/bounding bo intersection
as that would remove some unneeded loops in both the single sampled and
sub sampled approach.
2023-01-26 14:25:49 +01:00
6d79bc0073 ImBuf: Use vector types in transform.cc.
Replace array types with the vector types. No functional changes.
2023-01-26 14:25:49 +01:00
f7dd7d5454 Python API: add a method for reordering modifiers.
Add an `object.modifiers.move()` method, similar to the one
for constraints and some other collections. Currently reordering
modifiers requires using operators, which depend on context.

The implementation is straightforward, except for the need to
make the severity of errors reported by the underlying editor
code into a parameter, so that the new Python API function
reports any problems as Python exceptions, and refactoring
the code to allow aborting a blocked move before making any
changes. I also turn the negative index condition from an assert
into an error.

Differential Revision: https://developer.blender.org/D16966
2023-01-26 14:56:58 +02:00
4a768a7857 Cleanup: remove unused variable 2023-01-26 13:31:41 +01:00
a42f307915 Shader Nodes: Use layers from evaluated mesh
The list was populated from the base (unevaluated) object, but now that
Geometry nodes can generate various layers this is impractical..

Differential Revision: https://developer.blender.org/D17093
2023-01-26 10:31:13 +01:00
ef39d85d7c Fix T104121: Grease pencil clear function in python not updated in viewport
The clear functions for grease pencil data/frame/layer
was not followed by immediate update in the viewport.
Some notifiers were missing in the rna definition of these functions,
which are added in by this patch.

Reviewed By: Antonio Vazquez

Differential Revision: https://developer.blender.org/D17120
2023-01-26 09:02:45 +01:00
564673b8ea Fix T71137: curve minimum twist producing wrong geometry
Only one point should be used to create a reference rotation for other
points to follow. Using two caused the resulting twist to be
asymmetric, especially noticeable on symmetrical, cyclic curves.

An update to [0] which broke curve_to_mesh & deform_modifiers tests,
now this change only applies to cyclic curves as the final result was
much greater for non-cyclic curves because of a difference between how
end-point directions are calculated (see code-comments for details).

Alternate fix to D11886 which caused T101843.

[0]: 36a82314a0.
2023-01-26 17:38:20 +11:00
c1beaea80f Fix T103587: Redo panel doesn't appear for spin operator
Regression in [0] which cleared the redo-panel if an operator added
its own undo step. This worked for sculpt to fix T101743, but caused
the redo-panel to be cleared for actions who's undo steps where created
by nested operators (which is the case for the spin operator).

Fix by checking an undo-step is added without registering an operator.

[0]: f68e50a263
2023-01-26 11:06:38 +11:00
f5d94f97e4 Fix T104132: Vertex colors no longer displaying in Workbench 2023-01-25 23:01:00 +01:00
fa57c691f6 USD IO CI Tests
Various new CI tests for USD Import / Export functionalty:

Import:
 - Added mesh import tests for topology types and multiple UV sets. (Python)

Export:
 - Added a verification tests for mesh topology. (C++)
 - Added a test to make sure UsdPreviewSurface export conversion of materials
is correct. (C++)

Reviewed by: Sybren and Hans.

Differential Revision: https://developer.blender.org/D16274
2023-01-25 14:51:39 -05:00
feae1c7d05 Gitea: update issue template with new scoped labels and other tweaks 2023-01-25 20:39:27 +01:00
6e0d58a68a Cleanup: Edit Mesh: Decrease variable scope, use bool instead of int 2023-01-25 12:56:26 -06:00
9ad051140c Revert "Fix T71137: curve minimum twist producing wrong geometry"
This reverts commit 36a82314a0.
as it has broken tests for the last day and a half, it likely just
needs a test file update, but we can't keep this failing longer
than it already has.
2023-01-25 11:00:08 -07:00
Sibo Van Gool
2f9346bc0a Fix T104071: Mix up in Realize Instances tooltip text
A mistake in the node type descriptions gave the node a description for
the reverse curve node.

Differential Revision: https://developer.blender.org/D17111
2023-01-25 11:42:10 -06:00
f954029e97 Curves Sculpt: Add report about missing surface for puff brush
This is done in the other sculpt brushes that require a surface object.
2023-01-25 11:38:12 -06:00
405b08e00d Fix: Workbench Next: Ensure matcaps textures are loaded 2023-01-25 17:12:25 +01:00
e744673268 Draw: Improve Texture assignment operator
Differential Revision: https://developer.blender.org/D17119
2023-01-25 17:12:25 +01:00
ffe45ad87a USD import unused materials.
Added a new Import All Materials USD import option.  When this
option is enabled, USD materials not used by any geometry will
be included in the import.  Imported materials with no users
will have a fake user assigned.

Maniphest Tasks: T97195

Differential Revision: https://developer.blender.org/D16172
2023-01-25 10:46:07 -05:00
Faheim Arslan M
69288daa74 Fix T100674: Use plural for axes option in object properties
This commit fixes T100674, Renamed the "axis" label under viewport display
panel to "axes" in object properties.

Differential Revision: https://developer.blender.org/D16650
2023-01-25 16:25:17 +01:00
12ca26afc2 Fix T104089: Removing greasepencil vertex group can leave no active
We should always have an active vertexgroup (making sure this is the
case was just not happening on the greasepencil side).

Now do this (similar to what is done for other object types in
`object_defgroup_remove_common`).

Maniphest Tasks: T104089

Differential Revision: https://developer.blender.org/D17091
2023-01-25 13:52:35 +01:00
ef3225b9da Cleanup: Workbench Next: Remove UNUSED_VARS 2023-01-25 13:16:53 +01:00
e27d1d9bb6 Fix broken listdir code.
Error in `bli_builddir` cahnges in B4815d0706fb5 commit.
2023-01-25 12:31:00 +01:00
b898e00edc Cleanup: remove unused KernelGlobals in microfacet BSDF 2023-01-25 11:26:51 +01:00
72c012ab4a Python: enable user site-packages without --python-use-system-env
User site-packages were disabled unless `--python-use-system-env`
argument was given. This was done to prevent Blender's Python
unintentionally using modules that happened to be installed locally,
however it meant so pip installing modules from Blender would fail to
load those modules (for some users).

Enable user site-packages since it's needed for installing additional
packages via pip, see code-comments for details.

Resolves T104000.
2023-01-25 12:52:30 +11:00
7416021bf7 Command Line Arguments: all errors now print to the stderr
This was done by some callbacks but not all.
Only use the stdout for status & information.
2023-01-25 12:20:48 +11:00
6c310acccc help now includes a GPU section & improve --gpu-backend error
- Include available GPU backends in the GPU backend error.
- Use stderr for the error message.
2023-01-25 12:20:00 +11:00
821dee6de4 CMake: de-duplicate option(..) for platform specific defaults
Use a variable for the default instead, avoid duplicate descriptions.
2023-01-25 12:18:41 +11:00
adcb0edca0 Cleanup: clang-tidy, replace defines with enum, redundant parenthesis 2023-01-25 11:53:06 +11:00
9c71f5807f Cleanup: remove unused argument, warnings 2023-01-25 11:18:33 +11:00
0c2b2cdb78 BLI_filelist: minor changes to bli_builddir behavior
- Don't call exit() when memory allocation fails, while unlikely
  internal failures should not be exiting the application.
- Don't print a message when the directory is empty as it's
  unnecessarily noisy.
- Print errors the the stderr & include the reason for opendir failing.
2023-01-25 10:48:59 +11:00
d3967ce27c Cleanup: use early return in bli_builddir, reduce right shift 2023-01-25 10:48:56 +11:00
b51034b9ca Asset system: use native slash for AssetLibraryIndex.indices_base_path
When constructing run-time paths native slashes are preferred as WIN32
doesn't have full support for forward slashes in paths.
It can also cause problems when performing exact matches on paths
which are normalized, where normalizing one of the paths makes
comparisons fail.

Using the system native slash would have avoided T103385.
2023-01-25 09:59:43 +11:00
b8cb962fb2 Cleanup: perform string join & allocation in a single step 2023-01-25 09:59:33 +11:00
d446809f96 Cleanup: remove unused argument 2023-01-25 09:53:35 +11:00
c5d9938adc Fix T104073: Unable to add more than two strips in one channel
Originally, function `sequencer_generic_invoke_xy_guess_channel`
looked in what channel the last strip of the same type is and the
channel used for new strip placement. This was changed as a workaround
when sound strips were added below movie strips
(58bea005c5).
Now these workarounds aren't necessary, but the function was left
unchanged.

Current logic is for adding movie strip to channel 1 is:
- Sound is added to channel 1
- Video is added to channel 2
- If there is only video, it is added to channel 1

Since movie may, or may not contain sound, it is not possible to align
added strips in a way that was done before, unless timeline is analyzed
more in detail, but this would be quite inefficient.
Also, note, that the code did not work, if strip is added next to
previous one, so it mostly did not work as intended.

This commit changes:
- Fix alignment not working when strip is added right next to previous
  strip
- Assume that movie strips have sound strip underneath it, so channel
  below last movie strip is picked
- For other strip types, pick channel of the last strip of same type

Ultimately, the code is still rather weak, and better system, like using
channel where strip was manually moved, or concept of "typed channels"
would improve this feature.
2023-01-24 23:28:16 +01:00
1ad11355a3 Transform: fix use of "snap_point" property
There is not much documentation on the "snap_point" property, but by
code it is possible to note that it serves to set a target snap point
and is of internal use as it is hidden from the Redo panel.

However, this property was still very dependent on Tools settings and
if set to an operator's call, it changes the scene configurations
inadequately.

Therefore,
- remove this dependency from UI for rotation and resize operators,
- do not change the state of the snap in the scene and
- cleanup the code.
2023-01-24 17:10:21 -03:00
0f52aa0954 Transform: Initialize 'transform_matrix' accordingly
Some transform modes are changeable, so callbacks should be reset
together.

Currently the unchanged `transform_matrix` callback is not a major
issue as it is only used for gizmos and gizmos stop updating when
changing the operator type.
2023-01-24 17:10:21 -03:00
5cc9f07d5c Draw: Workbench Next: Fix shaders memory leaks
Ensure all shaders are deleted
2023-01-24 20:52:35 +01:00
361ebe98d5 Draw: Workbench Next: Fix shadow culling after recent cleanup commit
79ba1a1ac8 changed virtual function signatures so they didn't match their parents.
2023-01-24 20:52:35 +01:00
789ab9b92a Sculpt: Fix T104090: Automask topology not constrained by brush radius 2023-01-24 11:04:39 -08:00
a73a2d345f Fix T104044: keep order of UVMaps on load
Use a Vector<std::string> , instead of a Set<std::string> as a Set does
not keep the same order when iterating over it.

Differential Revision: https://developer.blender.org/D17103
2023-01-24 18:26:02 +01:00
e56f284843 readfile: Fix 'virtual' issue in memfile case.
In many cases when reading undo memfile, n the 'restore id from old
main' part of the process, the 'id_old' is not set, which means that
the call to `BKE_main_idmap_insert_id` would try to dereference a `nullptr`.

In practice this is likely not an issue (see comment in code for details),
but at least explicitely check for a nullptr `id_old` pointer.

Would deffer actual cleanup of this area for after 3.5 is branched out.
2023-01-24 18:15:06 +01:00
30b34735e3 Cleanup/refactor: Add a new flag for IDTypes that are not read in memfile undo.
Currently only affects 'UI' IDs (WindowManager, Screen, etc.), but in
the future other types may be affected as well.

NOTE: this is only used in readfile code itself, not in the
post-processing performed by `setup_app_data`, as this code is too
specific for such generic handling.
2023-01-24 18:15:06 +01:00
e308b891c8 Cycles: Use faster and exact GGX VNDF sampling algorithm
Based on "Sampling the GGX Distribution of Visible Normals" by Eric Heitz
(https://jcgt.org/published/0007/04/01/).

Also, this removes the lambdaI computation from the Beckmann sampling code and
just recomputes it below. We already need to recompute for two other cases
(GGX and clearcoat), so this makes the code more consistent.

In terms of performance, I don't expect a notable impact since the earlier
computation also was non-trivial, and while it probably was slightly more
accurate, I'd argue that being consistent between evaluation and sampling is
more important than absolute numerical accuracy anyways.

Differential Revision: https://developer.blender.org/D17100
2023-01-24 17:59:29 +01:00
fdcb55b285 Cycles: Switch microfacet code to non-separable shadowing-masking term
This gives closer results to what I've seen in papers and other renderers when
using the code to precompute albedo later (to replace MultiGGX).

It's usually a tiny difference, the only case where I've seen it matter is
in the `shader/node_group_float.blend` test - but that's a (single-scatter) GGX
closure with 0.9 roughness, so it's not too surprising. In any case, the new
result looks closer to Eevee, so that's good I guess.

Differential Revision: https://developer.blender.org/D17099
2023-01-24 17:59:29 +01:00
ce25e3e581 Cycles: Cleanup: Add general-purpose conversion between sin and cos 2023-01-24 17:59:29 +01:00
b1c8889396 Cleanup: format 2023-01-24 17:59:29 +01:00
ae80a6696f Geometry Nodes: don't show warning in modifier with multiple geometry inputs
Simon mentioned that this gets in the way more than it helps. No geometry
sockets currently show up in the modifier panel. People may build node groups
that have multiple geometry inputs that can be used when the group is used
as node instead of as modifier.

In the future we could also allow e.g. choosing an object to pass into a geometry
socket. That has the problem that we'd also have to duplicate other functionality
of the Object Info node (original vs. relative space).
2023-01-24 17:45:47 +01:00
6899474615 Fix: crash when adding curves in curves sculpt mode with interpolation
There were two issues:
* The `new_point_counts_per_curve` was one too large, resulting in
  `interpolate_from_neighbors` reading invalid memory.
* Writing the counts into the existing offsets array didn't quite work
  because there can be a collision at the offset right between the
  last old curve and the first new point. There was a race condition
  where this value could be read and written at the same time.
2023-01-24 17:36:53 +01:00
62743dde11 Gpencil: More UI tweaks in Offset modifier
Remove more duplicate words
2023-01-24 16:53:28 +01:00
0931d91ab6 GPenciil: Small UI tweak
Remove duplicate `Layer` word
2023-01-24 16:47:22 +01:00
3956c4738f GPencil: Change range for Length value in Simplify modifier
In some cases a smaller value is required. Anyways, the UI value
soft limit is 0.005
2023-01-24 16:44:37 +01:00
813425877b Geometry Nodes: propagate material from guides in Interpolate Curves node
This was missing from the original implementation.
2023-01-24 16:24:00 +01:00
6e4e5f6484 UI: Allow spawning file browser dialog from regular file browser editor
When some path property was displayed in the File Browser, clicking the
icon to open a file browser dialog to choose a file/directory would
show an error. While this makes sense when you are already in a file
browser dialog (we don't support such nested file browser dialogs),
allow it when the file browser is opened as a normal editor, not as a
dialog.
2023-01-24 15:33:44 +01:00
10a06dfd11 Code-style: Rename internal parts of pbvh_uv_islands.
- InnerEdge -> FanSegment
- full -> is_manifold
2023-01-24 15:12:21 +01:00
21eff2c0ac 3DTexturing: Improve fix seam bleeding for manifold parts of mesh.
Current implementation had some faulty assumtions and had some work
arounds for crashes that were actually limitation of the implementation.

The main reason for this was that the implementation didn't add new
primitives in the same direction it was already adding. Some when
incorrect behavior was detected it was assumed that the part wasn't
manifold (anymore) and didn't fix that part of the mesh.

The new implementation will extract a solution and use this solution
also as the order to generate primitives in uv space.

This patch fixes several crashes and improves the overall quality
when fixing seam bleeding. It also adds additional debug tools
(print_debug) implementation in order to find issues faster in the
future.
2023-01-24 15:03:21 +01:00
4815d0706f Fix T103385: Asset Browser Thumbnails take long time to load
Regression in [0] caused by a change where path joining would
replace a forward slash with a back-slash when joining paths WIN32.
Now the directory is always used as a prefix for the paths returned
by BLI_filelist_dir_contents which resolves the regression.

[0]: 9f6a045e23
2023-01-25 00:21:13 +11:00
246485b213 BLI_path: make BLI_path_slash_is_native_compat into a public function 2023-01-25 00:21:11 +11:00
33edef15ed Fix T104095: missing crazy space data while sculpting curves
`remember_deformed_curve_positions_if_necessary` has to be called before
topology changing operations on curves. Otherwise the crazy-space data
is invalid.
2023-01-24 14:07:01 +01:00
cf332e896f GPencil: Fix unreported double rotation in Fill circles
The help circles to fill areas were rotated with the object rotation,
but as the stroke is part of the object, apply the rot matrix again
produced a double rotation, so it can be removed.
2023-01-24 13:19:22 +01:00
c16bd34316 Fix: memory allocation before guarded allocator is initialized
Use the construct-on-first-use idiom to fix this.
2023-01-24 13:07:54 +01:00
a36e2a9b64 Gpencil: Expose stroke and point time properties to API
Two properties are now exposed in python API :
time of each point, and inittime of each stroke.

Reviewed by: Antonio Vazquez

Differential Revision: https://developer.blender.org/D17104
2023-01-24 12:39:48 +01:00
74aa960398 Cleanup: add newline in Collada error message 2023-01-24 10:53:52 +01:00
1c90f8209d Cycles: fix rendering with Nishita Sky Texture on Intel Arc GPUs
Speckles and missing lights were experienced in scenes with Nishita Sky
Texture and a Sun Size smaller than 1.5°, such as in Lone Monk and Attic
scenes.
Increasing the precision of cosf fixes it.
2023-01-24 09:58:22 +01:00
6279042d21 Cleanup: use const, doc-string for BevList.poly & rename args
It wasn't clear that BevList.poly was used to check cyclic BevList's.
2023-01-24 16:42:38 +11:00
36a82314a0 Fix T71137: curve minimum twist producing wrong geometry
Only one point should be used to create a reference rotation for other
points to follow. Using two caused the resulting twist to be
asymmetric, especially noticeable on symmetrical, cyclic curves.

Alternate fix to D11886 which caused T101843.
2023-01-24 16:40:58 +11:00
67c48314ba Revert "Fix T71137: curve minimum twist producing wrong geometry"
This reverts commit cf72194214.
2023-01-24 15:33:47 +11:00
0ad4d07f10 Fix: Debug build compile error after recent cleanup commit
79ba1a1ac8 missed that this variable was used in an assert.
2023-01-23 15:57:33 -06:00
f72969f377 Fix T103888: Regression: Side-by-side stereo renders ignore color management
Looks like rB42937493d8253a295a97092315288f961e8c6dba accidentally dropped the
colorspace copy.
2023-01-23 22:12:16 +01:00
42f8f98ee1 Fix T104088: Geometry nodes modifier boolean lost on undo
After object-mode undo (memfile undo), the value wan't lost, but the
property would be temporarily converted back to integer type in order
to be forward compatible. Now only use the forward compatible
writing when writing undo steps. Auto-saves and similar files are
currently not forward compatible anyway.
2023-01-23 15:06:55 -06:00
79ba1a1ac8 Cleanup: Compiler warnings in new sculpt & workbench
Set but unused variables, unused arguments, unnecessary/incorrect type
casting, missing static qualifier. Unused arguments are removed.
2023-01-23 14:57:26 -06:00
f24b9a7943 Cleanup: Rename pbvh.cc to pbvh_colors.cc
In preparation for moving pbvh.c to C++, give this file a different name
so git will recognize that future commit as a rename.
2023-01-23 14:47:08 -06:00
7fc395354c Cleanup: Use offset indices arguments for curves utilities
Make the functions more flexible and more generic by changing the curves
arguments to the curve offsets. This way, theoretically they could become
normal utility functions in the future. Also do a consistency pass over
the algorithms that generate new curves geometry for naming and
code ordering, and use of utility functions. The functions are really
quite similar, and it's much easier to tell this way.
2023-01-23 14:43:04 -06:00
15575b953d Merge By Distance: Optimize algorithm to find duplicate polygons
The most time-consuming operation in merge by distance is to find
duplicate faces (faces that are different but have the same vertices).

Therefore, some strategies were planned to optimize this algorithm:
- Store the corner indices in an array thus avoiding multiple calls of `weld_iter_loop_of_poly_next`;
- Create a map of polygons linked to edges instead of linked to vertices - this decreases the number of connections and reduces the calculation of the intersection of polygon indices.

There are other fields to optimize, like reusing the `wpolys` array
instead of creating a new array of corner offsets. And join some arrays
as members of the same struct to be used in the same buffer.
But for now, it is already a nice optimization. And the new
`poly_find_doubles` function can be reused in the future to create a
generic utility.

The result of the optimization varies greatly depending on the number
of polygons, the size of each polygon and the number of duplicates.
On average it was something around 2 times faster.

Worst case tested (old vs new): 0.1ms vs 0.3ms
Best case tested (old vs new): 10.0ms vs 3.2ms

Differential Revision: https://developer.blender.org/D17071
2023-01-23 17:21:52 -03:00
b6b6e47e1d Sculpt: PBVH node splitting for texture paint
`PBVH_Leaf` nodes are now split into a new `PBVH_TexLeaf`
node type when using the paint brush.  These nodes are
split by image pixels, not triangles.  This greatly
increases performance when working with large
textures on low-poly meshes.

Reviewed By: Jeroen Bakker
Differential Revision: https://developer.blender.org/D14900
Ref: D14900
2023-01-23 10:44:50 -08:00
8afcecdf1f Cycles: update Intel Graphics compiler to 101.4032 on Windows
A noticeable (>5%) performance regression in oneAPI backend came with
a501a2dbff. Updating to latest graphics
compiler from driver 101.4032 fixes it.

I've tested it with current min-supported drivers and it runs well but
since compatibility of graphics compiler with older drivers isn't
guaranteed, I'm also bumping the min-supported driver versions.

If end-users consider latest drivers too fresh to switch to (version
isn't released as stable on Linux as of today but should be before
Blender 3.5 release), CYCLES_ONEAPI_ALL_DEVICES=1 env variable can be
used.

Intel Graphics Compiler on Linux will be updated in a later commit
so we can then close D16984.

Reviewed By: sergey, LazyDodo
2023-01-23 19:36:34 +01:00
fe8bf5e0c7 Fix T104039: GPencil Fill crash in multiframe
The problem was that the stroke array was not reset for 
each iteration of the loop, so the second time around, 
the array was not initialized correctly and 
was left with a NaN value.
2023-01-23 18:44:53 +01:00
e49e5f6f08 Enable USD Preview Surface import by default
The USD Preview Surface material import feature is now considered
stable, so this patch removes this option from the Experimental
category in the UI.

The Import USD Preview option is now enabled by default.

The Experimental box has been removed.

A new Materials box has been added to group the Import
USD Preview Surface, Set Material Blend and Material
Collision Mode options.

Reviewed by: Sybren

Differential Revision: https://developer.blender.org/D17053
2023-01-23 12:02:38 -05:00
ba982119cd Workbench Next
Rewrite of the Workbench engine using C++ and the new Draw Manager API.

The new engine can be enabled in Blender `Preferences > Experimental > Workbench Next`.
After that, the engine can be selected in `Properties > Scene > Render Engine`.
When `Workbench Next` is the active engine, it also handles the `Solid` viewport mode rendering.

The rewrite aims to be functionally equivalent to the current Workbench engine, but it also includes some small fixes/tweaks:
- `In Front` rendered objects now work correctly with DoF and Shadows.
- The `Sampling > Viewport` setting is actually used when the viewport is in `Render Mode`.
- In `Texture` mode, textured materials also use the material properties. (Previously, only non textured materials would)

To do:
- Sculpt PBVH.
- Volume rendering.
- Hair rendering.
- Use the "no_geom" shader versions for shadow rendering.
- Decide the final API for custom visibility culling (Needed for shadows).
- Profile/optimize.

Known Issues:
- Matcaps are not loaded until they’re shown elsewhere. (e.g. when opening the `Viewort Shading` UI)
- Outlines are drawn between different materials of the same object. (Each material submesh has its own object handle)

Reviewed By: fclem

Maniphest Tasks: T101619

Differential Revision: https://developer.blender.org/D16826
2023-01-23 17:59:07 +01:00
Jason Fielder
84c25fdcaa Metal: Improve command buffer handling and workload scheduling.
Improve handling for cases where maximum in-flight command buffer count is exceeded. This can occur during light-baking operations. Ensures the application handles this gracefully and also improves workload pipelining by situationally stalling until GPU work has completed, if too much work is queued up.

This may have a tangible benefit for T103742 by ensuring Blender does not queue up too much GPU work.

Authored by Apple: Michael Parkin-White

Ref T96261
Ref T103742
Depends on D17018

Reviewed By: fclem

Maniphest Tasks: T103742, T96261

Differential Revision: https://developer.blender.org/D17019
2023-01-23 17:47:21 +01:00
Jason Fielder
139fb38d4f DRW: Add texture usage host read to Lightcache texture.
Required by Metal backend to have correct usage flags for textures which are read by host.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D17020
2023-01-23 17:46:46 +01:00
Jason Fielder
1c672f3d1d Fix T103433: Ensure Metal memory allocator is safe for multi-threaded allocation. Resolves crash when baking indirect lighting.
Also applies correct texture usage flag to light bake texture.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem, jbakker

Maniphest Tasks: T96261, T103433

Differential Revision: https://developer.blender.org/D17018
2023-01-23 17:45:39 +01:00
Jason Fielder
0ba5954bb2 Fix T103635: Fix failing EEVEE and OCIO shader compilations in Metal.
Affecting render output preview when tone mapping is used, and EEVEE scenes such as Mr Elephant rendering in pink due to missing shaders.

Authored by Apple: Michael Parkin-White

Ref T103635
Ref T96261

Reviewed By: fclem

Maniphest Tasks: T103635, T96261

Differential Revision: https://developer.blender.org/D16923
2023-01-23 17:40:10 +01:00
8e56ded86d Cycles: temporarily disable AMD Vega GPU rendering due to compiler bug
To make daily builds pass while we figure this out.

Ref T104097
2023-01-23 17:30:12 +01:00
Jason Fielder
cd2926fb05 Fix T103412: Resolve selection outline rendering with Metal backend on AMD.
AMD GPUs do not appear to produce consistent results with other GPUs when using textureGather in the Metal backend. Disabling for now to ensure correct function of outline rendering.

This may require an additional sub-pixel offset in the texture sampling calls, to achieve correct behaviour.

Authored by Apple: Michael Parkin-White

Ref T103412
Ref T96261

Reviewed By: fclem

Maniphest Tasks: T103412, T96261

Differential Revision: https://developer.blender.org/D16934
2023-01-23 17:24:30 +01:00
Tomoaki Nakano
48b82a6ea3 Fix Metal GPU backend shader compile errors in certain language environments
This patch fixes an issue where Blender 3.5 alpha with the Metal GPU backend enabled on Japanese macOS fails to compile shaders and crashes on startup.

In a Japanese environment, `defaultCStringEncoding` is the legacy MacJapanese encoding, and it erroneously converts backslashes (0x5c) to Yen symbols (¥).
Therefore, Metal shader compile fails with the following log and Blender crashes.
```
2022-12-29 13:50:10.200 Blender[13404:246707] Compile Error - Metal Shader Library (Stage: 0), error Error Domain=MTLLibraryErrorDomain Code=3 "program_source:225:74: error: non-ASCII characters are not allowed outside of literals and identifiers
    template<typename T, access A = access::sample> struct STRUCT_NAME { ¥
                                                                         ^
program_source:226:14: error: no template named 'TEX_TYPE'
      thread TEX_TYPE<T, A> *texture; ¥
             ^
program_source:226:39: error: non-ASCII characters are not allowed outside of literals and identifiers
      thread TEX_TYPE<T, A> *texture; ¥
                                      ^
program_source:227:29: error: non-ASCII characters are not allowed outside of literals and identifiers
      thread sampler *samp; ¥
                            ^
...
```
We can use `stringWithUTF8String` instead.

Reviewed By: fclem, MichaelPW

Differential Revision: https://developer.blender.org/D16881
2023-01-23 16:56:06 +01:00
b44a8f6749 Fix: Draw: Negative scaled objects cause wrong resource indexing
In the new Draw Manager, when the same DrawGroup has both front and back facing instances, the front facing instances don't offset their indices accordingly.

Differential Revision: https://developer.blender.org/D17069
2023-01-23 16:42:37 +01:00
6043ed9e62 Build: checkout assets directory automatically
This changes `make update` to download the assets repository automatically
if it does not exist already. If it does exist, it is updated. Precompiled libraries
have the same behavior. This is required for T103620.

`pipeline_config.yaml` is updated as well for the builtbot.

Differential Revision: https://developer.blender.org/D17090
2023-01-23 13:52:21 +01:00
59ee5add12 Usual UI messages fixes & tweaks. 2023-01-23 12:31:43 +01:00
607b814096 DRW: Debug Print: Fix print of vec3 2023-01-23 11:05:04 +01:00
e0c8fa4ab9 DRW: Fix Texture.ensure() function always recreating the texture
This was caused by recent change of the `size()` method which now return
1 for missing dimensions.
2023-01-23 11:05:04 +01:00
f5c081dafc Fix T104033: UV edges not selecting when selecting faces
Regression in [0] replaced edge with vertex selection.

[0]: 6c774feba2
2023-01-23 20:23:55 +11:00
64dbfe714b Fix T99963: Fallback actions are used in RCS on left click
The right mouse-select action no longer changes the dragging behavior
of the left mouse button.
2023-01-23 17:31:56 +11:00
eca4b991d8 Cleanup: use function style casts 2023-01-23 17:31:46 +11:00
ab0be6ec24 Cleanup: quiet clang warnings 2023-01-23 17:31:44 +11:00
c68d4bf839 Cleanup: fix msvc compilation issue 2023-01-23 02:16:35 +01:00
93a840360a Cleanup: quiet clang warnings 2023-01-23 00:55:15 +01:00
4bef5f3df7 Cleanup: move some undo related files to C++
For continued testing in D14139. Also see T103343.
2023-01-23 00:33:55 +01:00
e2006f15a9 Fix T103618: GN Transform modifies source VDB grid
The call to BKE_volume_grid_openvdb_for_write() was accidentally removed
in D15806. This adds it to BKE_volume_grid_transform_matrix_set() to
avoid that it happens again when that function is used.

Differential Revision: D16949
2023-01-22 23:32:19 +01:00
3a2899cc31 Fix T103942 ASAN crash in math_boolean function.
The code in questions comes from Shewchuk's triangle code, which
hasn't been updated to fix the out-of-buffer access problem
that ASAN finds in the delaunay unit test. The problem is benign:
the code would exit the loop before using the value fetched from
beyond the end of the buffer, but to make ASAN happy, I put in
a couple extra tests to not fetch values that aren't going to be used.
2023-01-22 12:48:45 -05:00
b544199c56 Fix T102532: bevel spikes with loop slide.
There's a compromise of a code parameter called BEVEL_GOOD_ANGLE,
and bugs T44961, T86768, T95335, and this one, are all about problems
with various values of that parameter. If an angle of an adjacent
non-beveled edge is too close to that of the beveled edge, then you
get spikes. The BEVEL_GOOD_ANGLE says that if you are within that
angle difference, then no bevel happens. If the value is too small
then one gets spikes for certain models people build; if the value
is too large, then other people are annoyed that no bevel happens.
Hopefully this compromise in this commit is the final one I will do
before switching to Bevel v2, where none of this should be an issue.
2023-01-22 10:34:28 -05:00
537db96fb7 GHOST/NDOF: don't send button events when there is no active window
NDOF events without an active window were ignored and printed
warnings in the console.
2023-01-22 21:06:10 +11:00
00ac2ddca2 Fix T103722: Stuck modifiers for wheel events over unfocused windows
Regression in [0] caused mouse wheel events over windows without focus
to use the modifier state at the point the window was de-activated.

Now un-focused windows have all events release, when focused again
modifier press events are set again.

[0]: 8bc76bf4b9
2023-01-22 20:50:09 +11:00
4fcbfcfc96 Cleanup: GCC compiler warning 2023-01-22 20:49:00 +11:00
c2a28f9f6c Cleanup: quiet compiler warnings 2023-01-22 02:03:44 +01:00
96dfa68e5f Cleanup: extract function that slices parameters for multi-function call 2023-01-22 00:13:47 +01:00
3f1886d0b7 Functions: align chunk sizes in multi-function evaluation
This can improve performance in some circumstances when there are
vectorized and/or unrolled loops. I especially noticed that this helps
a lot while working on D16970 (got a 10-20% speedup there by avoiding
running into the non-vectorized fallback loop too often).
2023-01-22 00:03:25 +01:00
8d98d5c402 Cleanup: fix compiling in debug mode 2023-01-21 23:56:11 +01:00
f2bb044fdb Cleanup: Move six mesh-related files to C++
For continued refactoring of the Mesh data structure. See T103343.
2023-01-21 15:44:58 -06:00
3d6fd2906b Cleanup: Move versioning_290.c to C++
Ref T103343
2023-01-21 15:30:38 -06:00
50387964b6 Curves: Add initial transform support
This adds basic support for the transform operators for curves.

Differential Revision: https://developer.blender.org/D17063
2023-01-21 20:38:36 +01:00
0b17d171d7 Cleanup: Move three modifier related files to C++
For continued refactoring of the Mesh data structure. See T103343.
2023-01-21 12:15:41 -06:00
cbd15d387f GHOST/Wayland: don't send activate/deactivate on pointer enter/leave
This isn't correct as window activation is handled separately
from the cursor entering/leaving a window.

This would call de-activate when the cursor moved outside the window
even though the window remained focused.

Rely on focus changes which already handle activate/deactivate events.
2023-01-21 23:09:22 +11:00
65f68ee023 Cleanup: compiler warnings 2023-01-21 23:09:20 +11:00
6aa29549e8 Fix T103887: Line Art Vertex Weight Transfer to target group broken
Caused by {rB841df831e89d} and {rB3558bb8eae75}.

These commits moved flags from `eLineArtGPencilModifierFlags` to
`eLineartMainFlags`, but later on in code, these were still evaluated
from the modifiers `flags` (instead of `calculation_flags`).
This resulted in a false condition (`match_output` was assumed true but
it wasnt), leading to a wrong codepath taken.

This is now corrected (`calculation_flags` need to be passed around for
this as well).

Maniphest Tasks: T103887

Differential Revision: https://developer.blender.org/D17062
2023-01-21 08:27:44 +01:00
b5bb38400f Python API: Set defaults for Denoise Node
Fixes T103898
2023-01-20 21:42:24 -05:00
25864d3dfc Cleanup: Use ampersand instead of "and" for labels
UI guideline is use '&' for labels, use "and" for descriptions.
2023-01-20 20:27:25 -05:00
Leon Schittek
68625431d5 Geometry Nodes: Adjust modifier UI to put field toggles on the right
This also fixes the layout of boolean properties with the field toggle
visible. This was discussed in the most recent geometry nodes submodule
meeting.
2023-01-20 17:41:34 -06:00
2ea47e0def Geometry Nodes: Use checkbox for exposed boolean sockets
This uses the changes from ef68a37e5d to create IDProperties
for exposed boolean sockets with a boolean type instead of an integer
with a [0,1] range. Existing properties and values are converted
automatically.

For forward compatibility, the properties are switched to the integer
type for saving. Otherwise older versions crash immediately when opening
a newer file. The "Use Attribute" IDProperties aren't changed here,
since that wouldn't have a visible benefit.

Differential Revision: https://developer.blender.org/D12816
2023-01-20 17:36:47 -06:00
6a22230db4 Fix : accidentally committed typo, roo many closing brackets.
Ooops
2023-01-21 00:22:25 +01:00
a82c12ae32 Add collection properties to MeshUVLoopLayer to access UV and the associated bool attributes (Python API).
This adds 4 collection properties to MeshUVLoopLayer to eventually replace the (MeshUVLoop) .data property.
The added properties are:

.uv
.vertex_selection
.edge_selection
.pin

The direct access to the separate arrays is much more efficient than the access via MeshUVLoop.

Differential Revision: https://developer.blender.org/D16998
2023-01-21 00:03:42 +01:00
453724894e Fix T103704: Particle hair doesn't fall back to active UV
Caused by 05952aa94d, which removed the use of the
active tessface UV pointer on meshes but didn't replace it properly with
the equivalend custom data API function.
2023-01-20 15:34:24 -06:00
244c87dd68 Geometry Nodes: avoid geometry copy if nothing is selected in Set Position node
This improves performance in cases where the Set Position node is "turned off"
by passing `false` into the selection input.

It's possible that the node still takes some time in this case currently, because
it is destructing the input fields which may reference geometries that need
to be destructed as well. We could potentially change this node (and others)
so that the field inputs are only requested when the selection is not a
constant `false`.
2023-01-20 21:27:57 +01:00
37dfce550f Fix Cycles CUDA compiler warning with if constexpr
This is a C++17 feature, compiler should be able to figure this out
without the hint.
2023-01-20 20:31:40 +01:00
60ea01aa30 Cleanup: Move four sculpt/paint files to C++
For continued refactoring of the Mesh data structure. See T103343.
2023-01-20 11:55:43 -06:00
f31f7e3ef0 Cleanup: Remove unused light_sample_is_light() function.
This also fixes compile warnings on MSVC.
2023-01-20 17:36:48 +01:00
70ca15670d Curves: Edit mode selection operators
This adds the following operators to edit mode:
 - `select_all`
 - `select_random`
 - `select_end`

Differential Revision: https://developer.blender.org/D17047
2023-01-20 16:40:51 +01:00
d650162ecd Curves: Add initial undo system
This adds an `UndoType` for the `Curves` object, for edit mode.
For now, this will only store the `CurvesGeometry` at every step.
Other properties such as the `selection_domain` or the `surface` object
will have to be dealt with in subsequent commits.

Differential Revision: https://developer.blender.org/D16979
2023-01-20 16:32:36 +01:00
c07fdad03d Cleanup: Move multires files to C++
For continued refactoring of the Mesh data structure. See T103343.
2023-01-20 09:20:56 -06:00
c8a10c43b1 Geometry Nodes: show number of curve points in socket inspection tooltip
This was not done originally, because one had to iterate over all curves
to get the number of points which had some overhead. Now the number
of points is stored all the time anyway.
2023-01-20 14:44:37 +01:00
c006ba83e0 Fix: execution graph for geometry nodes contained cycles leading to crash
The `fix_link_cycles` function added in rB2ffd08e95249df2a068dd did not
handle the case correctly when there are multiple cycles going through
the same socket.
2023-01-20 14:38:09 +01:00
d79abb5d4f Fix: missing clamping in single mode in Sample Index node 2023-01-20 14:33:06 +01:00
b6278c5a96 Fix: crash when subdividing curves
This was an error in rB38a45e46bc910c68ae3.
2023-01-20 14:15:22 +01:00
31a505d1a5 Functions: add debug utility for lazy function graphs
This makes it easier to print information about a socket. Just the
socket name is sometimes not enough information to know where
it is in the graph.
2023-01-20 13:39:29 +01:00
453e47eb42 Cleanup: suppress clang-tidy warning 2023-01-20 22:32:31 +11:00
5218391701 Fix assertion in UV path select
Existing path selection & new path picking included without UV's.
Now limit objects to those with UV's.

Also remove use of CTX_wm_view3d(C) in the UV editor it would be NULL,
but it doesn't makes sense to use the 3D viewport for UV operations
even if it was available.
2023-01-20 22:31:27 +11:00
127eb2e328 Fix: wrong identifier int for interpolate curves node
This does not break existing files, because the idname is the ground truth.
2023-01-20 12:16:49 +01:00
85908e9edf Geometry Nodes: new Interpolate Curves node
This adds a new `Interpolate Curves` node. It allows generating new curves
between a set of existing guide curves. This is essential for procedural hair.

Usage:
- One has to provide a set of guide curves and a set of root positions for
  the generated curves. New curves are created starting from these root
  positions. The N closest guide curves are used for the interpolation.
- An additional up vector can be provided for every guide curve and
  root position. This is typically a surface normal or nothing. This allows
  generating child curves that are properly oriented based on the
  surface orientation.
- Sometimes a point should only be interpolated using a subset of the
  guides. This can be achieved using the `Guide Group ID` and
  `Point Group ID` inputs. The curve generated at a specific point will
  only take the guides with the same id into account. This allows e.g.
  for hair parting.
- The `Max Neighbors` input limits how many guide curves are taken
  into account for every interpolated curve.

Differential Revision: https://developer.blender.org/D16642
2023-01-20 12:09:38 +01:00
d072764809 Add RNA path functions to AssetMetaData and AssetTag structures. 2023-01-20 11:56:42 +01:00
244522d6cb 3D Texturing: Remove actual invocation of print_debug.
Was a mistake as only the function should have landed in master.
2023-01-20 11:15:37 +01:00
884e14ac93 3D Texturing: Adding print_debug for visually inspecting the generated geometry.
During 3D texturing the uv islands are extended in order to fix seam bleeding
for manifold parts of the input mesh. This patch adds a `print_debug` method
on UVIsland that generates a python script. This script can be copy-past
into the Python Console to show the generated geometry.

This script can be extended to show the extracted border and use face colors
for showing internal decisions.
2023-01-20 10:28:58 +01:00
721bd5e6cf Fix invalid swapBuffer calls & outdated window decorations on Wayland
Swap-buffers was being deferred (to prevent it being called
from the event handling thread) however when it was called the
OpenGL context might not be active (especially with multiple windows).

Moving the cursor between windows made eglSwapBuffers report:
EGL Error (0x300D): EGL_BAD_SURFACE.

Resolve this by removing swapBuffer calls and instead add a
GHOST_kEventWindowUpdateDecor event intended for redrawing
client-side-decoration.

Besides the warning, this results an error with LIBDECOR window frames
not redrawing when a window became inactive.
2023-01-20 18:05:52 +11:00
bbc35fef25 Cleanup: Remove remaining subdiv/subsurf files to C++
For continued refactoring of the Mesh data structure. See T103343.
2023-01-19 22:25:04 -06:00
1e8cc72f85 Cleanup: corrections, clarification to do comments 2023-01-20 15:20:02 +11:00
844cca9984 Cleanup: spelling in comments 2023-01-20 15:19:32 +11:00
06c836c911 WM: rename safe areas preset add operator
The name SAFE_AREAS_OT_preset_add lead to "Safe Areas" having it's own
section in the operator API docs. Name CAMERA_OT_safe_areas_preset_add
instead. Keep "safe_areas" as the preset directory for users with
existing presets.
2023-01-20 14:47:15 +11:00
6672b5373f Fix T103971: uv packing wasn't ignoring uv islands on hidden faces
Fixes the packing operators that use ED_uvedit_pack_islands_multi

Also fixes UV Select Similar with hidden UV islands.

Packing operators using GEO_uv_parametrizer should remain unchanged.

Add a check to BM_elem_flag_test(efa, BM_ELEM_HIDDEN).
Note that BM_mesh_calc_face_groups doesn't easily support XOR of flags,
requiring logic to be moved to a preprocess step on BM_ELEM_TAG.

Regression in rBe3075f3cf7ce.

Differential Revision: https://developer.blender.org/D17055
2023-01-20 16:29:33 +13:00
92734d868b PyDoc: resolve bpy.types & bpy.ops expanding sub-modules inline
The bpy.types page was unreasonably long (over 17k lines).
Resolve by setting the `maxdepth` for this and the `bpy.ops` page too.

This problem showed up in v3.4 release and may be caused by changes
to Sphinx's default behavior as there doesn't seem to be any change
that would cause this in the generated docs.
2023-01-20 14:04:34 +11:00
b73814c65c Cleanup: use function style casts for C++ 2023-01-20 14:04:34 +11:00
d0010d48c7 Cleanup: add ED_uvedit_get_aspect_y utility function
This avoids having to perform the aspect division inline.
2023-01-20 14:04:34 +11:00
a0706d6cf0 Fix T102680: UV Pick shortest Path wrong for multi-object editing
Path selection support from [0] didn't account for multiple objects in
edit-mode. Now picking the UV also picks the object to operate on.

[0]: ea5fe7abc1
2023-01-20 14:04:34 +11:00
ebb519652c Object: add functionality to access the object as an index for operators
Add:
- ED_object_in_mode_to_index
- ED_object_in_mode_from_index

Useful for operators that act on a non-active object in multi-edit mode,
so the index can be stored for the operators exec function to read back
the value when redoing an action. Needed to resolve T102680.
2023-01-20 14:04:34 +11:00
1184501d5c Sculpt: Fix T103948: Automasking stroke id not being updated 2023-01-19 18:32:40 -08:00
fcb0425f64 Sculpt: Remove old connected component API in favor of new island API 2023-01-19 18:22:59 -08:00
da21e035d3 Sculpt: Fix T103923: Expand face sets now taking visibility into account
The code was never ported from the old system of encoding visibility
as negative face set values.
2023-01-19 18:04:34 -08:00
4fa6ce0973 Sculpt: Expand NORMALS and TOPOLOGY_DIAGNAL falloff now check islands
Prevents disconnect parts of the mesh from having their masks
filled.
2023-01-19 17:55:25 -08:00
0e35d5c095 Sculpt: Expand now waits for click before invoking when called from menu 2023-01-19 17:49:53 -08:00
8a6c6a5dc5 Cleanup: Remove unused functions in sculpt automasking code 2023-01-19 17:30:17 -08:00
8b5c2d9ef1 Sculpt: Restrict expand to active mesh islands for geodesic and topology
Fixes bug where other islands sometimes get their masks cleared (or
filled) in strange circumstances.  Still need to figure out the
correct behavior for spherical falloff.
2023-01-19 17:27:40 -08:00
9889918fd4 Sculpt: New API for keeping track of topology islands
Mesh islands (shells) are now calculated on an as-needed
basis and cached inside of a temp attribute,
`sculpt_topology_island_key`.  This attribute is updated
as needed when geometry changes (e.g. the trim brush)
or when mesh visibility changes.

This replaces the old behavior where the "topology" automasking
mode would walk the entire mesh on every stroke.
2023-01-19 16:58:30 -08:00
05bdef7ce6 Fix T103094: Cycles ignores small suns in Nishita sky
The background evaluation samples the sky discretely, so if the sun is
too small, it can be missed in the evaluation. To solve this, the sun is
ignored during the background evaluation and its contribution is
computed separately.
2023-01-19 18:31:54 -06:00
241d87e9f4 Curves: Add RNA access to evaluated normals per control point
Add an RNA API function that gives an array of the normals for every control point.
The normals depend on the `normal_mode` attribute, which can currently be
minumum twist or Z-up, though more options are planned. Normals are currently
evaluated on the evaluated points and then sampled back to the control points.
Because that can be expensive, a normal mode that only does a first evaluation
on control points may be important

The function is intended to be used by Cycles, so it doesn't have to implement
the calculation of normals itself. They can be interpolated between control points
and normalized.

For best performance, the function should only be called once, since it does the
full calculation for every control point every time it is called.

Differential Revision: https://developer.blender.org/D17024
2023-01-19 17:43:55 -06:00
203ab983ce Geometry Nodes: Rename node and socket for "Group ID" convention
Based on discussion about T102962, rename the "Face Set Boundaries" node
to "Face Group Boundaries" and the Accumulate Field node's "Group Index"
socket to "Group ID". This convention of "__ Group" and "Group ID" will
be used more in other nodes in the future.

This commit doesn't affect forwards or backwards compatibility.
2023-01-19 16:56:06 -06:00
bbeb37696d Cleanup: format 2023-01-20 11:43:28 +13:00
79053a6ff7 Cleanup: Move several modifiers files to C++
For continued refactoring of the Mesh data structure. See T103343.
2023-01-19 15:54:47 -06:00
2ab72f6db8 Fix T103964: Assert on mouse hover of empty node editor
The reverse iteration added in e091291b5b didn't handle
the case where there are no nodes properly. Thanks to Iliya Katueshenock
for investigating this.
2023-01-19 15:50:07 -06:00
fe552bf236 Cleanup: make format 2023-01-19 22:48:05 +01:00
670b3c5013 Cleanup: compiler warnings 2023-01-19 22:48:05 +01:00
190d66b51e Cleanup: Remove unused attribute API function
While we do need higher level utilities for copying attributes
between geometries, this currently isn't used and it's not clear
that it will be the right abstraction in the end.
2023-01-19 15:37:36 -06:00
baf69b064b Geometry Nodes: Avoid creating cyclic attribute when redundant
The default when there is no cyclic attribute is that none of the curves
are cyclic. In the mesh to curve node, avoid creating the attribute with
just false to save time and memory usage. Also avoid looking up the
attribute twice in the trim node.
2023-01-19 15:35:58 -06:00
7db00d4ef7 Cleanup: Rename curves utility function
"Fill" usually refers to setting a single value. This copies the
sizes from curves offsets to a separate array.
2023-01-19 15:31:26 -06:00
8d63293c46 Curves: Avoid building evaluated point offsets for poly curves
When all the curves are poly curves, skip the work of building a
separate array of offsets for the evaluated points (which are the
same as the control points). This saves 1-4ms on every reevaluation
in test files with many curves.
2023-01-19 15:22:54 -06:00
9233b609eb Cleanup: Use utility function for copying curve domain data
Standardizing the process of creating a new CurvesGeometry with
different curve sizes based on an existing curves is helpful, since
there are a few methods to simplify the process that aren't obvious
at first, like filling the offsets with sizes directly and accumulating
them to become sizes.

Also, in the trim curves node, avoid creating the curve types attribute
all the time. Use the special API functions for the types which do
some optimizations automatically. Also use a more consistent
method to copy the curve domain data, and correct some comments.
2023-01-19 15:08:58 -06:00
dfd63bf1e4 Curves: Avoid reallocations when evaluating NURBS curves
I didn't detect a noticeable performance difference in a basic test,
but this is better in principle anyway.
2023-01-19 14:29:14 -06:00
e12498e44e Cleanup: Avoid reallocations when evaluating curve in trim node
Use the same method as the resample node to use a single vector for
each thread. This avoids an allocation for each attribute of each curve.
2023-01-19 14:16:31 -06:00
4cfa4f7551 Geometry Nodes: Parallelize flip faces node
I observed a 2x performance improvement for a large mesh.
2023-01-19 14:14:12 -06:00
76673e5fcf Cleanup: Use OffsetIndices abstraction in duplicate elements node 2023-01-19 13:48:54 -06:00
38a45e46bc Cleanup: Use OffsetIndices class in more cases
The same logic from D17025 is used in other places in the curve code.
This patch uses the class for the evaluated point offsets and the Bezier
control point offsets. This helps to standardize the behavior and make
it easier to read.

Previously the Bezier control point offsets used a slightly different standard
where the first point was the first offset, just so they could have the same
size as the number of points. However two nodes used a helper function
to use the same `OffsetIndices` system, so switch to that there too.
That requires removing the subtraction by one to find the actual offset.

Also add const when accessing data arrays from curves, for consistency.

Differential Revision: https://developer.blender.org/D17038
2023-01-19 13:48:20 -06:00
d3ea931647 Fix: Compile error from designated initializers in C++ 2023-01-19 13:37:49 -06:00
f71bfe4655 Fix anisotropic Beckmann regression test failing on Metal
The lookup table method on CPU and the numerical root finding method on
GPU give quite different results. This commit deletes the Beckmann lookup
table and uses numerical root finding on all devices. For the numerical
root finding, a combined bisection-Newton method with precision control
is used.

Differential Revision: https://developer.blender.org/D17050
2023-01-19 20:12:05 +01:00
Nate Rupsis
fa67b84c34 NLA: Udating Blend-in and Blend-out values to clamp on NLA strip Transform
Previously, transforming a clip (scaling, repeat, etc) wouldn't re-calculate the blend-in and blend-out values, leading to over / undershoot, and a visual clip artifact

Old:

{F14045003}

This patch adds re-calculation logic (new `BKE_nlastrip_recalculate_blend()`  method) to the blend-in/out on transformations to clamp values, and avoid over/under shoot.

The `BKE_nlastrip_recalculate_blend()`  encapsulates the existing logic for both the `rna_NlaStrip_blend_in_set()` and `rna_NlaStrip_blend_out_set()` methods into a single BKE method that we an execute as needed. The fact that blend-in is first decreased, is strictly on the order of calculation. My suspicion is that //if// the blend-in / blend-our values were working as intended, the RNA set methods would update in order, and we'd experience the same thing. In short, the choice here was to linearly combine the logic, without making any assumptions of my own.

while talking things over with @sybren  and @RiggingDojo, they are fine with how this currently works, but there a desire to update how the two values interact with each (ratio scale, etc) in the future.

New:
{F14045024}

{F14045025}

Reviewed By: sybren

Maniphest Tasks: T101369

Differential Revision: https://developer.blender.org/D16720
2023-01-19 13:47:16 -05:00
9066f2e043 Cycles: Add support for OSL texture intrinsic on the GPU
This makes it possible to use `texture` and `texture3d` in custom
OSL shaders with a constant image file name as argument on the
GPU, where previously texturing was only possible through Cycles
nodes.
For constant file name arguments, OSL calls
`OSL::RendererServices::get_texture_handle()` with the file name
string to convert it into an opaque handle for use on the GPU.
That is now used to load the respective image file using the Cycles
image manager and generate a SVM handle that can be used on
the GPU. Some care is necessary as the renderer services class is
shared across multiple Cycles instances, whereas the Cycles image
manager is local to each.

Maniphest Tasks: T101222

Differential Revision: https://developer.blender.org/D17032
2023-01-19 19:14:48 +01:00
Michael Jones
e270a198a5 Cycles: Markup to disable specialisation of kernel data fields (Metal)
This patch adds markup to specify that certain kernel data constants should not be specialised. Currently it is used for `tabulated_sobol_sequence_size` and `sobol_index_mask` which change frequently based on the aa sample count, trash the shader cache, and have little bearing on performance.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16968
2023-01-19 17:57:42 +00:00
Michael Jones
08b3426df9 Cycles: Occupancy tuning for new higher end M2 machines
This patch adds occupancy tuning for the newly announced high-end M2 machines, giving 10-15% render speedup over a pre-tuned build.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D17037
2023-01-19 17:56:40 +00:00
e7af2503c5 Cleanup: Fix unused variable warning in merge by distance 2023-01-19 11:53:32 -06:00
2a41e0822a Fix T103911: Custom property edit gets wrong existing default
The array length was wrong for all types after 0e89d24318, and
a typo meant that the boolean defaults were assigned to the int defaults.
2023-01-19 11:15:19 -06:00
12a3de96bb Fix T103972: crash with cloth simulation rest shape key and subdivision surface 2023-01-19 17:33:12 +01:00
Germano Cavalcante
25ce705617 Merge by Distance: split code into more specialized functions
Split the algorithms that find duplicates.

This improves readability and helps us find areas for optimization.

It may also facilitate the implementation of generic utilities.

No functional changes.

Differential Revision: https://developer.blender.org/D16918
2023-01-19 13:29:19 -03:00
90c6674f28 Fix T102615: crash on USD export for scenes with point clouds or hair
Code authored by Michael B Johnson (drwave).

Reviewed by Sybren and makowalski.

This patch addresses a crash that occurs when exporting a
scene to a USD file, when that scene includes a point cloud
object or hair.

Added OB_POINTCLOUD and OB_CURVES enums and a default case
statement in the switch statement in
USDHierarchyIterator::create_data_writer, to avoid dereferencing
a NULL pointer.

Differential Revision: https://developer.blender.org/D16776
2023-01-19 10:57:22 -05:00
9b7c2cca3d Refactor: replace bool beckmann with enum MicrofacetType for readability
Differential Revision: https://developer.blender.org/D17044
2023-01-19 15:55:07 +01:00
Jeroen Bakker
7f81d18ffe Metal: Fix crash when using batch_for_shader.
`batch_for_shader` is an utility function that creates the correct
vertex buffer based on the given shader. In the shader interface
the `attr_types_` contains the GPUType for each location in the
vertex buffer.

When using Metal, the `attr_types_` was never updated, resulting
in using incorrect or non-existing data types. This patch fixes
this by updating the `attr_types_` when building the shader
interface.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D17042
2023-01-19 15:11:06 +01:00
203bacbe4a Fix T103809: Using Preview Range Breaks Normalized FCurve Display
When using the "normalized" display of FCurves in the
Graph Editor, and also turning on the preview range,
the normalized display would break.

The preview frame range was assumed to be bezt indices,
which is only true when every frame has a key.

Reviewed by: Colin Basnett
Differential Revision: https://developer.blender.org/D16987
Ref: D16987
2023-01-19 14:38:49 +01:00
320757bc61 Refactor microfacet BSDF to reduce repetition 2023-01-19 12:07:53 +01:00
a3c38667f0 Fix T103881: Unlink operation crash in Blender File view
Similar to rBe97443478e32 and rBe772087ed664, exit early when
texture, collection and world ID has no parent to unlink from.

Reviewed by: Severin, lichtwerk

Differential Revision: https://developer.blender.org/D17017
2023-01-19 16:04:15 +05:30
eb657633ed Fix anisotropic Beckmann using isotropic sampling 2023-01-19 11:22:16 +01:00
2907227db2 Fix T103880: Crash with Line Art Grease-Pencil modifier
The line art modifier added a wmNotifier in it's
GpencilModifierTypeInfo.generateStrokes callback which isn't thread-safe
when called from the depsgraph. This was from the original inclusion
of the feature [0] however a more recent optimization to notifier
lookups [1] made the crash occur more frequently.

Remove the notifier as modifiers should not be adding WM level events
and it works without it.

[0]: 3e87d8a431
[1]: 0aaff9a07d
2023-01-19 20:41:45 +11:00
71b5799852 Code-style: Remove double semicolons at end of statement. 2023-01-19 09:46:45 +01:00
93d84e87b2 Fix T103400: Transfer Mesh Data Layout broken for color attributes
This was the case when using the operator outside of the modifiers panel.

Caused by {rBeae36be372a6}.

In above commit, `DT_layer_items` shared both `DT_TYPE_MPROPCOL_LOOP` |
`DT_TYPE_MLOOPCOL_LOOP` in a single EnumPropertyItem value "Colors".
This is a bit unusual, but probably allowed.
As a consequence, checks for specific datatypes would fail when selecting
such EnumPropertyItem:
- `DT_DATATYPE_IS_MULTILAYERS` (uses `ELEM` to check distinct entries --
would return false)
- `BKE_object_data_transfer_dttype_to_srcdst_index` (would return
`DT_MULTILAYER_INDEX_INVALID`)

These places have now been corrected to take these "special" values into
account.

Another issue was that multiple EnumPropertyItems with the same value
could be created in dt_add_vcol_layers() if attributes of the same
domain, but different color types are in play (could lead to crashes)
and that has also been corrected.

Also: above commit did not give the choice of transfering color
attributes from the vertex domain (only face corner attributes could be
chosen), this has now been added. DT_layer_vert_items (used from the
modifier) already had this included so this was only an issue when using
the operator outside of the modifiers panel.

Since we now feature two domains, the single "VCOL" in the enum has been
split into "COLOR_VERTEX" and "COLOR_CORNER". This will break existing
scripts calling bpy.ops.object.datalayout_transfer and will be marked as
a breaking change in the release notes.

NOTE: there is another bug here when attributes of the same domain, but
different color types are in play and you want to transfer just a single
specific layer (but that is for a separate commit)

Maniphest Tasks: T103400

Differential Revision: https://developer.blender.org/D16935
2023-01-19 09:24:52 +01:00
3f627c38a2 Fix test cases by reducing the severity of the bgl error message to warning. 2023-01-19 08:25:28 +01:00
41b33f8968 Fix spelling mistake in previous commit. 2023-01-19 08:23:05 +01:00
Jeroen Bakker
cac6b6f388 BGL_Wrap: disable calls on non-opengl backends.
Goal of this patch is to stop the invocation of OpenGL calls via the bgl module
on a none OpenGL GPU backend, report this as a python deprecation warning
and report this to the user.

## Deprecation warning to developers

```
>>> import bgl
>>> bgl.glUseProgram(0)
<blender_console>:1: DeprecationWarning: 'bgl.glUseProgram' is deprecated and will be removed in Blender 3.7. Report or update your script to use 'gpu' module.
```

## Deprecation message to users

The message to the user is shown as part of the Info Space and as a message box.
{F14159203 width=100%}
{F14158674 width=100%}

During implementation we tried several ideas:

# Use python warning as errors: This isn't fine grained enough and can show incorrect information to the user.
# Throw deprecation as error and use sys.excepthook to report the user message.
   This required a custom exception class to identify the bgl deprecation and a CPython handler function to
   be set during python initialization. Although this is the most flexible there was a disconnect between the
   exception class, exception function and the excepthook registration.
# A variant how we handle autoexec failures. A flag is stored in Global and when set the user message is reported.
   Not that flexible, but code is more connected to the boolean stored in the Global struct.

Although using Global struct isn't nice I chose this solution due to its traceability. It is clear to developers
reading the code how the mechanism works by using search all functionality of your IDE.

Reviewed By: MichaelPW, campbellbarton

Maniphest Tasks: T103863

Differential Revision: https://developer.blender.org/D16996
2023-01-19 08:18:37 +01:00
66595e29e2 Cleanup: remove/comment unused code, simplify casts
Remove simple counters where they aren't used, comment in some cases.
Also add missing include.
2023-01-19 17:10:42 +11:00
bc502f3b19 CMake: add WITH_LIBS_PRECOMPILED option (UNIX only)
This makes it convenient to build blender without referencing
pre-compiled libraries which don't always work on newer Linux systems.

Previously I had to rename ../lib while creating the CMakeCache.txt
to ensure my systems libraries would be used.

This change ensures LIBDIR is undefined when WITH_LIBS_PRECOMPILED is
disabled, so any accidental use warns with CMake's `--warn-unused-vars`
argument is given.
2023-01-19 17:10:42 +11:00
66dee44088 CMake: quiet references to undeclared variable warnings
These warnings can reveal errors in logic, so quiet them by checking
if the features are enabled before using variables or by assigning
empty strings in some cases.

- Check CMAKE_THREAD_LIBS_INIT is set before use as CMake docs
  note that this may be left unset if it's not needed.
- Remove BOOST/OPENVDB/VULKAN references when disable.
- Define INC_SYS even when empty.
- Remove PNG_INC from freetype (not defined anywhere).
2023-01-19 17:10:42 +11:00
8b7d2d8eb2 CMake: use BULLET_LIBRARIES for both extern_bullet and system libraries
There was no need to differentiate between these and it made
the CMake files more verbose.
2023-01-19 17:10:42 +11:00
978a7459f1 CMake: support multi-line strings for the help_features target 2023-01-19 17:10:42 +11:00
c2120b8c4f CMake: suppress missing-variable-declarations warnings with Clang
Code generated by wayland-scanner contained missing declarations.
2023-01-19 17:10:42 +11:00
9676dce317 Cleanup: CMake indentation 2023-01-19 17:10:42 +11:00
163d4aa094 Fix T103707: Use beauty fill for the UV select overlap operator
The original code used `BLI_polyfill_calc` which can create degenerate
triangles during triangulation per T103913. This causes the subsequent
overlap test to produce incorrect results in certain cases. Change to
using a "beauty" fill instead.

Differential Revision: https://developer.blender.org/D17015
2023-01-18 21:25:55 -08:00
83f9218801 Cleanup: Remove unused/redundant includes from curves/pointcloud draw 2023-01-18 18:14:44 -06:00
6c4e3a9e51 Curves: Deduplicate and parallelize point to curve map creation
There is a utility method on `CurvesGeometry` to build a map of the
curve for each point. Use that in two more places and make sure its
implementation is multithreaded, which gives a slight speedup
in a simple test file.
2023-01-18 16:41:10 -06:00
d3aaa7d523 Fix: Build issue with VS2019
fix by @JacquesLucke I just sprinkled it to all places
it needed to be.
2023-01-18 12:41:09 -07:00
e4e91bf830 Fix crash when listing assets repeatedly in node search menus
When doing partial reloads of asset libraries (only reload assets from
the current file, e.g. after undo re-allocated ID pointers), we'd end up
with assets that don't have their asset data read correctly. It would
execute a branch that didn't set the asset library object necessary to
create and store asset representations.

Steps to reproduce were:
* Open .blend file with geometry node assets in there
* In a geometry node editor, press Shift+A to open the add menu
* Cancel
* Move a node
* Undo
* Press Shift+A again
2023-01-18 18:27:25 +01:00
8707cab70b Gitea: don't reference branch in issues by default 2023-01-18 16:58:09 +01:00
9ccec5715e Gitea: layout and wording tweaks to issue and pull request templates 2023-01-18 16:43:55 +01:00
e8d1d1486e Fix T103960: build issue with GCC 13 in Cycles thread code 2023-01-18 16:43:47 +01:00
6f206f713e BLI: Math: Fix matrix tests failling
Regression introduced in rB17768b3df19a
2023-01-18 15:36:46 +01:00
c412d2dcfe DRW: View: Allow disabling view test by setting bound sphere radius to -1 2023-01-18 15:36:46 +01:00
534214e65c DRW: Make intersect lib not dependent on common_view_lib.glsl
This declares view intersection functions only if the view lib if
required.
2023-01-18 15:36:46 +01:00
9e5ada315f DRW: Protect common_math_lib.glsl from duplicated declaration
This avoid most issues when including this header along with some of the
newer `gpu_shader_math_*_lib.glsl`.
2023-01-18 15:36:46 +01:00
df74a9b624 DRW: Tests: Add test for PassSimple::Sub 2023-01-18 15:36:46 +01:00
e6be3f96d8 DRW: Fix DRW_VIEW_FROM_RESOURCE_ID 2023-01-18 15:36:46 +01:00
9c54f2655d DRW: Add double buffering of objects matrices, bounds, and infos
This allows easy delta calculation and access to last known position of
deleted objects.
2023-01-18 15:36:46 +01:00
efe51f0220 DRW: View: Allow for GPU side specification of view bounds
This allows an engine to perform GPU side view specification and let the
draw manager extract the culling informations (bounds).

To this end, the matrices ubo gets exposed to be able to write to it.

`compute_procedural_bounds()` need to be explicitely called before any
main pass using the culling result.
2023-01-18 15:36:46 +01:00
493e3230b4 DRW: Fix display print
Wrong uniform for viewport size.
2023-01-18 15:36:46 +01:00
21b3689fb9 DRW: GPU Wrappers: Add swap to storage buffers, empty framebuffer and fixes
Also add an assert to mip_view to avoid incorrect usage.
2023-01-18 15:36:46 +01:00
cf50a3eabc Cleanup: remove is_same method for virtual arrays
This abstraction is rarely used. It could be replaced by some more
general "query" API in the future. For now it's easier to just compare
pointers in the Set Position node where this was used.

This is possible now, because mesh positions are stored as flat `float3`
arrays (previously, they were stored as `MVert` with some other data
interleaved).
2023-01-18 13:24:19 +01:00
6e6ae17335 Fix reversed cosNI and cosNO in Cycles anisotropic beckmann G1 2023-01-18 13:10:45 +01:00
973db6b5c1 Gitea: make bug report template more compact
And split text before and after description field to reduce long distance
between title and description.
2023-01-18 12:50:13 +01:00
2c2178549b Curves: add OffsetIndices abstraction
This changes how we access the points that correspond to each curve in a `CurvesGeometry`.
Previously, `CurvesGeometry::points_for_curve(int curve_index) -> IndexRange`
was called for every curve in many loops. Now one has to call
`CurvesGeometry::points_by_curve() -> OffsetIndices` before the
loop and use the returned value inside the loop.

While this is a little bit more verbose in general, it has some benefits:
* Better standardization of how "offset indices" are used. The new data
  structure can be used independent of curves.
* Allows for better data oriented design. Generally, we want to retrieve
  all the arrays we need for a loop first and then do the processing.
  Accessing the old `CurvesGeometry::points_for_curve(...)` did not follow
  that design because it hid the underlying offset array.
* Makes it easier to pass the offsets to a function without having to
  pass the entire `CurvesGeometry`.
* Can improve performance in theory due to one less memory access
  because `this` does not have to be dereferenced every time.
  This likely doesn't have a noticable impact in practice.

Differential Revision: https://developer.blender.org/D17025
2023-01-18 11:52:37 +01:00
c1d360f7fb Fix urls in LTS script.
The urls were missing /release/, leading to 404 links on the LTS download page.
2023-01-18 10:39:50 +01:00
60d9de767d Cleanup: remove redundant forward declarations for structs 2023-01-18 18:41:13 +11:00
ca3e19f4c5 Fixes for 'make check_pep8' target
- Skip files in dirs starting with '.' (`.git` was being searched).
- Update --disable list for pylint.
2023-01-18 18:27:49 +11:00
9e5e2aa775 Cleanup: rename Mesh/Curve/MetaBall loc/size/texflag
Struct members loc/size were misleading as they read as if the object
data stored object level transform channels. Rename these to match RNA
with a `texspace_*` prefix to make it clear these struct members only
apply to texture-space transform.

Also rename ME_AUTOSPACE & ME_AUTOSPACE_EVALUATED to
ME_TEXSPACE_FLAG_AUTO & ME_TEXSPACE_FLAG_AUTO_EVALUATED.
2023-01-18 17:20:10 +11:00
07af7e2266 Cleanup: remove unused MetaBalle.disp & rot 2023-01-18 17:17:31 +11:00
988bc3dddf Cleanup: keep dna_rename_defs sorted 2023-01-18 17:17:29 +11:00
1c470dbd72 Cleanup: replace BLI_findptr with BKE_collection_has_object
Also swap the order of checks in collection_object_add to perform
the comparison before calling collection_find_child_recursive.
2023-01-18 15:43:20 +11:00
b380d25053 Cleanup: define COLLECTION_FLAG_ALL_RUNTIME, use in file read/write 2023-01-18 14:18:58 +11:00
fd2bf32dc7 Cleanup: use memset instead of clearing individual runtime members 2023-01-18 14:10:29 +11:00
44dd3308a5 DNA: move Collection members into their own Runtime struct
Also add static assert that COLLECTION_COLOR_TOT has the correct number
of items in the enum.
2023-01-18 14:00:09 +11:00
9179362e7b Geometry Nodes: Prefer evaluate at index value input in search
Give the "Value" input a higher search weight than the "Index"
input, since it's more likely that users will want to connect to
that. Based on feedback from Simon Thommes.
2023-01-17 19:43:59 -06:00
Iliya Katueshenock
d45ad0acd3 Geometry Nodes: Show supported geometry types tooltip without computing
Socket declarations exist all the time and it would be useful to use
them for tooltips at all times, not just when there is a computed log.

Differential Revision: https://developer.blender.org/D16846
2023-01-17 19:43:59 -06:00
bdb34c9804 Gitea: add more complete pull request template 2023-01-18 01:40:25 +01:00
737e7a63b1 Fix: incorrect curve type counts after adding curves of same type 2023-01-18 00:05:54 +01:00
301119619c Curves: Remove attribute retrieval, deduplicate evaluation logic
Avoid calling `interpolate_to_evaluate` while evaluating normals,
which has to look up attributes by name for every curve. Also avoid
duplicating the curve type switch in a few functions. I didn't observe
a performance difference, but theoretically this could reduce
overhead for many small curves.
2023-01-17 14:58:54 -06:00
dcb37959d4 Fix roation snap failing with zero angle
Due to precision issues, the cosine value calculated with
`dot_v3v3(start, end)` can be outside the -1, 1 range causing `acosf`
to return `nan(ind)`.

Use `angle_signed_on_axis_v3v3_v3` instead. It returns more accurate
values, deduplicates code, and avoids these `nan` issues.
2023-01-17 17:21:39 -03:00
17768b3df1 BLI: Math: Fix perspective matrix function
The port missed this one component that should have been left to 0.0.
2023-01-17 21:02:57 +01:00
d42d4e339f Cleanup: Remove unnecessary includes in geometry set header 2023-01-17 12:50:06 -06:00
85ea74ad77 Cleanup: Remove unnecessary curves RNA verification disabling
There is no SDNA data for `position_data` anymore after
e9f82d3dc7.
2023-01-17 12:50:06 -06:00
df54561233 Cleanup: Fix incorrect comments in mesh extrude node 2023-01-17 12:50:06 -06:00
d76a0e98ba Fix: Avoid node reevaluations for selection and parenting
Since 90ea1b7643, node trees have been reevaluated
after many selection operations because nodes are sorted based on
the selection status and an update tag was added for that. However,
for years the node order was allowed to be different between the
original and evaluated copy of node trees.

Though it is a bit sketchy to have that difference in the evaluated
node tree, reevaluations for just selection are very bad, so use a
"smaller" update tag and add a comment for justification.

Differential Revision: https://developer.blender.org/D17023
2023-01-17 12:50:06 -06:00
665732115e Gitea: add separate issue templates for bug, design and todo 2023-01-17 19:44:21 +01:00
1d253b6652 Fix T103945: incorrect anonymous attribute references
The case where the same field group input is evaluated on
more than one geometry inputs was not handled correctly.
2023-01-17 18:40:28 +01:00
34326fec02 Fix: sample index node outputs default value
Error in rBb5105085139227a713f154446ff6a3255cb8be99.
2023-01-17 18:29:25 +01:00
543bf28fb1 Refactor: renamed I -> wi, omega_in -> wo in Cycles
wi is the viewing direction, and wo is the illumination direction. Under this notation, BSDF sampling always samples from wi and outputs wo, which is consistent with most of the papers and mitsuba. This order is reversed compared with PBRT, although PBRT also traces from the camera.
2023-01-17 18:07:13 +01:00
400f022989 Geometry Nodes: Add warning to set material node with no faces
The node can't do anything in this case, which isn't always obvious.

Resolves T103133
2023-01-17 10:31:07 -06:00
873794b196 Fix T103937: Applying modifier resets shape keys
The order of arguments to memcpy was reversed, which is sadly possible
because the constness `KeyBlock` of keyblock doesn't propagate to
pointers it contains.
2023-01-17 10:22:29 -06:00
d411de96f7 Fix T103936: Regression: Track To constraint broken
Caused by 6769acbbba.

Some of the matrix variants are rather obscure from the
semantic: they don't really fully initialize the output:
as in, they only write to an upper-left 3x3 block.

A quick solution to fix the very commonly used constraint.
It feels that it is possible to minimize about of copy
operations.
2023-01-17 17:10:41 +01:00
0e89d24318 Cleanup: Use elif in custom property edit operator, reduce whitespace 2023-01-17 09:51:43 -06:00
50105b2952 Fix T103911: Editing boolean custom property UI data resets value
The old value wasn't retrieved for boolean array properties.
2023-01-17 09:51:43 -06:00
f8b11528b2 USD export: ensure edit mode changes are exported
Code authored by Charles Wardlaw.

Reviewed by Bastien, Sybren and makowalski.

Differential Revision: https://developer.blender.org/D15916
2023-01-17 10:24:43 -05:00
7df5d7c7a7 Cleanup: Curves selection boolean to float comparison
The conversion from float to boolean is now handled by
the attribute API.
2023-01-17 09:15:33 -06:00
Kevin C. Burke
e144af1f7c GPencil: Provide Option for Fill in Material Popover
The Grease Pencil Material Popover currently has a color picker 
for the Stroke of a Material using Solid style, but not one for
 a Fill using Solid style. 

With the default Grease Pencil Materials, the current 
popover only shows the Stroke color for the grey "Solid Fill" 
material (which doesn't have its Stroke enabled) instead of 
the more useful Fill color.

This patch shows a Stroke color picker when the Material 
has Stroke enabled and the style is Solid. 
This is the same for the Fill.

Reviewed By: antoniov, mendio

Differential Revision: https://developer.blender.org/D17004
2023-01-17 15:44:38 +01:00
f8328ec172 Fix: Draw: Freeze Culling
Bind the frozen culling data as well.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D17010
2023-01-17 15:10:36 +01:00
8b660e1cbf Cleanup: use defaulted constructor 2023-01-17 13:43:38 +01:00
b510508513 Geometry Nodes: optimize Sample Index node with constant index
Previously, the node would always evaluate the input field on the
entire geometry domain. This is good when most indices will be
accessed afterwards. However, it is quite a bad when only a single
index is used. Now the field is only evaluated for that one index.
2023-01-17 13:29:55 +01:00
03fab057f1 Cleanup: correct asserts 2023-01-17 13:13:43 +01:00
2c6ed49c03 Cleanup: Rename confusing region variable
`scaleare` reads like "scale area", but should read "scale region".
2023-01-17 13:08:06 +01:00
Damien Picard
8082b96a75 Tracking: fix inverted pie menu items for pattern match of track
The two items had their effects inverted.

Reviewed By: sebastian_k

Differential Revision: https://developer.blender.org/D16438
2023-01-17 09:40:08 +01:00
962c3cf6b1 Cleanup: remove unused IDProperty members
Remove:

- IDPropertyTemplate.matrix_or_vector
  Matrix & vector types have been deprecated, this wasn't used.

- IDProperty.saved
  This was added preemptively but never used, replace with a pad so as
  not to hint at a feature that doesn't exist.
2023-01-17 12:05:21 +11:00
9789835db8 Docs: improve ID property doc-strings
Add some clarifications and reference enum types from DNA.
2023-01-17 11:59:05 +11:00
7241ab6ede Revert "Fix: don't set default value for unused socket in geometry nodes"
This reverts commit 154d3e95f8.

This caused crashes in the mouse house and flower shop benchmark files.
A proper solution will be investigated soon.
2023-01-16 16:58:24 -06:00
647a7da17d Curves: Avoid adding curve type attribute when setting default
The default curve type when there is no "curve_type" attribute is
Catmull ROM. In order to avoid allocating an entire array of values
just to set this default type, remove the attribute instead. This will
be less important when we can store attributes as single values.

Also fix a curve utility API comment.
2023-01-16 16:51:32 -06:00
6769acbbba BLI_math: simplify matrix multiply logic
Improve safety and correctness of matrix multiplication by using
temporary storage if one of the inputs is also the output.

No functional changes.

Differential Revision: https://developer.blender.org/D16876
Reviewed By: Campbell Barton, Sergey Sharybin
2023-01-17 11:18:33 +13:00
7026096099 Nodes: Use dynamic declarations for group nodes
Since a year and a half ago we've been switching to a new way to
represent what sockets a node should have called "declarations"
that's easier to use, clearer, and more flexible for upcoming
features like dynamic socket counts or generic type sockets.

All builtin nodes with a static set of sockets have switched, but one
missing area has been group nodes and group input/output nodes. These
nodes have **dynamic** declarations which change based on their
properties or the group they're inside of. This patch addresses that,
in preparation for using the same dynamic declaration feature for
simulation nodes.

Generally there shouldn't be user-visible differences, but one benefit
is that user-created socket descriptions are now visible directly in
the node editor for group nodes and group input/output nodes.

The commit contains a few changes:
- Add a node type callback for building dynamic declarations with
  different arguments
- Add an `Extend` socket declaration for the "virtual" sockets used
  for connecting new links
- A similar `Custom` socket declaration is used for addon-defined socket
- Simplify the node update loop to use the declaration to build update
  sockets
- Replace the "group update" functions with the declaration building
- Move the node group input/output link creation to link drag operator
- Make the field status part of group node declarations
  (not for group input/output nodes though)
- Some fixes for declarations to make them update and build properly

Differential Revision: https://developer.blender.org/D16850
2023-01-16 15:47:25 -06:00
6d12d43a05 Mesh: Skip conversion from legacy data if reading new format
Under some circumstances (loading autosaves), we end up reading from
files that were saved with the new mesh format (after T95965). When
that happens we should skip the conversion from the old format to
avoid data-loss. This will also give forward compatibility when we
stop saving in the old format completely in 4.0.

Here I mostly just check if the attributes in the new format already
exist. Along with checking for the null status of `Mesh::mvert`, that
should cover the majority of cases.

Fixes T103878

Differential Revision: https://developer.blender.org/D17011
2023-01-16 15:47:25 -06:00
39c6953462 UI: Fix alignment of custom properties edit & remove buttons
This fixes the UI alignment issues that were introduced by {D12815} with the addition of the boolean custom properties.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D17012
2023-01-16 12:54:25 -08:00
6f6cc269a4 Cleanup: Move sculpt_dyntopo.c to C++
See T103343
2023-01-16 14:41:28 -06:00
e0e6afb766 Geometry Nodes: Parallelize mesh and curve edit hint transformation
Previously transforming and translating meshes (used by the object info
and transform geometry nodes) was single threaded. Now use the same
code path as other geometry types which already includes multithreading.

I observed a 5x performance improvement for a 4 million vert mesh on a
Ryzen 7950x.
2023-01-16 13:16:44 -06:00
93ca4eeec1 Cleanup: remove unused functions 2023-01-16 19:40:25 +01:00
Mattias Fredriksson
c55767b32e Fix T103632: Single point trim samples curve end point incorrectly
Trim erronously samples the next to last control point when it should
sample the last control point on the curve. This only happens when
reducing the curve to a single point. These changes should correct
the behavior.

Differential Revision: https://developer.blender.org/D17003
2023-01-16 12:22:20 -06:00
a219507d57 Cleanup: Add documentation to curve legacy conversion functions 2023-01-16 12:06:36 -06:00
b82f7814c4 Fix: Draw: Incorrect culling in the new Draw Manager
ViewCullingData::corners (vec4) was casted to a BoundingBox (vec3),  so the frustum corners were uploaded in the wrong format to the GPU.

Now the ViewCullingData::corners are used directly without casting, since the BoundBox API is not really needed.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D17008
2023-01-16 18:41:06 +01:00
c66da0b267 Docs: change readme.rst to README.md, as Gitea can't render rst 2023-01-16 17:54:11 +01:00
a84a8a528d Cycles: remove SSE3 and AVX kernel optimization levels
While keeping SSE2, SSE4.1 and AVX2. This does not affect hardware support, it
only slightly reduces performance for some older CPUs.

To reduce maintenance cost and improve compile times.

Differential Revision: https://developer.blender.org/D16978
2023-01-16 17:53:36 +01:00
debd912bef Fix T103906: Crash when canceling transform operation with the mirror options set
Caused by rB3b761901b6d6.

Some mirror transdata values were not being initialized.
2023-01-16 12:14:27 -03:00
8cc558814d Cleanup: make format 2023-01-16 14:39:17 +01:00
Iliya Katueshenock
154d3e95f8 Fix: don't set default value for unused socket in geometry nodes
Setting the default value resulted in an incorrect tooltip.

Differential Revision: https://developer.blender.org/D16957
2023-01-16 12:41:07 +01:00
5320372c34 User Inteface: Missing separator in Geometry Nodes > Add Node > Geometry menu
This separator was missing in the original change in the menus (d4e638baac).
2023-01-16 12:23:52 +01:00
Marc Chéhab
9a1f0443cb Fix Unreported: GPencil Separating strokes creates negative times
Separating strokes using "selected points" didn't take into account 
that points->time can be 0 and thus created points with negative 
values in points->time, which should be an impossibility. 
This patch fixes this in BKE_gpencil_stroke_delete_tagged_points.

Also, it makes the build modifier's new drawspeed immune 
to (erroneous) negative time values, should they arise in other situations.

Reviewed By: antoniov


Differential Revision: https://developer.blender.org/D17006
2023-01-16 12:07:15 +01:00
ff814ec5f6 Metal: Fix read from uninitialized memory.
Implementation didn't count the string terminator when allocating
memory to store `msl_patch_default`. The string terminator could
be overwritted by other memory adding some undefined behavior.
2023-01-16 11:12:14 +01:00
5cbc8ce3b1 Fix ASAN error when Wayland fell back to X11
An alternative fix to [0] which caused an error with ASAN
(freeing an GHOST_ISystem instead of a GHOST_System).
Reported by @Baardaap in chat, I'm unable to reproduce the issue.

Instead of calling the destructor directly, add a private method that
deletes data before raising an exception.

[0]: fd36221930
2023-01-16 15:29:22 +11:00
a294c35370 Docs: expand on doc-string for seam_connected_recursive
Also use const UVs where possible.
2023-01-16 14:51:12 +11:00
6a7ecec6e1 Cleanup: avoid returning large structs from functions
Return BezTriple as a const pointer from utility functions
instead of by a value since it's a large struct.
2023-01-16 14:23:23 +11:00
cc5fefffe6 Cleanup: quiet array-bounds warning in GCC 12.2 2023-01-16 14:06:41 +11:00
2467becade Cleanup: spelling in comments 2023-01-16 13:57:10 +11:00
eeb6a3dc05 Clenaup: comments places awkwardly before code 2023-01-16 13:27:51 +11:00
33c30af742 Cleanup: comments in struct declarations
Use a consistent style for declaring the names of struct members
in their declarations. Note that this convention was already used in
many places but not everywhere.

Remove spaces around the text (matching commented arguments) with
the advantage that the the spell checking utility skips these terms.
Making it possible to extract & validate these comments automatically.

Also use struct names for `bAnimChannelType` & `bConstraintTypeInfo`
which were using brief descriptions.
2023-01-16 13:27:35 +11:00
Sibo Van Gool
b038662887 Fix T103559: Check for no-face object for particle baking
Meshes spawning particles from faces with with UV's/Vertex-colors but no
faces would crash de-referencing a NULL pointer.

Resolve by adding a check for this case and an assertion if CD_MFACE is
NULL when the mesh has polygons.

Ref D16947
2023-01-16 11:15:40 +11:00
28db19433e GPU: Math: Add floatBitsToOrderedInt and orderedIntBitsToFloat
These allow the usage of `atomicMin` and `atomicMax` function with float
values as there is no overload for these types in GLSL.

This also allows signed 0 preservation.
2023-01-16 00:39:57 +01:00
945d108ab8 GPU: Fix uninitialized variable which created asan warning / errors
This wasn't really a problem since these are set on first bind or creation.
The test `if (enabled_srgb && srgb_) {` was depending on that variable that
in certain case, might not have been initialized (because of lazy init).
2023-01-16 00:39:57 +01:00
6da7436cce DRW: Add debug print for matrix type 2023-01-16 00:39:57 +01:00
6d07b459f2 Cleanup: compare to GPU_SHADER_CFG_CLIPPED when checking configurations
Don't assume a non-zero eGPUShaderConfig is clipped, as this would cause
unexpected behavior if other configurations are added.
2023-01-16 10:21:32 +11:00
e1aef2e87e Cleanup: suppress '-Warray-bounds' warnings
Changes to overlay_shader.cc workaround a bug in GCC-12.2
(likely a duplicate of [0]). As the workaround involved removing
a local variable which most functions already didn't assign,
remove it for all functions.

An alternative is to add (otherwise redundant) parenthesis, e.g.
`&(e_data.sh_data[sh_cfg])`, but this would need to be noted in
code-comments, so opt for removing the intermediate variable.

[0]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106247
2023-01-16 10:12:21 +11:00
87bb14ab5f Fix T103256 Viewport: Regression: Clipping Region is not working
This was caused by a change in UBO name that wasn't propagated through
all usage, leading to missing UBO bind.
2023-01-15 14:24:06 +01:00
8b5d5cbf06 BLI: Math: Add sign() function
This implement the sign function as simple as possible while giving the
the same result as `signum`.
2023-01-15 14:15:39 +01:00
0a7c485b66 Cleanup: remove redundant memset on calloc'ed array 2023-01-15 23:55:06 +11:00
bec86c5d15 Cleanup: remove unused arguments 2023-01-15 23:52:50 +11:00
8c7df5fa72 Fix invalid arguments to memcpy in IMB_rectfill_area_replace
Passing the pointer to the array doesn't make sense in this case.
2023-01-15 23:45:56 +11:00
82bd020a30 CMake: suppress GCC warnings stringop-overread & stringop-overflow
As noted in comments, there are a lot of false positives which can't
be conveniently suppressed. Many of these warnings were caused by
`float x, y, z` being passed as `float[3]` using a pointer to `x`.
2023-01-15 23:31:44 +11:00
fc9c818531 Fix missing view layer sync in recent change to ED_view3d_datamask
Call BKE_view_layer_synced_ensure before getting the active object [0]
caused an assertion for tests in debug mode.

[0]: c158dd560e
2023-01-15 23:28:12 +11:00
cc332264ae Audaspace: porting changes from upstream. 2023-01-14 22:18:39 +01:00
1a79bdfbf1 BLI: inline index mask slice methods
Those are simple enough to be inlined.
2023-01-14 19:40:22 +01:00
ff15edc6ab Cleanup: unify method parameters for virtual arrays
This makes `GVArrayImpl` and `VArrayImpl` more similar.
Only passing the pointer instead of the span also increases
efficiency a little bit. The downside is that a few asserts had
to be removed as well. However, in practice the same asserts
are in place at a higher level as well (in `VArrayCommon`).
2023-01-14 19:13:51 +01:00
72cc68e299 Functions: only allocate resource scope when it is actually used
In most cases it is currently not used, so always having it there
causes unnecessary overhead. In my test file that causes
a 2 % performance improvement.
2023-01-14 15:56:43 +01:00
50980981e3 Cleanup: remove MF prefix from some classes in multi-function namespace
This was missing in rBeedcf1876a6651c38d8f4daa2e65d1fb81f77c5d.
2023-01-14 15:42:52 +01:00
8625495b1c Functions: improve handling of unused multi-function outputs
Previously, `ParamsBuilder` lazily allocated an array for an
output when it was unused, but the called multi-function
wanted to access it. Now, whether the multi-function supports
an output to be unused is part of the signature. This way, the
allocation can happen earlier when the parameters are build.
The benefit is that this makes all methods of `MFParams`
thread-safe again, removing the need for a mutex.
2023-01-14 15:35:44 +01:00
aea26830dc Cleanup: use std::get instead of std::get_if
`std::get` could not be used due to restrictions on macos.
However, the minimum requirement has been lifted in
{rB597aecc01644f0063fa4545dabadc5f73387e3d3}.
2023-01-14 14:16:51 +01:00
8126d92073 Cleanup: fix compile error in debug build 2023-01-14 14:15:21 +01:00
92773761d3 Sculpt: Change expand hotkey to not auto-create mask 2023-01-13 20:17:03 -08:00
325105ee6f Sculpt: add support for curves sculpt to paint_init_pivot
Uses BKE_object_boundbox_get.
2023-01-13 19:58:42 -08:00
3a3d9488a1 Refactor: Const correct Custom Data API, prepare for CoW
Currently you can retrieve a mutable array from a const CustomData.
That makes code unsafe since the compiler can't check for correctness
itself. Fix that by introducing a separate function to retrieve mutable
arrays from CustomData. The new functions have the `_for_write`
suffix that make the code's intention clearer.

Because it makes retrieving write access an explicit step, this change
also makes proper copy-on-write possible for attributes.

Notes:
- The previous "duplicate referenced layer" functions are redundant
  with retrieving layers with write access
- The custom data functions that give a specific index only have
  `for_write` to simplify the API

Differential Revision: https://developer.blender.org/D14140
2023-01-13 17:22:07 -06:00
4160da187c Fix T103670: correct seam calculation when finding unique uvs
Fixes bugs where UV islands with `mark seam` would tear at boundaries.

Modify seam_connected to search both it's edges instead of only one,
as this could fail if the edge was a seam or did not fan to the other loop.

Also fixes bug in `seam_connected_recursive`:
- `loop->prev == needle` changed to `loop == needle`

Maniphest Tasks: T103787
Reviewed By: Campbell Barton
Differential Revision: https://developer.blender.org/D16992
Test File: F14145477, F14137755, T79304
2023-01-14 11:47:59 +13:00
326e1eeb56 UV: cleanup
Cleanup ahead of D16992

Changes in `seam_connected_recursive`:

- Remove redundant `anchor` parameter.
- Improve const correctness

No functional changes.
2023-01-14 11:47:59 +13:00
Iliya Katueshenock
e35053d369 Fix T103850: Convex hull node crash with empty geometry components
Avoid using components that can contain null pointer.
Getting attibute should avoid trying to do it for a null mesh.
This fix bypasses working with components.

Differential Revision: https://developer.blender.org/D16997
2023-01-13 15:46:39 -06:00
b55b671955 Cleanup: format 2023-01-14 10:38:53 +13:00
0a21a554d5 Fix T103304: Incorrect handling of edge crease in subdivision node
The crease custom data layer was added to a mutable version of the mesh,
but that wasn't used in the rest of the operation. Also the layer wasn't
retrieved properly with write access from the custom data API (fixed
separately as part of D14140). Also clean up a bit by retrieving
attributes from the mesh directly and by tweaking naming a bit.
2023-01-13 15:34:01 -06:00
dc99c09daa Cleanup: Use const when accessing custom data layers 2023-01-13 14:52:04 -06:00
a5c3f5b0bc Fix T103818: Freeze frames in movie strips when timecodes are used
Timecodes were generated from read packets, but applied to decoded
frames. This works as long as delay between packet read and decoded
frame is less than GOP size or if packet does not produce multiple
frames. In this case it did not work.

Use `pkt_pos`, `pkt_dts` and `pts` from `AVFrame` instead of `AVPacket`.
This way delay can be eliminated and timecode files are more reliable.
2023-01-13 21:32:42 +01:00
2c910cb70a Modifiers: Only allow geometry nodes for curves and point cloud
Effectively this disables two volume modifiers for the new curves
object and the point cloud object types. The aim is to simplify the
process of using these object types to prove out a node-group-based
workflow integrated with the asset browser. We're making the assumption
that these two modifiers were used very rarely on the new curves type
since that wasn't its purpose, so this breaks backwards compatibility.
2023-01-13 14:20:08 -06:00
cb92ff7b2d Geometry Nodes: Only set soft range for modifier properties
Similar to the corresponding properties on node sockets, only adjust
the soft range. Because group nodes only have soft limits, groups
should generally be able to accept these inputs anyway. The benefit
of only using a soft range is that it allows choosing a more user-
friendly default range while keeping flexibility.
2023-01-13 12:50:19 -06:00
ef68a37e5d Custom Properties: Add boolean type
A proper boolean custom property type is commonly requested. This
commit simply adds a new `IDP_BOOLEAN` type that can be used for
boolean and boolean array custom properties. This can also be used
for exposing boolean node sockets in the geometry nodes modifier.

I've just extended the places existing IDProperty types are used, and
tested with the custom property edit operator and the python console.
Adding another IDProperty type is a straightforward extension of the
existing design.

Differential Revision: https://developer.blender.org/D12815
2023-01-13 12:31:27 -06:00
4961e5f91d Geometry Nodes: Rename Interpolate Domain and Field at Index nodes
- `Interpolate Domain` -> `Evaluate on Domain`
- `Field at Index` -> `Evaluate at Index`

These names, discussed in recent geometry nodes submodule meetings,
describe actions rather than nouns, which is generally how nodes are
supposed to be named. The names are consistent, which is helpful
because they're similar conceptually. They also don't require knowledge
of the field concept, which we generally try to keep out of the UI in
favor of more beginner-friendly concepts.

We hope to add the ability to search for nodes with multiple
names for 3.5, so the old names can still have search items.
2023-01-13 11:49:50 -06:00
ba71419891 Cleanup: improve const correctness of bvh tree 2023-01-13 18:09:27 +01:00
046d1a414b Fix: Curves select all operator name
The operator is used for edit mode and sculpt mode, so it
shouldn't have the sculpt prefix.
2023-01-13 10:47:33 -06:00
761e6b1b78 Fix: crash when opening node add menu
Differential Revision: https://developer.blender.org/D16995
2023-01-13 17:25:20 +01:00
d4e638baac User Interface: Re-organization of Geometry Nodes Add Node Menu
The menus are growing too large. This patches move some categories under
sub-menus, and shuffle some entries around.

We already had sub-categories split by separators. This change now
goes a step further and embrace 3-level menus.

Inspired by the "Simpler Add Menu" add-on by Quackers (waiting to hear
back to know Quackers real name).

Inspired by the "Simpler Add Menu" add-on by Alfonso Martinez II.

Differential Revision: https://developer.blender.org/D16993
2023-01-13 16:31:27 +01:00
2fb829a2de Fix T103837: crash opening a specific file
Caused by {rBd397ecae325}.

Above commit added a new socket, so
`version_geometry_nodes_primitive_uv_maps` was getting the wrong sockect
with `->next`.

Now get the right one with yet another `->next` (might not be ideal, but
searching the right socket with other methods might be overhead?)

Maniphest Tasks: T103837

Differential Revision: https://developer.blender.org/D16994
2023-01-13 14:58:57 +01:00
bc3da3ad41 Sculpt: fix T103454: SCULPT_vertex_is_occluded is not compatible with
filters
2023-01-13 00:10:46 -08:00
daedf19315 Sculpt: Fix T103724: missing mask attr existance check for PBVH_GRIDS 2023-01-12 23:58:00 -08:00
c158dd560e WM: reduce CPU use while idle in ED_view3d_datamask
When idle, each 3D view made two calls CTX_data_mode_enum(C) from the
WM_main loop. While not causing problems it complicated troubleshooting
high CPU use while idle in other areas.

Access the object via the view layer, giving approx 40x speedup.
2023-01-13 17:56:05 +11:00
0c2a3054ba Fix high CPU use when idle under Wayland
Recently the event handling thread for Wayland sometimes used 100% of a
CPU core while idle.

Resolve by waiting for changes to the Wayland file-handle when
there are no events to read.
2023-01-13 17:48:52 +11:00
bbe7183cd3 GHOST/Wayland: fix threaded event handling
The previous fix from T100855 [0] no longer works on my system
(3.4.1 release also fails for GNOME/KDE/WLROOTS compositors).

Resolve by removing the loop from the wait-on-file handle check.
Also reduce locking/unlocking calls.

[0]: 37b256e26f
2023-01-13 17:48:50 +11:00
b599820418 OBJ: add split by objects/groups import options (T103839)
The new C++ OBJ importer was missing "split by objects" / "split by
groups" import settings of the older Python importer.
Implements T103839.

Added test coverage for all 4 possible combinations of these two
options.
2023-01-12 22:47:39 +02:00
b2746876f2 EEVEE: Avoid glitchy displacement on curve geometry
This is caused by the partial derivatives not being precise enough to
take the tube shape into account. For now we just disable displacement
bump for this type of geometry to match cycles.

Fixes T101175 Eevee displacement behavior changed
2023-01-12 16:19:03 +01:00
Marc Chéhab
063caae72e GPencil: Fix unreported error in Build modifier
In patch D16759 cleanup a  else was removed by error which
 deals with situations where current gpf was copied, 
so that previous gpf may have MORE strokes than current gpf.

Reviewed By: antoniov

Differential Revision: https://developer.blender.org/D16986
2023-01-12 15:37:35 +01:00
Germano Cavalcante
589d1be147 Cleanup: rename variables to distinguish between target and source
From --> To

**Struct Members:**
|snapTarget|snap_source
|snapPoint|snap_target
|snapTargetGrid|snap_target_grid
|calcSnap|snap_target_fn
|targetSnap|snap_source_fn
|applySnap|snap_mode_apply_fn
|distance|snap_mode_distance_fn
|source_select|source_operation
|target_select|target_operation

**Functions:**
|snap_calc_view3d_fn|snap_target_view3d_fn
|snap_calc_uv_fn|snap_target_uv_fn
|snap_calc_node_fn|snap_target_node_fn
|snap_calc_sequencer_fn|snap_target_sequencer_fn
|TargetSnapMedian|snap_source_median_fn
|TargetSnapCenter|snap_source_center_fn
|TargetSnapClosest|snap_source_closest_fn
|TargetSnapActive|snap_source_active_fn

**Enums:**
|TARGET_INIT|SNAP_SOURCE_FOUND
|TARGET_GRID_INIT|SNAP_TARGET_GRID_FOUND
|POINT_INIT|SNAP_TARGET_FOUND
|MULTI_POINTS|SNAP_MULTI_POINTS

**Types:**
|eSnapSourceSelect|eSnapSourceOP
|eSnapTargetSelect|eSnapTargetOP

Also rename Select to Operation.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D16967
2023-01-12 10:30:47 -03:00
16fc928068 Fix: uninitialized UVs when painting in sculpt mode
Because of a mistake in commit 6c774feba2 the uv vbo was not
initialized in the pbvh.
2023-01-12 14:25:37 +01:00
c5f9bf95cd Cleanup: Remove unused function pose_propagate_fcurve
Remove the unused function `pose_propagate_fcurve`
It was missed in D16771

Reviewed By: Jacques Lucke
Differential Revision: https://developer.blender.org/D16937
Ref: D16937
2023-01-12 13:03:55 +01:00
ed178f5ff5 Fix: Potential divide by 0 using GRAPH_OT_ease
In case there is only 1 key on the FCurve,
the operator can run into a situation where it divides by 0.
It now skips the curve in that case

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D16982
Ref: D16982
2023-01-12 12:54:27 +01:00
ea1c31a244 Fix T103074: flipped vertex group meaning in Multi-Modifier Armature.
For some reason the Armature modifier in the Multi-Modifier mode
interpreted the vertex group in a way essentially opposite to the
regular mode. Moreover, this depended not on the Multi-Modifier
checkbox, but on whether the mode was actually active.

This fixes the flip and adds versioning code to patch old files.
One difficulty is that whether the Multi-Modifier flag is valid
can be different between the viewport and render. The versioning
code assumes any modifier enabled in either to be active.

This change is not forward compatible, so min version is also bumped.

Differential Revision: https://developer.blender.org/D16787
2023-01-12 12:46:22 +02:00
09a26f26e8 Cleanup: missing-declarations warnings
Also remove duplicate doc-string.
2023-01-12 20:22:46 +11:00
eeff49a3b1 macOS: Replace PboardTypes with PasteboardTypes.
Related to {T103758}.

- NSStringPboardType is replaced by NSPasteboardTypeString
- NSTIFFPboardType is replaced by NSPasteboardTypeTIFF
2023-01-12 08:48:48 +01:00
Jeroen Bakker
3590e263e0 macOS: Remove user notifications.
User notifications in Blender were always annoying and therefore by default turned off.
- When tweaking compositor/material tree a notification was shown.
- When rendering an animation for each frame a notification was shown.

The reason for this was that it was automatically shown when a background job was
finished and Blender wasn't the top most application.

In stead of migrating user notification to UserNotification.framework it was decided
to remove it for now. If in the future notifications should be added back we should
start with a design to figure out where notifications makes sense.

Reviewed By: sergey, brecht

Maniphest Tasks: T103757

Differential Revision: https://developer.blender.org/D16955
2023-01-12 08:39:56 +01:00
Jeroen Bakker
b9177014b6 3D Texturing: Replace pointers with indexes in pbvh_uv_islands
Replace the pointers in the MeshEdge with indexes, removing MeshPrimitive and MeshVertex.

Code cleanup proposed by the geometry nodes to make the data structures more reusable by
other areas of Blender as well. Old implementation was to focused to the texture painting.

Initial the idea was to do the same with the data structures in UVIslands, but there some
concerns were raised that requires a different design than expected from a clean-up patch.

Concerns raised about converting UVIslands:
* Maps between UVPrimitive, UVEdge and UVVertex will be stored inside the UVIsland.
   During UVIsland extraction detected islands can be merged. When they are merged all
   Indexes should be updated.
* It is not possible to pre-allocate all buffers as they grow, what will lead to more re-allocations. The current
   implementation uses a VectorList to ensure that re-allocations don't require the data to be
   moved to the newly allocated memory. We could store some information about last used
   sizes in runtime data to reduce the re-allocation overhead.
* Solution would require index based access inside a VectorList, which might increase the
   complexity.
* UVIslands during 3d texturing is used as intermediate data, the final data is stored as PackedPixelRows.
   We could proceed converting UVIslands as well, but that would lower the performance noticeably.
   3D texturing has performance requirements, so when doing so we should make sure that
   it matches that as well.

Reviewed By: HooglyBoogly

Maniphest Tasks: T101740

Differential Revision: https://developer.blender.org/D16752
2023-01-12 08:35:38 +01:00
0349a6e6e0 Fix disappearing snap indication in Measure tool
Snap cursor disappeared while dragging.

Regression in 2b32a2c3b
2023-01-11 23:03:25 -03:00
2b4bf586ad Fix T102920: Cycles doesn't support multiple outputs on muted nodes
Cycles converts internal links to converter nodes which don't do anything and
later on get collapsed by the graph optimization. However, the previous code
assumed that one Blender input socket maps to one Cycles input socket.

When a node is muted, there might be internal links from one input to multiple
outputs. In Cycles, this meant that one Blender input socket now mapped to
multiple input sockets on all the converter nodes, so only the last one survived.

THe fix is simple, just make the mapping a MultiMap.
2023-01-12 00:53:05 +01:00
2b32a2c3b2 Snap Gizmo: hide snap cursor if another gizmo is highlighted 2023-01-11 18:52:30 -03:00
442b08aac0 Snap Gizmo: support the WM_GIZMO_HIDDEN flag
Support snap cursor removal in poll callback, this makes it possible to
delay cursor removal if the gizmo is hidden.
2023-01-11 18:27:16 -03:00
ff86573d72 Fix T102313: Enabling shadow catcher in viewport render shows self-shadowing
The problem here is that whether an object is a shadow catcher or not affects the
visibility flags, but changes to the shadow catcher property did not trigger a
visibility flag update.
2023-01-11 21:36:46 +01:00
88e9826529 Sculpt: Fix T102889: Sculpt trim tool extrudes in perspective
Added an extrude mode enum to the trim operators to
control extrusion: "project" and "fixed."  "Fixed" just
extrudes along a fixed normal and is the new default.
2023-01-11 09:57:58 -08:00
4d1f12212b Transform: deduplicate code
Edge Bevel Weight and Edge Crease operations have the same code.

Only the name displayed in the header changes.
2023-01-11 13:08:42 -03:00
5029f3e483 Fix crease and bevel weight unaffected when transforming
Regression in 3b761901b
2023-01-11 12:49:19 -03:00
ad01cdd7fc Transform: improve safety when restoring data 2023-01-11 12:08:04 -03:00
3b761901b6 Fix T103783: crash when canceling vertex crease having vertex groups
`transdata_restore_basic` uses `copy_v3_v3` to restore a pointer that is 1D.
2023-01-11 11:52:41 -03:00
a6b6f5db10 Fix issue with recent refactor in liboverride diffing.
New code from rBd05909a70c36 last week did not take into account
liboverride templates and `NOOP` operations. So we cannot assume that
there is no valid override property for these which need to be restored.

While we may get rid of templates at some point now, for now they are
still exposed in PY API, and have some basic unittests, so keep them
working as best as possible.

Issue reported on IRC by Martijn Versteegh (@Baardaap), thanks!
2023-01-11 15:32:06 +01:00
5d07b0e6da Cleanup: delegate to string_view equality for StringRef
This also fixes an issue introduced in rBd3e8d63a8c455d0,
where the function relied on the `StringRef` being null-terminated.
2023-01-11 13:19:11 +01:00
8f7bb812c4 Gitea: Add Issue and Pull Request templates
It is a part of the Phabricator to Gitea migration.

The issue template is based on the bug submission instructions which
are shown in the Phabricator's bug submission form. Some further tweaks
are likely needed, but the current version of the template simplifies
re-iteration while working on the migration.

The pull request template is needed to override the template in the
.github folder which is otherwise picked up by Gitea.
2023-01-11 11:46:53 +01:00
866b24ac88 Cleanup: use continue in loop to reduce right-shift 2023-01-11 21:08:15 +11:00
cff2807aff Fix T103719: missing shortcuts info for some tool-settings
Tool settings can be accessed from both `tool_settings` &
`scene.tool_settings`.

As of [0] `scene.tool_settings` was used instead of `tool_settings`
causing the snap shortcut not to display.

Resolve by supporting variations of data-paths so both are detected.

[0]: 9a76dd2454
2023-01-11 21:02:21 +11:00
d3e8d63a8c Fix error in StringRef equality
Regression in [0] wasn't correct as it's important for empty strings
to be equal to nullptr.

[0]: 9f283bee7e
2023-01-11 20:04:00 +11:00
68c6fc6d38 Fix T103267: No shortcuts shown in the Pose Assets context menu
Support displaying shortcuts for uiListDyn.custom_drag_* &
custom_activate_* operators.
2023-01-11 19:25:12 +11:00
f88e788569 Pose Slide: set the value of "release_confirm" from the event when unset
Needed to fix T103267, so the properties for the menu item and the
drag action will match & show the shortcut in the menu.
2023-01-11 19:25:06 +11:00
d8d20e0e59 UI: include 'drag-' prefix in the short-cut text for menu items
This was already done for double-click events but not drag events.
2023-01-11 17:54:12 +11:00
86464cfcef Fix error converting UV's to MLoopUV
Logic to skip UV layers that are part of the MLoopUV treated all
loop-layers as UV's, causing duplicate and invalid names to be added
to be added to 'uv_sublayers_to_skip', this asserted in debug mode
when saving the `ellie_animation.blend` demo blend file.
2023-01-11 14:03:57 +11:00
28d38e876f Cleanup: rename face_corners to loop for internal layer operations
Follows naming used elsewhere.
2023-01-11 14:00:20 +11:00
bd7a1d5de6 Docs: improve doc-string for UI_BUT_HAS_SEP_CHAR & UI_SEP_CHAR 2023-01-11 13:41:14 +11:00
32812c2cc2 Cleanup: Remove redundant mesh data mask handling
Byte colors are generic attributes and are therefore included in
CD_MASK_PROP_ALL. Also clarify the use of vertex groups.
They always have to be propagated since they're displayed in
the spreadsheet, etc.
2023-01-10 21:14:03 -05:00
8367f2bffc Cleanup: function style casts for C++ 2023-01-11 13:04:23 +11:00
494c3ba063 Cleanup: quiet warning mixing enum/int & replace NULL with nullptr 2023-01-11 13:04:23 +11:00
12a26b8fe3 Cleanup: format 2023-01-11 13:04:23 +11:00
9f283bee7e BLI_string_ref: avoid passing null to strncmp (quiet ASAN warning)
The existing logic to avoid passing null only worked when both
strings were null.
2023-01-11 13:04:23 +11:00
bd9602036a Fix pose-slide failing with array custom properties
Pose slide would attempt to use non-array functions to get/set RNA
array properties. Asserting in debug mode.
2023-01-11 13:04:17 +11:00
50d6af1e0e Fix invalid string comparison
Error from recent addition: 250eda36b8.
Compare the enum value instead.
2023-01-11 13:03:44 +11:00
dd9e1eded0 Mesh: Move sharp edge flag to generic attribute
Move the `ME_SHARP` flag for mesh edges to a generic boolean
attribute. This will help allow changing mesh edges to just a pair
of integers, giving performance improvements. In the future it could
also give benefits for normal calculation, which could more easily
check if all or no edges are marked sharp, which is helpful considering
the plans in T93551.

The attribute is generally only allocated when it's necessary. When
leaving edit mode, it will only be created if an edge is marked sharp.
The data can be edited with geometry nodes just like a regular edge
domain boolean attribute.

The attribute is named `sharp_edge`, aiming to reflect the similar
`select_edge` naming and to allow a future `sharp_face` name in
a separate commit.

Ref T95966

Differential Revision: https://developer.blender.org/D16921
2023-01-10 16:12:14 -05:00
Damien Picard
30c90f0ad0 Cleanup: Replace "UV's" with "UVs"
An apostrophe should not be used because it is not a mark of plural,
even for initialisms. This involves mostly comments, but a few UI
messages are affected as well.

Differential Revision: https://developer.blender.org/D16749
2023-01-10 14:50:13 -05:00
5bc71f22a2 Snap Gizmo: remove unused "snap_elements"
This property was intended to keep the snap elements synchronized with the scene.

But another solution exists.

And this property is not even working correctly.
2023-01-10 15:56:17 -03:00
d397ecae32 Geometry Nodes: Add a selection input to the store named attribute node
This patch is a response to T101313.

Adds a selection to the Store Named Attribute node.

If the attribute does not exist unselected parts
are filled with zero values. Otherwise, only the
selected parts are filled.

Differential Revision: https://developer.blender.org/D16237
2023-01-10 18:16:08 +00:00
8a3a1a0c14 Fix T103781: assert when connecting viewer node on mesh without faces
`Span.data()` does not have to be `nullptr` when the size is zero.
This happens e.g. when slicing a span to a size of zero.
2023-01-10 17:14:28 +01:00
db688b62f9 Fix T103764: Grease Pencil modes other than Draw use a wrong radial
It was introduced in commit https://developer.blender.org/rB0fb12a9c2ebc

The problem was that the tool uses the same values for all modes,
but the new calculation must be only for Draw mode.

Now the mode is checked.
2023-01-10 17:00:58 +01:00
9b8c2f91f6 Cleanup: Compile filesel.c in C++
This is a mere "get this to compile in C++", didn't do changes like
using `MEM_cnew()` instead of `MEM_calloc()`.

Needed for the blender-project-basics branch, so I don't have to write C
wrappers for a single call from this file.
2023-01-10 16:36:56 +01:00
df5ebd348b Fix T103556: Cycles viewport unexpected pixel changes when hovering over UI
With the GPU API the sampler can not be set after texture binding, which caused
a delay of the actual change. Now do both in a single call for correctness and
performance.
2023-01-10 16:35:19 +01:00
3a98dc6812 Fix crash when dragging video into VSE timeline
Caused by NULL dereference in strip overlap handling (expand to fit),
because `time_dependent_strips` strip collection is not created.

Check if strip collection is provided in `query_right_side_strips()`.
2023-01-10 16:19:10 +01:00
09a5443f20 GPencil: Fix unreported wrong fill vertex color in Outline
The Fill vertex color was assigned to the wrong stroke. It needs to be
set in the perimeter stroke, not in the original one.
2023-01-10 16:13:51 +01:00
66af16571d Refactor: Use new "All" asset library to extend node menus with assets
Updates the add and search menu of the node editor to use the new "All"
asset library introduced in the previous commit. This simplifies code by
removing redundant logic to merge contents of multiple asset libraries.
2023-01-10 15:41:58 +01:00
35e54b52e6 Assets: "All" asset library
Adds a new built-in asset library that contains all other asset
libraries visible in the asset library selector menu. This also means
all their asset catalogs will be displayed as a single merged tree. The
asset catalogs are not editable, since this would require support for
writing multiple catalog definition files, which isn't there yet.

Often it's not relevant where an asset comes from. Users just want to be
able to get an asset quickly, comparable to how people use a search
engine to browse images or the web itself, instead of first going to a
dedicated platform. They don't want to bother with first choosing where
they want the result to come from.
This especially is needed for the Asset Shelf (T102879) that is being
developed for the brush assets project (T101895). With this, users will
have access to all their brushes efficiently from the 3D view, without
much browsing.

Did an informal review of the asset system bits with Sybren.
2023-01-10 15:41:58 +01:00
250eda36b8 GPencil: Build modifier add "natural drawing" time
This patch uses the recorded drawing speed to rebuild the strokes. This results in a way more
natural feel of the animation.

Here's a short summary of existing data used:

- gps->points->time: This is a timestamp in seconds of when the point was created
  since the creation of the stroke. It's quite often 0 (I added a sanitization routine).
- gpf->inittime: This is a timestamp in seconds when a stroke was drawn measured
  since some unknown point in time. I only ever use the difference between two strokes,
  so the absolute value is not relevant.

Reviewed By: frogstomp, antoniov, mendio

Differential Revision: https://developer.blender.org/D16759
2023-01-10 15:38:46 +01:00
fddb76e9af Fix: new Grease Pencil layer not selected when added from the viewport
When adding a new layer from the viewport, the newly created layer
is set as active, which is visible in the properties panel,
but the selection in the dopesheet was not updated accordingly,
due to a missing notifier which is added in this patch.
2023-01-10 15:20:35 +01:00
Jeroen Bakker
597aecc016 MacOS: Update Min Requirement to 10.15.
A few weeks ago we enabled the Metal back-end for the viewport.
Due to metal, master is only able to build on MacOS 10.15 and above.
The previous minimum requirement is MacOS 10.13.

It was already planned to bump to a higher version for Blender 3.6. After
a short discussion via bf-committers it was decided that it is fine to bump it for
3.5 release.

This patch cleans up the CMake files and update the minimum requirement.

With this patch the next deprecations will be listsed.
- `NSOpenGLView`, `NSOpenGLContext` is deprecated. (replaced by metal)
- `NSStringPboardType` is replaced by `NSPasteboardTypeString`
- `NSTIFFPboardType` is replaced by `NSPasteboardTypeTIFF`
- `NSFilenamesPboardType` should be replaved by multiple pasteboard items with `NSPasteboardTypeFileURL` instead.
- `NSUserNotification` should be replaced with UserNotifications.frameworks API

Deprecations will be handled in separate tasks and commits. OpenGL won't be
fixed at this moment, as it will be phased out in the future. NSStringPboardType, NSTiffPboardType & NSFilenamesPboardType
 will be provided in a single patch. NSUserNotification will also be provided in
its own patch.

Reviewed By: brecht, sergey

Differential Revision: https://developer.blender.org/D16953
2023-01-10 15:01:16 +01:00
387fc9b40b MacOS: Silence OpenGL deprecation warnings.
OpenGL is deprecated by Apple and triggers a warning when used. The goal
is that OpenGL is replaced by Metal backend, but we are not there yet.

To improve tracability of new warnings we hide deprecation warnings
when the GHOST_ContextCGL.h file is included.

NOTE: This change silences other deprecation warnings as well.
2023-01-10 14:57:23 +01:00
c6b4bd407e Cleanup: deduplicate conditions in transform code
The `t->spacetype` check is already done in `setSnappingCallback`.
2023-01-10 09:35:59 -03:00
6f38ce5a40 Fix T103679: Add missing operators in object context menu for point cloud and curves
Set origin and convert operator now accepts point cloud and new curve
object. But these operators were not added in context menu.
Support for set origin and convert operator was added in
rBadb4dd911b91, rB933d56d9e98d and rB2752a88478a8

Reviewed by: HooglyBoogly

Differential Revision: https://developer.blender.org/D16939
2023-01-10 15:27:57 +05:30
b7f5e4b1b6 Fix building on MSVC
Empty struct introduced in dad9f45561.
2023-01-10 19:04:07 +11:00
ed66321996 GHOST/Wayland: simplify logic for disconnecting monitors under Wayland
The T103586 fix effectively ran the wl_surface_listener.leave callback
to as WLROOTS based compositors doesn't run them. Remove the workaround
since it's an error in WLROOTS to be fixed upstream.

Temporarily using the wrong window scale when disconnecting a monitor
on configurations that use different DPI per monitor is a minor enough
issue that I don't think it makes sense to workaround in GHOST.
2023-01-10 17:50:29 +11:00
dad9f45561 Cleanup: move run-time members of SurfaceModifierData into a struct
Using run-time members in the surface modifier complicated code-review
and caused an unnecessary renaming in `dna_rename_defs.h`.

Also rename:
- `x` -> `vert_positions_prev`.
- `v` -> `vert_velocities`.
- `cfra` -> `cfra_prev`.
2023-01-10 17:19:30 +11:00
aaaa75f906 Fix: Failing test after combination of Mesh refactors
The mesh positions are now a span, but the convex hull didn't copy
the custom data layout to the new mesh since it assumed it didn't
need to. Moving UV maps to a generic attribute triggers this difference
in the test results.

It doesn't really make sense for the convex hull node to copy the
source mesh custom data layout at all anyway, but do it anyway
to avoid having to change the tests right now.
2023-01-10 01:01:43 -05:00
Martijn Versteegh
6c774feba2 Mesh: Move UV layers to generic attributes
Currently the `MLoopUV` struct stores UV coordinates and flags related
to editing UV maps in the UV editor. This patch changes the coordinates
to use the generic 2D vector type, and moves the flags into three
separate boolean attributes. This follows the design in T95965, with
the ultimate intention of simplifying code and improving performance.

Importantly, the change allows exporters and renderers to use UVs
"touched" by geometry nodes, which only creates generic attributes.
It also allows geometry nodes to create "proper" UV maps from scratch,
though only with the Store Named Attribute node for now.

The new design considers any 2D vector attribute on the corner domain
to be a UV map. In the future, they might be distinguished from regular
2D vectors with attribute metadata, which may be helpful because they
are often interpolated differently.

Most of the code changes deal with passing around UV BMesh custom data
offsets and tracking the boolean "sublayers". The boolean layers are
use the following prefixes for attribute names: vert selection: `.vs.`,
edge selection: `.es.`, pinning: `.pn.`. Currently these are short to
avoid using up the maximum length of attribute names. To accommodate
for these 4 extra characters, the name length limit is enlarged to 68
bytes, while the maximum user settable name length is still 64 bytes.

Unfortunately Python/RNA API access to the UV flag data becomes slower.
Accessing the boolean layers directly is be better for performance in
general.

Like the other mesh SoA refactors, backward and forward compatibility
aren't affected, and won't be changed until 4.0. We pay for that by
making mesh reading and writing more expensive with conversions.

Resolves T85962

Differential Revision: https://developer.blender.org/D14365
2023-01-10 01:01:43 -05:00
6ef8db35e7 Cleanup: clarify naming for deformed vertex positions & normals
Edit-mesh duplicator logic used a struct member vert_coords which read
as an alternative (and inconsistent) naming to vert_positions.

Rename to `vert_positions_deform` as the purpose of this value is to
assign when modifiers deform an edit-mesh.
Add `_deform` suffix to normals as well.
2023-01-10 16:43:14 +11:00
485ab42075 BLF: Improved CJK Font Preview Differentiation
Use font's OS/2 table code page range bits to help differentiate
between Korean, Japanese, Simplified & Traditional Chinese fonts.

See D16484 for details.

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

Reviewed by Brecht Van Lommel
2023-01-09 21:40:08 -08:00
d48f95d31c Cleanup: use vert_ prefix for positions of FaceDupliData_Mesh
Match VertexDupliData_Mesh.
2023-01-10 16:36:15 +11:00
fdcbad37be Fix window creation with Hi-DPI exiting under Wayland
Wayland requires the windows surface size is divisible by the surface
scale. This wasn't guaranteed when creating new temporary windows.

This meant opening the preferences could exit Blender with an error
with Hi-DPI configurations.
2023-01-10 16:27:11 +11:00
1af62cb3bf Mesh: Move positions to a generic attribute
**Changes**
As described in T93602, this patch removes all use of the `MVert`
struct, replacing it with a generic named attribute with the name
`"position"`, consistent with other geometry types.

Variable names have been changed from `verts` to `positions`, to align
with the attribute name and the more generic design (positions are not
vertices, they are just an attribute stored on the point domain).

This change is made possible by previous commits that moved all other
data out of `MVert` to runtime data or other generic attributes. What
remains is mostly a simple type change. Though, the type still shows up
859 times, so the patch is quite large.

One compromise is that now `CD_MASK_BAREMESH` now contains
`CD_PROP_FLOAT3`. With the general move towards generic attributes
over custom data types, we are removing use of these type masks anyway.

**Benefits**
The most obvious benefit is reduced memory usage and the benefits
that brings in memory-bound situations. `float3` is only 3 bytes, in
comparison to `MVert` which was 4. When there are millions of vertices
this starts to matter more.

The other benefits come from using a more generic type. Instead of
writing algorithms specifically for `MVert`, code can just use arrays
of vectors. This will allow eliminating many temporary arrays or
wrappers used to extract positions.

Many possible improvements aren't implemented in this patch, though
I did switch simplify or remove the process of creating temporary
position arrays in a few places.

The design clarity that "positions are just another attribute" brings
allows removing explicit copying of vertices in some procedural
operations-- they are just processed like most other attributes.

**Performance**
This touches so many areas that it's hard to benchmark exhaustively,
but I observed some areas as examples.
* The mesh line node with 4 million count was 1.5x (8ms to 12ms) faster.
* The Spring splash screen went from ~4.3 to ~4.5 fps.
* The subdivision surface modifier/node was slightly faster
RNA access through Python may be slightly slower, since now we need
a name lookup instead of just a custom data type lookup for each index.

**Future Improvements**
* Remove uses of "vert_coords" functions:
  * `BKE_mesh_vert_coords_alloc`
  * `BKE_mesh_vert_coords_get`
  * `BKE_mesh_vert_coords_apply{_with_mat4}`
* Remove more hidden copying of positions
* General simplification now possible in many areas
* Convert more code to C++ to use `float3` instead of `float[3]`
  * Currently `reinterpret_cast` is used for those C-API functions

Differential Revision: https://developer.blender.org/D15982
2023-01-10 00:10:43 -05:00
05ddc7daa2 Nodes: Avoid small allocations for internal links
Since internal links are only runtime data, we have the flexibility to
allocating every link individually. Instead we can store links directly
in the node runtime vector. This allows avoiding many small allocations
when copying and changing node trees.

In the future we could use a smaller type like a pair of sockets
instead of `bNodeLink` to save memory.

Differential Revision: https://developer.blender.org/D16960
2023-01-09 23:29:58 -05:00
13450c2d22 Cleanup: Clang format
Mostly bad white space from a bad find & replace in my own cleanup commit.
2023-01-09 23:26:32 -05:00
92449e634f Fix duplicate code in 63b9a57f8b 2023-01-09 23:56:14 -03:00
63b9a57f8b Cleanup: use descriptive names for transform snapping functions
activeSnap --> transform_snap_is_active
activeSnap_SnappingIndividual --> transform_snap_project_individual_is_active
activeSnap_SnappingAsGroup --> transform_snap_mixed_is_active
applySnappingIndividual --> transform_snap_project_individual_apply
applySnappingAsGroup --> transform_snap_mixed_apply

Also rearrange functions to be close to where they are used.

And use static when possible.
2023-01-09 23:45:12 -03:00
39c30f6983 Cycles: Account for negative scale when using one-sided light tree sampling
Differential Revision: https://developer.blender.org/D16952
2023-01-10 02:55:52 +01:00
c41601becd Fix T89037: Cycles: Backfacing node can be wrong for lights with negative scale
When rendering in the viewport (or probably on instanced objects, but I didn't
test that), emissive objects whose scale is negative give the wrong value on the
"backfacing" input when multiple sampling is enabled.

The underlying problem was a corner case in how normal transformation is handled,
which is generally a bit messy.

From what I can tell, the pattern appears to be:
- If you first transform vertices to world space and then compute the normal from
  them (as triangle light samping, MNEE and light tree do), you need to flip
  whenever the transform has negative scale regardless of whether the transform
  has been applied
- If you compute the normal in object space and then transform it to world space
  (as the regular shader_setup_from_ray path does), you only need to flip if the
  transform was already applied and was negative
- If you get the normal from a local intersection result (as bevel and SSS do),
  you only need to flip if the transform was already applied and was negative
- If you get the normal from vertex normals, you don't need to do anything since
  the host-side code does the flip for you (arguably it'd be more consistent to
  do this in the kernel as well, but meh, not worth the potential slowdown)

So, this patch fixes the logic in the triangle emission code.

Also, turns out that the MNEE code had the same problem and was also having
problems in the viewport on negative-scale objects, this is also fixed now.

Differential Revision: https://developer.blender.org/D16952
2023-01-10 02:55:23 +01:00
317a5f61f0 Cycles: Fix recently introduced off-by-one error in an assert
This was added in rB95696d09bc07, but I got the index wrong.
2023-01-10 02:10:20 +01:00
7bf75231e8 Nodes: Improve wording of node operator descriptions
- Avoid calling node interface items "sockets"
- Use "active" instead of "current" to be more correct
- Avoid using the same word in description and name
- A couple grammar fixes
2023-01-09 17:14:06 -05:00
71ca339fe0 GPU: Fix math lib compilation and tests on AMD drivers
- Matrix normalize overloads needs to have the vector normalize redefined.
- double underscore (anywhere in symbol name) are reserved.
- Some operation yield different result due to float imprecision. Increasing
  epsilon threshold for the failing tests.
2023-01-09 20:41:16 +01:00
b314d92e7d Fix T102942: Cycles wrong alpha for multi-layer PSD files 2023-01-09 19:05:24 +01:00
3b476d020a Cleanup: Move particle.c to C++
In order to simplify a mesh data structure refactor. See T103343
2023-01-09 12:58:23 -05:00
ec2046c38d Fix T103531: Hold split not working correctly
Incorrect offset was calculated when strip was implicitly retimed (movie
FPS does not match scene FPS). This is because strip playback rate was
not used for offset calculation at all.

Since hold offset is specifying numbers of frames to skip, but at frame
rate of the source, this could result in gap when splitting the strip.
If that occurs, gap is compensated by moving handle to frame where strip
is split.
2023-01-09 18:04:59 +01:00
Leon Schittek
891fe70d7f Fix T103739: Nodes pasted at wrong position with UI scale 2023-01-09 11:37:27 -05:00
08b2d04021 Cleanup: Use std::swap instead of macro in C++ code 2023-01-09 11:30:36 -05:00
8d2f4ddb2f Fix T103423: boolean crash on macOS Apple silicon
Thanks to Howard Trickey for finding the cause.
2023-01-09 15:39:40 +01:00
385bd0c4e9 Fix T103685: Animation on objects that are disabled is ignored
Happens, for example, when the object has animation, and disabled for
render, and animation render is performed.

The regression has been uncovered by f12f7800c2 which made it so
the dependency graph relies on runtime visibility tracking and
updates (without updating relations).

The optimization from a while ago in the ff60dd8b18 got in a way
of the visibilit updates because it removed relation between two
no-op nodes which belong to different IDs, which make the visibility
tracking impossible.

This change makes it so only relations which belong to the same
component are removed. This matches the expectations of the visibility
tracking (which, actually, also needed to happen at the moment of the
initial optimization commit). Technically, this change could introduce
some performance regression, but with the current design design of the
graph it is not really avoidable.

The idea to gain the best performance is to separate relations which
actually define the execution flow, and which are only needed to
define things like visibility dependencies.
2023-01-09 15:02:26 +01:00
f5179830a7 Cleanup: BLI Vector comment formatting, grammar 2023-01-09 08:59:34 -05:00
ca45c2dc59 Fix T103756: wrong anonymous attribute tooltip 2023-01-09 14:52:06 +01:00
29a41ed6c2 Fix T103747: crash when using rotation output of Curve to Points node 2023-01-09 14:32:02 +01:00
589cbbf0e3 Tests: test availability of new bundled Python libraries
Differential Revision: https://developer.blender.org/D16733
2023-01-09 13:42:56 +01:00
b3f664f8fb GPencil: Fix unreported Vertex Color missing in Outline Draw
When drawing using the option `Outline` the result stroke
was not using the Vertex Color option and always was converted
using material.

Now the vertex color option is used.
2023-01-09 12:40:33 +01:00
b5390a4aee Fix assert on blend file load when seek fails
Only assert seek worked as expected when it doesn't return an error.
2023-01-09 22:07:05 +11:00
f3df7b4fbd Fix T103075: Crash when using Limit textures.
Crash only occured when textures was stored in a gray scale GPU
texture and was scaled down to fit inside the given limitation.

In this case the original number of pixels were packed into the
GPU buffer, not taken into account the scaled down image. This
resulted in a buffer overflow.
2023-01-09 09:47:55 +01:00
4887401789 Usual UI messages and i18n fixes and tweaks. 2023-01-09 09:20:37 +01:00
63c985e0f7 Cleanup: format 2023-01-09 18:56:54 +11:00
59ce3b8f6b Cleanup: doxygen comment use
Avoid '\note' outside of doxygen comments.
2023-01-09 18:56:17 +11:00
02226e9069 Cleanup: spelling in comments 2023-01-09 17:41:08 +11:00
0e0139b304 Cleanup: quiet warning for unused pose_propagate_fcurve 2023-01-09 17:35:13 +11:00
4546e35c92 Fix T95244: Cycles produces incorrect AO pass for shadow catchers
Differential Revision: https://developer.blender.org/D16951
2023-01-09 03:55:10 +01:00
d8e01150d6 Fix T94752: Cycles renders stereoscopic panoramas incorrectly
The bug is caused by rBb66b3f547c43e841a7d5da0ecb2c911628339f56.
From what I can see, that fix was intended to enable manual lens shift for
panorama cameras, but it appears that it also unintentionally applies
interocular shift.

This fix disables the multiview shift for panorama cameras, that way manual lens
shift still works but we get the 2.x behavior for stereoscopic renders back.

Differential Revision: https://developer.blender.org/D16950
2023-01-09 03:55:06 +01:00
95696d09bc Fix T88849: Motion blur in cycles leaves bright edge on trailing end of blur
The code that computes and inverts the shutter CDF had some issues that caused
the result to be asymmetric, this tweaks it to be more robust and produce
symmetric outputs for symmetric inputs.
2023-01-09 03:08:36 +01:00
e7a554e551 Fix T94698: Cycles: Volume-scattered light is always counted as diffuse
At the first bounce, the diffuse/glossy/transmission weights are stored so that
contributions along the path can be split into the d/g/t indirect passes.

However, volume bounces always set the weight even at indirect bounces, so
even paths that had their first bounce on a purely glossy object would suddenly
start counting towards the diffuse indirect pass after a secondary volume bounce.
2023-01-08 23:09:37 +01:00
d11f3267cd Fix T103210: Don't Always Clear Glyphs With Zoom
Do not clear all the font's glyph caches with single-step zoom
operators if the area does not change font size when doing so.

See D16785 for more details.

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

Reviewed by Campbell Barton
2023-01-08 13:57:09 -08:00
73a2c79c07 Functions: free memory of unused sockets earlier
During geometry nodes evaluation some sockets can be determined
to be unused, for example based on the condition input in a switch node.
Once a socket is determined to be unused, that information has to be
propagated backwards through the tree to free any memory that may
have been reserved for those sockets already. This is happening before
this commit already, but in a less ideal way.

Determining that sockets are unused early is good because it helps with
memory reuse and avoids copy-on-write copies caused by shared data.
Now, nodes that are scheduled because an output became unused have
priority over nodes scheduled for other reasons.
2023-01-08 21:09:33 +01:00
891b973029 Functions: optimize multi-function evaluation in materialized mode
This allows auto-vectorization to happen when the a multi-function is
evaluated in "materialized" mode, i.e. it is processed in chunks where
all input and outputs values are stored in contiguous arrays.

It also unifies the handling input, mutable and output parameters a bit.
Now they all can use tempory buffers in the same way.
2023-01-08 17:21:57 +01:00
Jason Fielder
d3f626b535 Fix T103658: Resolve Metal partial texture update overwriting whole image when staging textures are used.
Staging texture update copied over the entire texture, rather than just the region of the texture which had been updated. Also added early-exit for cases where the net texture update extent was zero, as this was causing validation failures.

Authored by Apple: Michael Parkin-White

Ref T103658
Ref T96261

Reviewed By: fclem

Maniphest Tasks: T103658, T96261

Differential Revision: https://developer.blender.org/D16924
2023-01-08 16:18:46 +01:00
Jason Fielder
ed8f3dc9c7 Fix T103399: correctly apply SRGB framebuffer and shader conversion mode in Metal.
First binding of a framebuffer lead to an incorrect SRGB conversion state being applied, as attachments, where presence of SRGB is determined, were processed after the SRGB check rather than before.
This DIFF also cleans up SRGB naming conventions and caching of fallback non-srgb texture view, for use when SRGB mode is disabled.

Authored by Apple: Michael Parkin-White

Ref T103399
Ref T96261

Reviewed By: fclem

Maniphest Tasks: T103399, T96261

Differential Revision: https://developer.blender.org/D16907
2023-01-08 16:00:48 +01:00
Jason Fielder
b1d2ea3e1b Metal: Add gl_PrimitiveID support.
Resolves failing Mesh Snap utilities line add-on.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D16905
2023-01-08 15:43:16 +01:00
710f8164b4 Fix: crash when inserting reroute node 2023-01-08 15:19:39 +01:00
d8750aa1da Fix T103734: reroutes don't propagate attribute references correctly 2023-01-08 15:17:09 +01:00
5f9a48ed59 Functions: improve compiler optimizability of multi-function evaluation
This simplifies the code enough so that msvc is able to unroll and
vectorize some multi-functions like simple addition.

The performance improvements are almost as good as the GCC
improvements shown in D16942 (for add and multiply at least).
2023-01-08 15:04:51 +01:00
Jason Fielder
d4c085c17d Metal: Resolve failing assertions relating to memory sizing and texture swizzle.
Required texture bytesize calculation for compacted data types was incorrectly calculated, resulting in an erroneous format conversion taking place instead of direct data upload.
Metal dummy buffer size also temporarily increased to address problematic cases where the bound buffer was too small for missing UBOs.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D16904
2023-01-08 14:10:15 +01:00
ef78811ac7 Cleanup: add missing inline 2023-01-07 23:49:36 +01:00
e22247a965 Fix: crash when opening file with visible node editor
Caused by rB87fd798ae383a344d51dcbd9f66d5834595bdc5a.
2023-01-07 20:54:35 +01:00
2895c67086 Fix T103408: Cycles deadlock during GPU viewport rendering
This was caused by rB0d73d5c1a2, which releases the scene mutex during kernel
loading. However, the reset mutex was still held, which can cause a deadlock
if another thread tries to reset the session, since it will acquire the
released scene mutex and then wait for the reset mutex.

Turns out there's no point in keeping the reset mutex locked after the delayed
reset section, so now we just release it earlier, which resolves the deadlock.
2023-01-07 20:33:32 +01:00
c4d4db39dc Functions: enable more gcc optimizations for multi-functions
This mainly helps GCC catch up with Clang in terms of field evaluation
performance in some cases. In some cases this patch can speedup
field evaluation 2-3x (e.g. when there are many float math nodes).
See D16942 for a more detailed benchmark.
2023-01-07 20:23:20 +01:00
a2ea32a600 Cleanup: inline signatures into multi-function constructors
This reduces the amount of code. Also the signature should be thought
of as being setup in the constructor, so it's good if the code is there as well.
2023-01-07 18:00:37 +01:00
eedcf1876a Functions: introduce multi-function namespace
This moves all multi-function related code in the `functions` module
into a new `multi_function` namespace. This is similar to how there
is a `lazy_function` namespace.

The main benefit of this is that many types names that were prefixed
with `MF` (for "multi function") can be simplified.

There is also a common shorthand for the `multi_function` namespace: `mf`.
This is also similar to lazy-functions where the shortened namespace
is called `lf`.
2023-01-07 17:32:28 +01:00
a5b27f9858 Functions: simplify multi-function signature type
* `depends_on_context` was not used for a long time already.
* `param_data_indices` is not used since rB42b88c008861b6.
* The remaining data is moved to a single `Vector` to avoid
  having to do two allocations when the size signature becomes
  larger than fits into the inline buffer.
2023-01-07 16:51:26 +01:00
577442a26f Functions: build multi-function signature in-place
This avoids a move of the signature after building it. Tthe value had
to be moved out of `MFSignatureBuilder` in the `build` method.

This also makes the naming a bit less confusing where sometimes
both the `MFSignature` and `MFSignatureBuilder` were referred
to as "signature".
2023-01-07 16:30:56 +01:00
b3146200a8 Functions: refactor multi-function builder API
* New `build_mf` namespace for the multi-function builders.
* The type name of the created multi-functions is now "private",
  i.e. the caller has to use `auto`. This has the benefit that the
  implementation can change more freely without affecting
  the caller.
* `CustomMF` does not use `std::function` internally anymore.
  This reduces some overhead during code generation and at
  run-time.
* `CustomMF` now supports single-mutable parameters.
2023-01-07 16:19:59 +01:00
380db3edb3 Cleanup: add missing override 2023-01-07 14:43:40 +01:00
1bbf1ed03c Functions: improve devirtualization in multi-function builder
This refactors how devirtualization is done in general and how
multi-functions use it.

* The old `Devirtualizer` class has been removed in favor of a simpler
  solution. It is also more general in the sense that it is not coupled
  with `IndexMask` and `VArray`. Instead there is a function that has
  inputs which control how different types are devirtualized. The
  new implementation is currently less general with regard to the number
  of parameters it supports. This can be changed in the future, but
  does not seem necessary now and would make the code less obvious.
* Devirtualizers for different types are now defined in their respective
  headers.
* The multi-function builder works with the `GVArray` stored in `MFParams`
  directly now, instead of first converting it to a `VArray<T>`. This reduces
  some constant overhead, which makes the multi-function slightly
  faster. This is only noticable when very few elements are processed though.

No functional changes or performance regressions are expected.
2023-01-07 12:55:48 +01:00
1942d55c07 Cleanup: remove unused code 2023-01-07 12:25:46 +01:00
1a8675b48d GPU: Fix test on metal 2023-01-07 00:18:54 +01:00
ed1df2ce2b Cleanup: use slightly more efficient method to add multi-function parameter
This avoids one `GVArray` move.
2023-01-06 22:51:08 +01:00
125b283589 GPU: Add Math libraries to GPU shaders code
This implement most of the functions provided by the BLI math library.
This is part of the effort to unify GLSL and C++ syntax. Ref T103026.

This also adds some infrastructure to make it possible to run GLSL shader unit
test.

Some code already present in other libs is being copied to the new libs.
This patch does not make use of the new libs outside of the tests.

Note that the test is still crashing when using metal.
2023-01-06 22:33:23 +01:00
f7e9bc65ab Cleanup: simplify getting value of generic ValueOrField 2023-01-06 22:30:14 +01:00
e756b0fea0 Cleanup: remove dead code 2023-01-06 22:30:14 +01:00
01efcb3de2 Update RNA to User manual mappings 2023-01-06 16:29:48 -05:00
5fa694ffe1 Cleanup: BLI: Remove BLI_ENABLE_IF((is_math_float_type)) from vector API
This was limiting the use of the templates with other non internal types.
2023-01-06 21:59:14 +01:00
ba9f0d5a15 BLI: Math: Vector: Improve API documentation
Add precision about non-trivial functions.
2023-01-06 21:42:38 +01:00
73594f4c9c Cleanup: BLI: Rename vec_base to VecBase
For consistency with our codestyle and matrix class.

# Conflicts:
#	source/blender/blenlib/BLI_math_matrix_types.hh
2023-01-06 21:15:52 +01:00
8f44c37f5c Cleanup: Rename BLI_math_vec_types* files to BLI_math_vector_types
This is for the sake of consistency and clarity.
2023-01-06 20:09:51 +01:00
da2dccca61 BLI: Add [[nodiscard]] to math vector lib
This avoid silently ignoring the returned value.
2023-01-06 20:09:51 +01:00
56216e2a62 Cleanup: BLI: Rename vector compare() to is_equal() for consistency
Also rename parameters and give default value of 0 to epsilon.
This way ommiting epsilon means expecting perfect equality.
2023-01-06 20:09:51 +01:00
11ecde6a5a Cleanup: BLI: Remove BLI_ENABLE_IF((is_math_float_type)) from vector API
This was limiting the use of the templates with other non internal types
like Ceres types, xithout defining thing like that:
`template<> inline constexpr bool is_math_float_type<mpq_class> = true;`
2023-01-06 20:09:51 +01:00
940fd87e77 Fix T103615: OSL image box mapping has flipped textures
This breaks backwards compatibility some in that 3 sides will be mapped
differently now, but difficult to avoid and can be considered a bugfix.

Similar to rBdd8016f7081f.

Maniphest Tasks: T103615

Differential Revision: https://developer.blender.org/D16910
2023-01-06 19:21:33 +01:00
67e1b52568 BLI: Matrix: Fix compilation errors and wrong alignment
Auto alignment was reversed and 0 alignment is producing warning.
2023-01-06 18:30:59 +01:00
302cb349c7 Cleanup: quiet compiler warning
For some reason this resulted in a unused-variable warning (on gcc).
Think we had such false positives before when `constexpr` was used.
2023-01-06 18:04:41 +01:00
34b24fb602 BLI: use proper alignment for new matrix types 2023-01-06 17:59:23 +01:00
ddb30c4a02 Fix T103396: crash extruding creased vertex with GPU subdivision 2023-01-06 17:49:54 +01:00
e9cb96d16e Fix: Build error on windows from mismatched forward declaration 2023-01-06 11:41:36 -05:00
8a16523bf1 BLI: Refactor matrix types & functions to use templates
This patch implements the matrix types (i.e:float4x4) by making heavy
usage of templating. All matrix functions are now outside of the vector
classes (inside the blender::math namespace) and are not vector size
dependent for the most part.

###Motivations
The goal/motivations of this rewrite are the same as the Vector C++ API (D13791):
- Template everything for making it work with any types and avoid code duplication.
- Use functional style instead of Object Oriented function call to allow a simple compatibility layer with GLSL syntax (see T103026 for more details).
- Allow most convenient constructor syntax and accessors (array subscript `matrix[c][r]`, or component alias `matrix.y.z`).
- Make it cover all features the current C API supports for adoption.
- Keep compilation time and debug performance somehow acceptable.

###Consideration:
- The new `MatView` class can be generated by `my_float.view<NumCol, NumRow, StartCol, StartRow>()` (with the last 2 being optionnal). This one allows modifying parts of the source matrix in place. It isn't pretty and duplicates a lot of code, but it is needed mainly to replace `normalize_m4`. At least I think it is a good starting point that can refined further.
- An exhaustive list of missing `BLI_math_matrix.h` functions from the new API can be found here P3373.
- This adds new Rotation types in order to have a clean API. This will be extended when we port the full Rotation API. The types are made so that they don't allow implicit down-casting to their vector representation.
- Some functions make direct use of the Eigen library, bypassing the Eigen C API defined in `intern/eigen`. Its use is contained inside `math_matrix.cc`. There is conflicting opinion wether we should use it more so I contained its usage to almost the tasks as in the C API for now.

Reviewed By: sergey, JacquesLucke, HooglyBoogly, Severin, brecht
Differential Revision: https://developer.blender.org/D16625
2023-01-06 17:03:32 +01:00
e1df731c91 Cloth: precompute barycentric coordinates for collision points.
Profiling shows that this computation consumes a noticeable amount
of time, so it is worth moving it to an earlier part of the code
that is executed less frequently and is multithreaded.

Differential Revision: https://developer.blender.org/D16933
2023-01-06 17:55:02 +02:00
a3ac91da27 Cloth: share self and object collision BVH trees when possible.
Both cloth object collision and self collision use a BVH tree
representing the current cloth shape. The only difference between
them is the epsilon threshold value.

If these values are the same, it is possible to use the same tree
for both uses, thus easily reducing the overhead in the case when
both collision modes are used by the same cloth object.

Differential Revision: https://developer.blender.org/D16914
2023-01-06 17:55:02 +02:00
5cc793912e Fix T103671: memory leak in material preview render
Introduced with the fix for T103101.
2023-01-06 16:04:03 +01:00
Iliya Katueshenock
3b37538975 Fix T103663: Set material node can fail for single material
Caused by f1c0249f34, which filled the wrong value.
I have noticed several problems:
- Using a full array as single result.
- Checking single material index for 0. If we have a list of all slots,
  then we must check this in the list.
- The result was filled false. Simple fix.
- Fixed problem with incorrect recording by mask indices, not polygons.
    - Added domain specifics to names to avoid confusion.

Differential Revision: https://developer.blender.org/D16926
2023-01-06 09:35:34 -05:00
2752a88478 Object: Support converting curves object to mesh
Previously you had to use a workaround with the Object info node to get
evaluated data from the new curves object to an original editable mesh.
This commit makes it so that a curves object can be converted directly
to a mesh object if it has evaluated curves or an evaluated mesh.

Differential Revision: https://developer.blender.org/D16930
2023-01-06 09:35:34 -05:00
87fd798ae3 Nodes: Remove runtime socket location from struct
Socket locations are set while drawing the node tree in the editor.
They can always be recalculated this way based on the node position and
other factors. Storing them in the socket is misleading. Plus, ideally
sockets would be quite small to store, this helps us move in that
direction.

Now the socket locations are stored as runtime data of the node editor,
making use of the new node topology cache's `index_in_tree` function
to make a SoA layout possible.

Differential Revision: https://developer.blender.org/D15874
2023-01-06 09:35:34 -05:00
Indy Ray
a3a60e9647 Nodes: Resolve performance bottleneck with mix node updates
Improve animation playback performance in EEVEE for materials using Mix
nodes. Socket availability was being set and reset on every evaluation
of Mix nodes, during animation playback, this was causing the graph to
be marked dirty, and the whole graph being re-evaluated on every frame,
causing performance issues during playback.

Additionally, do a bit of cleanup, traversing the node sockets with
the next link to improve clarity and reduce errors. Also refactoring
`nodeSetSocketAvailability` to early out and increase clarity on no-op.

Differential Revision: https://developer.blender.org/D16929
2023-01-06 09:35:34 -05:00
e0d70e6a9d Nodes: avoid processing same node group multiple times to find textures
This removes a lot of overhead when there are node groups that are
reused a lot and only need to be processed once.
2023-01-06 15:20:21 +01:00
d05909a70c Fix T102766: Refactor liboverride diffing, by un-threading restoration step.
The reported backtrace in T102766 strongly points at some
concurrency issues within exisitng liboverride diffing code that
restores forbidden changes to reference linked data values.

This commit instead add tags to mark liboverrides/properties that need
to be restored, and do so in a separate new step of diffing, from the
main thread only.
2023-01-06 14:27:47 +01:00
0bf8b98437 Realtime Compositor: Move out of experimental
This patch moves the realtime compositor out of experimental. See
T99210.

The first milestone is finished with regards to implementing most
essential nodes for single pass compositing. It is also now documented
in the manual and no major issues are known.

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

Reviewed By: Clement Foucault
2023-01-06 14:50:39 +02:00
cc78fd4e93 Realtime Compositor: Allow limited compositing region
This patch allows the realtime compositor to be limited to a specific
compositing region that is a subset of the full render region. In the
context of the viewport compositor, when the viewport is in camera view
and has a completely opaque passepartout, the compositing region will be
limited to the visible camera region.

On the user-level, this gives the user the ability to make the result of
the compositor invariant of the aspect ratio, shift, and zoom of the
viewport, making the result in the viewport identical to the final
render compositor assuming size relative operations.

It should be noted that compositing region is the *visible* camera
region, that is, the result of the intersection of the camera region and
the render region. So the user should be careful not to shift or zoom
the view such that the camera border extends outside of the viewport to
have the aforementioned benefits. While we could implement logic to fill
the areas outside of the render region with zeros in some cases, there
are many other ambiguous cases where such a solution wouldn't work,
including the problematic case where the user zooms in very close,
making the camera region much bigger than that of the render region.

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

Reviewed By: Clement Foucault
2023-01-06 14:43:37 +02:00
Christoph Lendenfeld
5eab813fc0 Fix T102746: Jumping to next/previous (key)frame doesn't take subframes into account
Previously when on frame 2.5 and trying to jump to a
keyframe that was on frame 2, it would instead jump past it.

Now it properly respects the subframes for that.

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D16651
Ref: D16651
2023-01-06 13:38:43 +01:00
Christoph Lendenfeld
825f01b7b5 Animation: Remove While Held Pose propagate option
The "While Held" option from the Pose Propagate Operator
doesn't do anything meaningful.
After talking with the Animation Module it was decided to remove it.

In code it was called `POSE_PROPAGATE_SMART_HOLDS`

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D16771
Ref: D16771
2023-01-06 13:24:36 +01:00
ae7163007d Allocator: improve protection against false sharing
On Apple Silicon, the cache line size is 128 bytes.
2023-01-06 13:04:49 +01:00
d49b850399 Tests: run geometry nodes benchmarks multiple times to reduce noise
Ideally, we would also get variance information out of the test, but that
seems a bit more complex to implement. For now just run the test a couple
of times and average the timings.

The test now runs between 5 and 100 times, depending on how long it
to run the test once.
2023-01-06 13:04:49 +01:00
006e905957 Tests: support running benchmark when Blender prints unrelated text
I noticed that sometimes the geometry nodes benchmark would not work
if there were some left-over debug prints in the code. The reason it did
not work was because the prints were mixed with the test output print.
I also tried using explicit flusing and `atexit` for printing the test output,
but that didn't solve it. Just printing additional newlines to better separate
the test output from other printed output helped though.
2023-01-06 13:04:49 +01:00
3337838b49 Fix: retrieved writable attribute but did not write to it
This caused a warning because `attribute.finish` was not called.
2023-01-06 13:04:49 +01:00
bd36c712b9 Pose Library: while blending, use CTRL for flipping the pose
Using negative blend factors for blending in flipped poses was undesirable.
Instead, the pose blending operator now uses CTRL to flip the pose.

Negative blend values are still allowed, and cause the pose asset to be
subtracted from the current pose. It can quickly break the rig, but for
small adjustments it can be useful.
2023-01-06 11:57:44 +01:00
8556741183 Editors: Slider, add possibility to disable ctrl-for-increments
The slider component can now be told to not use CTRL for toggling stepped
10% increments. This is useful when the operator that uses the slider needs
that modifier key for its own purposes.
2023-01-06 11:57:44 +01:00
1229b96652 Fix empty asset index files after bug in asset loading
Initial error caused by 1efc94bb2f and fixed in 6a7917162c. However
the empty index files (empty as in, they contain the version number but
no assets) will have to be fixed somehow, since otherwise assets don't
show up at all for people who saved asset files in a broken version.

Delete empty index files if the modification timestamp indicates a time
when the bug was present (plus a day before and after, to address
possible time zone differences). This will basically make Blender skip
the optimization for .blend files without assets for one load, but even
then the index should still produce faster results than a completely
non-index read.

This can be removed after a while, it's just a (much needed) fix for
people who were using alpha/beta builds.

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

Reviewed by: Jeroen Bakker
2023-01-06 11:55:24 +01:00
42b88c0088 Functions: simplify multi-function parameters
The use of `std::variant` allows combining the four vectors
into one which more closely matches the intend and avoids
a workaround used before.

Note that this uses `std::get_if` instead of `std::get` because
`std::get` is only available since macOS 10.14.
2023-01-06 11:50:56 +01:00
Bastien Montagne
fc9c39e320 Fix T103242: Missing update on undo/redo for some image properties.
Issue comes from the fact that some of the image updates are handled
outside of depsgraph context (through the signal system), and therefore
completely ignored by the undo/redo code.

Now that undo/redo tries to update as little data as possible, it needs
to be aware of these changes.

As a temporary workaround, until image update is fully handled through depsgraph,
consider that IDs tagged with `ID_RECALC_SOURCE` should get their caches
cleared on undo/redo, and tag some RNA property updates of
Image/ColorSpace as such.

Reviewed By: sergey

Maniphest Tasks: T103242

Differential Revision: https://developer.blender.org/D16927
2023-01-06 11:06:27 +01:00
5c4d11d709 Bump buildbot gcc version to 11 2023-01-06 11:00:12 +01:00
b6c74b4c6f Fix T82081: Remove workaround for OCIO Unicode issue on Windows
This workaround is no longer needed and prevents our OCIO configuration
from being loaded if Blender is unpacked under a Unicode path.

Differential Revision: https://developer.blender.org/D16818
2023-01-05 20:44:52 -08:00
280502e630 Fix T103469: improve uv cylinder projection and uv sphere projection
Multiple improvements to UV Cylinder and UV Sphere projection including:

 * New option "Pinch" or "Fan" to improve unwrap of faces at the poles.
 * Support for "Polar ZY" option on "View On Equator" and "Align To Object"
 * Better handling of inputs with round-off error.
 * Improved handling of faces touching the unit square border.
 * Improved handling of very wide quads spanning the right hand border.
 * Improved accuracy near to (0, 0).
 * Code cleanup and simplification.

Differential Revision: https://developer.blender.org/D16869
2023-01-06 17:12:41 +13:00
8d0c98740a Cleanup: remove unused OffsetGpencilModifierData.object
Added as part of D15106 but was not used anywhere.
2023-01-06 14:06:37 +11:00
14fc02f91d Cleanup: spelling in comments 2023-01-06 14:00:36 +11:00
706b13959e Cleanup: use double-quotes for non-enum strings 2023-01-06 14:00:36 +11:00
cb7f97891d Cleanup: quiet shadow variable warning, unused variable 2023-01-06 14:00:36 +11:00
00a20aec07 Fix T103403: Lightgroup passes can contain lighting on shadow catchers 2023-01-06 02:33:22 +01:00
bc5337a05a Fix T103507: Distant lights partially contribute to wrong lightgroup
The the BSDF-sampling half of MIS next-event estimation for distant lights was
using the background lightgroup instead of the lamp's lightgroup.
2023-01-06 01:40:44 +01:00
4fb0eb3a6e Minor fixes after introducing special BVH traversal for self-collision.
- Add parentheses to suppress an assertion on some compilers.

- It turns out cloth self-collision math is not precisely symmetric,
  so sort the triangle index pair to restore behavior exactly identical
  to the version before the new traversal.

Follow up to rB0796210c8df32
2023-01-06 02:35:23 +02:00
0796210c8d BVH: implement an optimized self-overlap traversal.
Previously cloth self-collision and other code that wants self-overlap
data was using an ordinary BVH overlap utility function. This works,
but is suboptimal because it fails to take advantage of the fact that
it is comparing two identical trees.

The standard traversal for self-collision essentially devolves into
enumerating all elements of the tree, and then matching them to the
tree starting at the root. However, the tree itself naturally partitions
the space, so overlapping elements are likely to be mostly placed nearby
in the tree structure as well.

Instead, self-overlap can be computed by recursively computing ordinary
overlap between siblings within each subtree. This only considers each
pair of leaves once, and provides significantly better locality.
It also avoids outputting every overlap pair twice in different order.

Differential Revision: https://developer.blender.org/D16915
2023-01-05 21:46:42 +02:00
87f7b630b5 Cleanup: make format 2023-01-05 19:43:19 +01:00
084b52bcd8 Cycles: take into account IES texture node strength input for light tree
To better estimate light contribution. Note that estimating the texture
from the IES file is still missing.

Contributed by Alaska.

Differential Revision: https://developer.blender.org/D16901
2023-01-05 19:43:19 +01:00
7d712dcd0b Gpencil: Add offset(Location, Rotation, Scale) by Layer, Stroke and Material to Offset modifier
This patch adds two new panels in which users can control
offset (position, rotation, scale) by layer and by stroke number.

Use cases:
- if you want to create array of Suzannes and place them one behind 
another, in 2d mode, Z depth will be wrong. 
In 3d mode there will be Z fighting. With combination of stroke 
and layer offset we can fight this issue without touching original drawing.
- even easier way to create 2.5d environments.. 
simply draw on layers and then displace them in one panel 
instead fiddling with every layer individually

Possible improvements:
- add offset by material slot
- add step parameter, to allow displacing groups of N strokes.

{F13129598}

Reviewed By: mendio, antoniov

Differential Revision: https://developer.blender.org/D15106
2023-01-05 19:21:51 +01:00
0fb12a9c2e GPencil: Fix size difference between radial control and Brush size
Due an internal scale of the brush size done by grease pencil
draw tool (this scale factor cannot be removed), the size of the
radial control is not equal to the actual stroke thickness and
this makes the radial size displayed useless.

This patch adds a new property that allows to pass the
path of the tool path and this value is used to apply
the correct scale to the radial size.

Reviewed By: mendio, frogstomp, pepeland, brecht

Differential Revision: https://developer.blender.org/D16866
2023-01-05 19:06:22 +01:00
David Ballesteros
59ce7bf5a9 Nodes: better default name for custom node tree datablocks
Use NodeTree.bl_label instead of "NodeTree" for more descriptive name.

Implemented by Iliya Katueshenock.

Differential Revision: https://developer.blender.org/D16856
2023-01-05 18:37:58 +01:00
8a65e33d41 Pose Library: properly set hard min/max for blend factor
Since rBcommit 74c4977a the pose library blending operator can extrapolate.
This is now also reflected in the hard min/max value of the blend factor
RNA property. The soft min/max are still -1/1 to indicate normal use.
2023-01-05 17:13:01 +01:00
b099e9924e install_deps: Add building of MaterialX.
Ref. T99618
2023-01-05 17:08:45 +01:00
74c4977aea Pose Library: allow extrapolating the pose
While blending, press E to enable extrapolation / overshoot of the pose.
It will make it possible to blend in more than 100% of the pose asset.
This has the potential to completely break the rig, but it can be useful
to exaggerate poses when used with caution.
2023-01-05 16:19:45 +01:00
d1810d11f4 Fix T103303: Dbl-click in the Graph Editor wont select all keyframes
This was the case when an Annotation is also present as in the report.

Since {rB92d7f9ac56e0}, Dopesheet is aware of greaspencil/annotations
(displays its channels/keyframes, can rename their data, layers, fcurve
groupings etc.). However, the Graph Editor does not display these /
should not be aware of them.

Above commit already had issues that were addressed in the following
commits (mostly adding the new `ANIMFILTER_FCURVESONLY` to places that
dont handle greasepencil/annotations)
- {rBfdf34666f00f}
- {rB45f483681fef}
- {rBa26038ff3851}

Now in T103303 it was reported that doublicking a channel would not
select all fcurve`s keyframes anymore and this wasnt actually an issue
with that particular operator, but instead with another operator that is
also mapped to doubleclicking: the channel renaming (I assume the
keyconflict here is actually wanted behavior).
Channel renaming would not return `OPERATOR_PASS_THROUGH` here anymore
in the case nothing cannot be renamed, so we would not actually reach
the 2nd operator at all (the one selecting all keyframes).
Deeper reason for this is that the renaming operator would actually
"see" a channel that could be renamed (in the case of the report: an
annotation layer), but then cannot proceed, because the "real"
underlying data where the doubleclick happens is an fcurve...

So now exclude non-greasepencil channels in filtering as well where
appropriate by also adding `ANIMFILTER_FCURVESONLY` to the filter there.

Fixes T103303.

Maniphest Tasks: T103303

Differential Revision: https://developer.blender.org/D16871
2023-01-05 16:12:25 +01:00
2a5104e368 Cleanup: Remove compiler warnings 2023-01-05 15:59:51 +01:00
Aleš Jelovčan
a5d4c63e86 GPencil: remove multiframe copy/paste restriction
Multiframe copy paste operations were prohibited by a block of code.
While this is understandable as it prevents confusing actions, there is a good use case to allow multiframe copy pasting.

This patch does:
- remove restricting block of code
- adds outer loops for frames both in copy and paste actions.

In copy action it will create an array of selected strokes from all selected frames
In paste action it will create new from previous copy action merged to a single frame. It will paste to all selected frames and create new frame if autokey is on and time cursor is not on any of the keyframes.

The main usecase is for creating motion smears as in examples attached. The user still need to do some actions in order to achieve desired look, such as stroke ordering and deleting excessive strokes.

{F14069747}

{F14069743}

Reviewed By: antoniov, mendio

Differential Revision: https://developer.blender.org/D16805
2023-01-05 15:49:39 +01:00
3819a9b15a Fix T103614: crash during geometry nodes evaluation with tbb disabled 2023-01-05 15:36:39 +01:00
25e28f518c install_deps: Add package handling for fribidi, harfbuzz, shaderc and vulkan ICD loader.
All these are available on recent distros, don't think it's worth adding
support to build them for the time being.

Ref. T99618.
2023-01-05 14:56:24 +01:00
862d08bb97 Fix: use-after-free when threadlocal is destructed after static variable
This issue was introduced in rB78f28b55d39288926634d0cc.

The fix is to use a `std::shared_ptr` to ensure that the `Global` will live
long enough until all `Local` objects are destructed.
2023-01-05 14:38:34 +01:00
a318f3b8d6 install_deps: Add py binding for OCIO, OIIO, OpenVDB and USD.
This was quite a fight, some resulting notes:
* We cannot use anymore Boost packages because of a weird bug breaking
  Blender debug builds and ivolving Boost, TBB and USD (see also
  rB019b930d6b9c).
* OCIO, OIIO, OpenVDB and USD build options where updated to match these
  from cmake libs building.
** Most notably, USD now has imaging, OIIO, OpenVDB and GL support.

Ref. T99618.
2023-01-05 14:14:01 +01:00
2ffd08e952 Geometry Nodes: deterministic anonymous attribute lifetimes
Previously, the lifetimes of anonymous attributes were determined by
reference counts which were non-deterministic when multiple threads
are used. Now the lifetimes of anonymous attributes are handled
more explicitly and deterministically. This is a prerequisite for any kind
of caching, because caching the output of nodes that do things
non-deterministically and have "invisible inputs" (reference counts)
doesn't really work.

For more details for how deterministic lifetimes are achieved, see D16858.

No functional changes are expected. Small performance changes are expected
as well (within few percent, anything larger regressions should be reported as
bugs).

Differential Revision: https://developer.blender.org/D16858
2023-01-05 14:05:30 +01:00
4813c37ae2 Cleanup: Better const-correctness in the space clip 2023-01-05 12:40:34 +01:00
fdc918c32c Cleanup: Better const-correctness in MovieClip
Mainly make MovieClipUser constant.
2023-01-05 12:40:34 +01:00
58b6c91d36 Cleanup: Remove unused runtime field from the MovieClip
It is a part of old-standing TODO, and code which accesses
the value was commented out for many years.

Remove the field to help with an upcoming const-correctness
improvements.
2023-01-05 12:40:34 +01:00
963600ddc0 CMake: when compiler is too old, report found version
To aid in debugging the case where your compiler is too old for Blender,
actually log which version CMake found.

Before, CMake would output:
```
CMake Error at CMakeLists.txt:121 (message):
  The minimum supported version of GCC is 11.0.0
```

With the patch, it logs:
```
CMake Error at CMakeLists.txt:121 (message):
  The minimum supported version of GCC is 11.0.0, found 10.4.0
```

This has been implemented for GCC and Clang. MSVC has been explicitly
excluded, as the version numbers used for this comparison are internal
versions and not directly usable/recognisable.

Reviewed By: LazyDodo, brecht

Differential Revision: https://developer.blender.org/D16849
2023-01-05 11:34:11 +01:00
Christoph Lendenfeld
200a114e15 Fix T87548: Propagate Pose, Next Keyframe
Change the logic for propagating poses such that it checks keyframes
on all selected bones to determine the frame on which a pose
should be propagated to.
It then adds keyframes if they don't exist on whatever
frame the pose should be propagated to.

Reviewd by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D16654
Ref: D16654
2023-01-05 10:39:39 +01:00
Christoph Lendenfeld
76a68649c1 Animation: Graph Editor Ease operator
Added a new operator that aligns selected keys on an exponential curve

Revied by Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D9479
Ref: D9479
2023-01-05 10:11:24 +01:00
Damien Dh
34fa369b48 Eevee: Mark Properties on Samples Panel Animatable.
Eevee:
Mark `Scene->Sampling->Render/Viewport` samples animatable.
Mark Viewport Denoising also animatable

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D16827
2023-01-05 09:21:23 +01:00
d7598c8081 Metal: Fix crash when compiling compositor shaders.
Although viewport compositor isn't supported yet on Apple deviced the
shaderlibs are compiled. The compositor shaders uses mat3 constructor
with a single vec3 and 6 floats. This constructor wasn't defined in
metal so it failed the compilation.

This patch adds the override to mat3.
2023-01-05 08:30:41 +01:00
bfb0b1decc Cleanup: pass matrix & vector by const reference instead of value 2023-01-05 18:11:16 +11:00
77c3e0895d Cleanup: quiet -Wcomma warnings with clang 2023-01-05 17:02:43 +11:00
7690872ce4 Cleanup: quiet missing-declaration warnings 2023-01-05 16:44:33 +11:00
93fc352cfa Fix T102612: Line art crash on loading due to references to other scenes. 2023-01-05 12:43:05 +08:00
168091a1d6 Cleanup: Missing debug #ifdef for GPU_vertbuf_raw_step 2023-01-05 11:01:32 +08:00
Michael Jones
a7cc6e015c Cycles: Additional Metal kernel specialisation exposed through UI
This patch adds a new "Kernel Optimization Level" dropdown menu to control Metal kernel specialisation. Currently this defaults to "full" optimisation, on the assumption that the changes proposed in D16371 will address usability concerns around app responsiveness and shader cache housekeeping.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16514
2023-01-04 23:36:52 +00:00
496d736adc Cleanup: format 2023-01-05 11:21:51 +13:00
Iliya Katueshenock
433d436b84 Fix: sort link indices in multi input sockets incorrect
For some reason I don't understand, the dragged link is sorted across
all the node's multi-input sockets. This leads to problems when there
are multiple sockets to sort. With this patch, I'm making the feature
work more directional.

Differential Revision: https://developer.blender.org/D16892
2023-01-04 16:37:32 -05:00
224d26fd33 Geometry Nodes: Parallelize reading and writing vertex groups
Reading or writing a vertex group is expensive enough that it's worth
parallelizing. On a Ryzen 3700x, in a grid of 250k vertices with
30 randomly assigned vertex groups (each to 10-50% of vertices),
I observed a 4x improvement for writing to a group and a 3x
improvement when reading their data. This significantly speeds
up nodes that create a new mesh from a mesh that had vertex groups.
2023-01-04 16:27:54 -05:00
83f519b7c1 Functions: initialize node storage and default values on first execution
Previously, this happened when the "node task" first runs, which might
not actually execute the node if there are missing inputs. Deferring the
allocation of storage and default inputs allows for better memory reuse
later (currently the memory is not reused).
2023-01-04 18:46:50 +01:00
58f1e62871 Geometry Nodes: Parallelize deleting vertex group
Since 78f28b55d3, allocating on multiple threads is much
faster, making it a nice improvement to parallelize vertex group
operations. This patch adds multi-threading when removing a
vertex group from the "Remove Named Attribute" node.

On a Ryzen 3700x:
Before: `(Average: 15.6 ms, Min: 15.0 ms)`
After: `(Average: 8.1 ms, Min: 7.6 ms)`

Differential Revision: https://developer.blender.org/D16916
2023-01-04 12:20:32 -05:00
2540a52f91 Cleanup: quiet unused parameter warning 2023-01-04 17:30:55 +01:00
Michael Jones
77c3e67d3d Cycles: Improved render start/stop responsiveness on Metal
All kernel specialisation is now performed in the background regardless of kernel type, meaning that the first render will be visible a few seconds sooner. The only exception is during benchmark warm up, in which case we wait for all kernels to be cached. When stopping a render, we call a new `cancel()` method on the device which causes any outstanding compilation work to be cancelled, and we destroy the device in a detached thread so that any stale queued compilations can be safely purged without blocking the UI for longer than necessary.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16371
2023-01-04 16:00:53 +00:00
Germano Cavalcante
fbc2c4c331 Fix T102853: radius of spot and point lamps shares same value with area lamp size
If we change the radius of a point or spot lamp, we also change the area lamp size.

As shown in T102853, this is bad for animating the lamp type.

The solution is to make the property point to another member of the DNA
struct `Light`.

Differential Revision: https://developer.blender.org/D16669
2023-01-04 12:57:33 -03:00
20b2d6fc71 Fix T103624: Last node is skipped for cursor and link picking
I wrote the reverse iteration incorrectly in e091291b5b.
2023-01-04 10:06:17 -05:00
Germano Cavalcante
22fec7b1a4 Remove deprecated and long unused members of struct Light
The members `soft`, `bleedbias`, `bleedexp` and `contact_spread` were
deprecated in rBd8aaf25c23fa, and are no longer really used.

`soft` is only used by Collada as an extra value for exporting and
importing Blender files in collada.

`bleedexp` and `contact_spread` are only used in versioning to
initialize a default value.

Reviewed By: brecht, fclem

Differential Revision: https://developer.blender.org/D16834
2023-01-04 11:47:33 -03:00
79837c5ed4 Fix building with boost >= 1.81
In boost 1.81 they no longer implicitly include <iostream> anymore.
2023-01-04 15:23:26 +01:00
78f28b55d3 Allocator: improve multi-threaded allocation performance
Both, the guarded and lockfree allocator, are keeping track of current
and peak memory usage. Even the lockfree allocator used to use a
global atomic variable for the memory usage. When multiple threads
use the allocator at the same time, this variable is highly contended.
This can result in significant slowdowns as presented in D16862.

While specific cases could always be optimized by reducing the number
of allocations, having this synchronization point in functions used by
almost every part of Blender is not great.

The solution is use thread-local memory counters which are only added
together when the memory usage is actually requested. For more details
see in-code comments and D16862.

Differential Revision: https://developer.blender.org/D16862
2023-01-04 14:55:46 +01:00
14d7cd46ba Fix CMake configuration error with Cycles enabled and Boost diabled
This is now only an indirect dependency on shared libraries, which means
this combination is valid.

Also remove mechanism that automatically disabled WITH_BOOST if no libraries
are using it, this is no longer really helpful with shared boost libraries.
2023-01-04 14:46:40 +01:00
Jake
1c7c1480d1 Fix T92988: keymap item expanding incorrectly
"show_expanded" did not dirty the keymap diff cache, leading to old flags
being written to the item when another item was edited.

Differential Revision: https://developer.blender.org/D13418
2023-01-04 14:01:24 +01:00
1beaec46b8 Fix: implicit field socket ignored
Follow up to rB86a471efe71a84d807e682445fd73a247f196612.
2023-01-04 13:12:11 +01:00
86a471efe7 Fix: field socket not showing as field socket
This was a mistake in rB0f8487f640edd754de21cffec2dc6c9a1db7234c.
2023-01-04 12:34:41 +01:00
c9ab76db5c Cleanup: don't use designated initializers in c++
This is a c++20 feature.
2023-01-04 12:31:59 +01:00
f9ddfffd6f Cleanup: compiler warnings 2023-01-04 11:20:02 +01:00
d28588f31e Cleanup: compiler warning on Arm with sse2neon
Reorder includes to avoid BLI_simd.h redefining SSE2NEON_PRECISE macros.
2023-01-04 11:20:02 +01:00
32b861b14a Cleanup: fix deprecation warnings after OpenImageIO upgrade 2023-01-04 11:20:02 +01:00
eb7ac996cc Build: install all shared libraries regardless of build options
There are dependencies between shared libraries, and Python modules which are
always installed on Linux and macOS can use these also.

Instead of adding logic for dealing with dependencies and conditional Python
module installs, just always install everything when using precompiled
libraries. This does not affect compile time which would be the main reason to
turn off build options, and it does not affect the case where system libraries
are used.
2023-01-04 11:20:02 +01:00
65d8da97b8 Build: clear old linux centos7 cache variables instead of printing them
More automatic and convenient to update existing configurations this way.

Also move into platform_old_libs_update.cmake where similar logic was put
already.
2023-01-04 11:20:02 +01:00
bd2d7a4a81 Fix build error in debug mode due to wrong code in assert 2023-01-04 11:20:01 +01:00
Alaska
77e8e73ed9 Fix T103555: File output node saving to the wrong folder
Regression in [0], caused by reliance on BLI_join_dirfile adding a
trailing slash when an empty file was passed in.

[0]: 9f6a045e23

Ref D16888
2023-01-04 20:57:52 +11:00
cdd07ddb93 Cleanup: move doc-string to header 2023-01-04 16:06:42 +11:00
cbd12e730a Fix T103586: Crash removing monitor under Wayland & WLROOTS compositors
WLROOTS compositors don't run surface leave callbacks,
while this may be considered a bug in WLROOTS, neither GTK/SDL crash
so workaround the crash too.

This also fixes a minor glitch where the cursor scale wasn't updated
when changing monitor scale at run-time.
2023-01-04 16:04:12 +11:00
50dbedf0d8 GHOST/Wayland: add missing call to destroy xdg_output
Match logic from SDL.
2023-01-04 16:04:12 +11:00
c26616b2c1 Curves: Support boolean attribute selection type, simplifications
Use the same `".selection"` attribute for both curve and point domains,
instead of a different name for each. The attribute can now have
either boolean or float type. Some tools create boolean selections.
Other tools create float selections. Some tools "upgrade" the attribute
from boolean to float.

Edit mode tools that create selections from scratch can create boolean
selections, but edit mode should generally be able to handle both
selection types. Sculpt mode should be able to read boolean selections,
but can also and write float values between zero and one.

Theoretically we could just always use floats to store selections,
but the type-agnosticism doesn't cost too much complexity given the
existing APIs for dealing with it, and being able to use booleans is
clearer in edit mode, and may allow future optimizations like more
efficient ways to store boolean attributes.

The attribute API is usually used directly for accessing the selection
attribute. We rely on implicit type conversion and domain interpolation
to simplify the rest of the code.

Differential Revision: https://developer.blender.org/D16057
2023-01-03 23:05:29 -05:00
80639a93a8 Fix: Interface handlers crash after recent commit
The view item handler would crash when there is no active button.
2023-01-03 20:28:56 -05:00
03abc38624 Cleanup: Remove unused code in node editor 2023-01-03 20:02:43 -05:00
1d636f5e05 Cleanup: Comment formatting in node editor
Also remove an accidentally committed timing print.
2023-01-03 20:02:01 -05:00
8b1edff6b5 UI: Skip expensive view button searching when drawing
Finding the active view item button should only happen when it's actually
necessary, since looping through all buttons and blocks is an expensive
operation. This patch limits the search a bit more, to left clicks (the only
case that is actually handled).

This improves drawing performance in the node editor slightly,
where this was a bottleneck.

Differential Revision: https://developer.blender.org/D16882
2023-01-03 17:28:00 -05:00
858fffc2df Cycles: oneAPI: add support for SYCL host task
This functionality is related only to debugging of SYCL implementation
via single-threaded CPU execution and is disabled by default.
Host device has been deprecated in SYCL 2020 spec and we removed it
in 305b92e05f.
Since this is still very useful for debugging, we're restoring a
similar functionality here through SYCL 2020 Host Task.
2023-01-03 20:47:24 +01:00
7355d64f2b Node Editor: Paste nodes on mouse position
When pasting nodes with the shortcut or the context menu, place the
center of the selected nodes at the same position as the mouse cursor.
This should save time, and is more intuitive because the new nodes are
actually visible.

Based on a patch by Juanfran Matheu (@jfmatheu).

Differential Revision: https://developer.blender.org/D10787
2023-01-03 14:27:57 -05:00
e091291b5b Cleanup: Simplify node editor socket picking
The main change is returning a socket pointer instead of using two
return arguments. Also use the topology cache instead of linked lists,
references over pointers, and slightly adjust whitespace.
2023-01-03 13:42:30 -05:00
a6355a4542 Metal: Add support for all matrix types
* Add missing constructor for squared matrix types.
* Use using instead of define for typenames.
* Add `==, !=, unary-` operators
* Catch all functional style constructors inside the regex
2023-01-03 17:56:25 +01:00
ecd4533615 GPU: Texture: Fix missing cases in validate_data_format()
This was preventing some correct API usage.
2023-01-03 17:56:25 +01:00
760f2636c0 Cleanup: improve documentation of ED_area_status_text
Improve the documentation of `ED_area_status_text` by actually mentioning
what it does. Previously it only described how to disable its effects.
2023-01-03 15:19:16 +01:00
380132300e Editors: Slider, always hide the area header contents
Always hide the area header contents when the slider UI component is used.
This prevents the slider from being drawn semi-transparently on top of
other UI elements.
2023-01-03 15:17:26 +01:00
0c0cdb8010 Pose library: avoid saving the 'flipped' operator property
Avoid saving the 'flipped' operator property of the "apply pose asset"
(`POSELIB_OT_apply_pose_asset`) operator. This caused problems: when
choosing "Apply Pose Flipped" in the asset browser, double-clicking a pose
would cause it to always be flipped.
2023-01-03 14:42:08 +01:00
c82311bb8e Pose Library: allow negative blend factors to flip the pose
Interactive blending of poses can now use negative factors (i.e. drag to
the left) to blend in the flipped pose.

This reverts rB6eb1c98b15bb7ea6cf184b08617f24c7afb91b6c where the F key
was used to flip the pose. That was already described as stop-gap
measure, and the new behaviour is more intuitive & direct.

Functionality over-the-shoulder reviewed by @hjalti.
2023-01-03 13:01:41 +01:00
88748e5cbc Editors: Add 'is bidirectional' option to sliders
Add a field `is_bidirectional` to sliders (`tSlider`). By defafult this
is `false`; when set to `true` the slider allows negative values.

The allowed ranges are now:
- No overshoot, no bidirectional: `[0, 1]`
- No overshoot, bidirectional: `[-1, 1]`
- Overshoot, no bidirectional: `[0, infinity)`
- Overshoot, bidirectional: `(-infinity, infinity)`

This will be used for the pose library blending operator, where sliding
to the right (postitive) blends as normal, and sliding to the left
(negative) flips the pose before blending.
2023-01-03 13:01:41 +01:00
8dbfbac928 Nodes: add utility methods for bNodeLink and bNodeSocket
This was part of D16858.
2023-01-03 12:52:44 +01:00
1a9cf9c745 Cleanup: add missing trailing underscores for private data members 2023-01-03 12:40:23 +01:00
30753f7692 Functions: add method to iterate over all inputs of a field
This is part of D16858. Iterating over all field inputs allows us to extract
all anonymous attributes used by a field relatively easily which is necessary
for D16858.

This could potentially be used for better field tooltips for nested fields,
but that needs further investigation.
2023-01-03 12:37:18 +01:00
0f8487f640 Geometry Nodes: add more details about field handling to node declaration
This is part of D16858 but is also useful for other purposes.

The changes to the node declaration in this commit allow us to figure
out which fields might be evaluated on which geometries statically (without
executing the node tree). This allows for deterministic anonymous attribute
handling, which will be committed separately. Furthermore, this is necessary
for usability features that help the user to avoid creating links that don't
make sense (e.g. because a field can't be evaluated on a certain geometry).
This also allows us to better separate fields which depend or don't depend
on anonymous attributes.

The main idea is that each node defines some relations between its sockets.
There are four relations:
* Propagate relation: Indicates that attributes on a geometry input can be
  propagated to a geometry output.
* Reference relation: Indicates that an output field references an inputs field.
  So if the input field depends on an anonymous attribute, the output field
  does as well.
* Eval relation: Indicates that an input field is evaluated on an input geometry.
* Available relation: Indicates that an output field has anonymous attributes
  that are available on an output geometry.

These relations can also be computed for node groups automatically, but that
is not part of this commit.
2023-01-03 12:24:00 +01:00
101d04f41f Fix T103564: creating a color attribute doesn't make it active
This was the case when done via the py-API.

Now also set active_color_attribute / default_color_attribute on newly
created attributes (in case none exist yet).

Maniphest Tasks: T103564

Differential Revision: https://developer.blender.org/D16898
2023-01-03 11:36:33 +01:00
e438e8e04e Fix T102993: Incorrect icon displaying of Weighted Normal modifier in the outliner
Mistake in {rBd15e8bdaa3343cf97a74f918b2570e66fb7abfa0}

Reviewed by: JacquesLucke

Differential Revision: https://developer.blender.org/D16890
2023-01-03 14:56:11 +05:30
2e0cf17f94 Fix T103601: Crash on making Contactsheet
Python API for moving strips to and from meta strips did not invalidate
strip lookup cache. Because of that, `SEQ_get_seqbase_by_seq()` failed
to lookup origin of strip, which resulted in crash on NULL dereference.

Invalidateion was added to functions `SEQ_edit_move_strip_to_meta()` and
`SEQ_add_meta_strip()`.
2023-01-03 06:33:56 +01:00
896ad9d5d0 Cleanup: avoid F-string use in startup scripts 2023-01-03 13:26:33 +11:00
aad8f1a41b Cleanup: use compliant YAML for '.clang-format'
While clang-format could read the configuration file,
it failed to load in `pyyaml` for e.g.
2023-01-03 11:53:41 +11:00
0f2b1f9ec9 Cleanup: add missing header to CMake 2023-01-03 11:37:51 +11:00
fd068e92f1 Cleanup: use the ELEM macro 2023-01-03 11:14:55 +11:00
e39ca9d1e3 Cleanup: use function style casts for integer types in C++
Also remove redundant parenthesis.
2023-01-03 11:12:51 +11:00
75cd1fdc0a Cleanup: format 2023-01-03 11:03:50 +11:00
9a18a9bfce Cleanup: warnings from descriptions ending with a full-stop 2023-01-03 10:25:38 +11:00
0e5dab0831 Cleanup: move doc-string into header 2023-01-03 10:22:19 +11:00
bc2220733a Cleanup: spelling in comments 2023-01-03 10:19:27 +11:00
0c30873d82 Node Editor: Use the topology cache more when drawing node tree
Partly a cleanup, but also iterating over spans can be faster than
linked lists. Also rewrite the multi-input socket link counting
to avoid the need for a temporary map. Overall, on my setup the changes
save about 5% (3ms) when drawing a large node tree (the mouse house file).
2023-01-02 17:56:45 -05:00
e550d8c8fd Cleanup: Use const variables in node tree drawing 2023-01-02 17:38:12 -05:00
13ad68d100 Node Editor: Avoid allocations for socket tooltip button arguments
Small memory allocations are a bottleneck when drawing large node trees.
Avoid them by passing the socket index in the whole tree and getting the
tree from the context rather than allocating structs for the tree, node,
and socket. The performance improvement will be a few percent at most.
2023-01-02 17:07:49 -05:00
0bc0e3f9f7 Fix: geometry nodes crashes with large trees
This was an oversight in rBdba2d828462ae22de5.
The evaluator uses multiple threads to initialize node states
but it is still in single threaded mode.
`get_main_or_local_allocator` did not return the right allocator
in this case.
2023-01-02 18:34:01 +01:00
9144b110ee Pose Library: recreate pose backup when flipping pose
During pose blending, when flipping the pose with {key F}, the pose
backup needs to be recreated. Without this, the blending wouldn't be
done properly.

F-for-flipping was introduced in rB6eb1c98b15bb7ea6cf184b08617f24
2023-01-02 18:29:35 +01:00
b386932dbb Cleanup: clarify overshoot options of tSlider
Just some extra comments, no functional changes.
2023-01-02 18:07:22 +01:00
6eb1c98b15 Pose Library: press F while blending to flip the pose
While blending poses from the pose library, press {key F} to flip the
pose.

Since rBc164c5d86655 removed the "Flip Pose" checkbox, there was no more
way to blend poses flipped.

Note that this is a bit of a stop-gap measure. The goal is to have a
bidirectional blend slider, where dragging to the left flips the pose,
and dragging to the right blends it normally.
2023-01-02 18:02:36 +01:00
c74acb62b9 Cleanup: remove outdated TODO comment 2023-01-02 17:49:45 +01:00
90f194616b Depsgraph: clear update flags when skipping through no-op nodes.
As an optimization, dependency graph evaluation skips through
no-op nodes at the scheduling stage. However, that leaves update
flags enabled on the node, and the most problematic one is the
USER_MODIFIED flag, which get flushed to children every time
the no-op node is tagged.

This in turn can cause simulation caches downstream to be
permanently stuck in an outdated state until the depsgraph
is rebuilt and the stuck flag cleared out.

Differential Revision: https://developer.blender.org/D16868
2023-01-02 18:17:16 +02:00
ebec9eb75e Fix T103118: depsgraph issues for bbone property drivers on non-bbones.
The BONE_SEGMENTS operation node is only created if the bone is
actually a B-Bone. One location in the code wasn't checking that
before trying to create a relation.
2023-01-02 18:17:16 +02:00
0efb79fb74 Geometry Nodes: Multithread transforming instances and point clouds
Add multithreading when transforming and translating instances
and point clouds in the Transform Geometry node.
2023-01-02 11:16:37 -05:00
adb4dd911b Point Cloud: Support set origin and apply scale operators
Move some functions for transforming a span of vectors to a header
and call them from these functions, just like was done for curves
objects recently.

Resolves T102027, T102026

Differential Revision: https://developer.blender.org/D16883
2023-01-02 10:49:57 -05:00
4ae8c52a95 Fix: Set active color attribute copy & paste mistake 2023-01-02 10:41:17 -05:00
94155fb6ff Anim: expose pose blending & backup system to RNA
Expose `BKE_pose_apply_action_blend` and a simplified pose backup system
to RNA. This will make it possible to easily create some interactive
tools in Python for pose blending.

When creating a backup via this API, it is stored on the
`Object::runtime` struct. Any backup that was there before is freed
first. This way the Python code doesn't need access to the actual
`PoseBackup *`, simplifying memory management.

The limitation of having only a single backup shouldn't be too
problematic, as it is meant for things like interactive manipulation of
the current pose. Typical use looks like:

- Interactive operator starts, and creates a backup of the current pose.
- While the operator is running:
    - The pose backup is restored, so that the next steps always use the
      same reference pose.
    - Depending on user input, determine a blend factor.
    - Blend some pose from the pose library into the current pose.
- On confirmation, leave the pose as-is.
- On cancellation, restore the backup.
- Free the backup.

`BKE_pose_apply_action_blend` is exposed to RNA to make the above
possible.

An alternative approach would be to rely on the operator redo system.
However, since for poses this would use the global undo, it can get
prohibitively slow. This change is to make it easier to prototype
things; further into the future the undo system for poses should be
improved, but that's an entire project on its own.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D16900
2023-01-02 16:39:51 +01:00
da4e2fe7fe OBJ: in exporter faces loop, move material index accessor outside of the loop
While the cost of creating AttributeAccessor and finding the "material_index"
attribute is not large, there's really no need to do that for each
polygon. Move the access outside of the per-polygon loop.
2023-01-02 16:15:34 +02:00
eaef8d50bc Fix T102672: OBJ exporter "material groups" option wrong for objects with >32k faces
Turns out, using the wrong output buffer (global one, instead of
per-thread one) puts the data into the wrong buffer! Fixes T102672
2023-01-02 16:15:34 +02:00
46c1cddabd Cleanup: anim, add some more documentation to the pose backup code
Just some more docs, to be clear about functionality and, most importantly,
pointer ownership.

No functional changes.
2023-01-02 15:00:58 +01:00
9d2ab1f8d3 Refactor: anim, move pose backup code from editors into blenkernel
Move `pose_backup.cc` from `editors/armature` to `blenkernel`. This is
in preparation of an upcoming change where the pose backup is going to be
owned by the `Object`. This will need to be automatically cleared when the
object is freed, which means that `blenkernel` needs the corresponding
logic.

Technically only the freeing code could be moved, but I felt it made more
sense to keep the related code together.

No functional changes.
2023-01-02 14:41:04 +01:00
153e1dc31a Fix T103513: Images lose their alpha channel when OSL is enabled for GPU Compute
The "osl_texture" intrinsic was not implemented correctly. It should handle alpha
separately from color, the number of channels input parameter only counts color
channels.
2023-01-02 13:52:59 +01:00
68906c605f Fix T103080: Regression: Setup tracking scene is disabled
There are two underlying issues which got uncovered by the report:

First, is that the poll() function for the operator was using legacy
API which is on its way of removal in the next major version release.

This part is fixed in this patch based on a patch provided by Philipp
Oeser (P3389) with the modification that the `clip` is not accessed
prior to None check. Ended up in a bit annoying one-liner, the entire
function could be refactored to use early returns.

The second issue is that the Python access to the legacy property
was wrong: need to access camera reconstruction instead of accessing
deprecated DNA field.
2023-01-02 12:44:10 +01:00
a4e843c250 Cleanup: resolve variable ‘update’ set but not used warning
Resolve `variable ‘update’ set but not used` compiler warning, by removing
the variable altogether.

No functional changes.
2023-01-02 11:14:19 +01:00
7e5a7928ca Cleanup: resolve 'no previous prototype' warning
Resolve `warning: no previous prototype for ‘gpencil_layer_new_name_get’`
by marking it as `static`.

No functional changes.
2023-01-02 11:14:17 +01:00
4924f8cffd Cleanup: format 2023-01-02 11:53:40 +13:00
3277879085 Fix T103441: make OBJ importer ignore any unrecognized trailing per-face index data.
Some files out there (e.g. in T103441) contain face definitions with
four indices, which the importer code was not expecting. The OBJ
standard spells out up to three indices per face corner; the file in
there must be using some sort of non-standard OBJ syntax extension.
Now the code simply ignores any trailing per-face-corner data.
2023-01-01 19:30:20 +02:00
8007f7e74f Fix T103212: ignore OBJ UV indices if no UVs are present
Similar to T98782 that was about normal indices: some files out there
are technically "wrong" since they refer to UV indices, without ever
defining any UVs. If the file does not have any UVs, simply ignore UV
indices in the OBJ face definitions. Fixes T103212.
2023-01-01 19:14:37 +02:00
Kevin C. Burke
614704f90c GPencil: Removing 'Only Show Selected' Requirement for DOPESHEET_HT_editor_buttons
It's confusing for users when the Dopesheet's Editor Buttons for Grease Pencil are greyed out.
{F14099985}

[[ https://blenderartists.org/t/cant-create-new-layers-in-grease-pencil-dopesheet/1353882 | Can’t create new layers in grease pencil dopesheet ]]

This is often because the 'Only Show Selected' filter is disabled. This 'requirement' does not seem to be necessary since the Dopesheet is already in Grease Pencil mode and there is an active Grease Pencil Object. It is also not apparent as to why so many Operators depend on it and unintuitive that it controls their function. The 'Only Show Selected' filter button is far away from the Operator buttons in the User Interface Header, so it's difficult to make the association.

If the 'Only Show Selected' IS absolutely required, I believe it should be closer to the DOPESHEET_HT_editor_buttons. Otherwise, I think the requirement should be removed.

Reviewed By: antoniov

Differential Revision: https://developer.blender.org/D16885
2022-12-31 16:26:39 +01:00
Kevin C. Burke
17d66fe79e GPencil: 'Delete Duplicate Keyframes' in GPENCIL_MT_cleanup Menu
The command text 'Delete Duplicated Frames' used in the `GPENCIL_MT_cleanup` menu is not correct grammar for what the command does. Keyframes removed by this command may be duplicate keys without having been duplicated. It also does not match the name of the command in `DOPESHEET_MT_context_menu`.
[[ https://developer.blender.org/diffusion/B/browse/master/release/scripts/startup/bl_ui/space_dopesheet.py$676 | space_dopesheet.py ]]

This patch fixes the grammar, gets the command's text to match the `DOPESHEET_MT_context_menu`, and corrects the description in the [[ https://docs.blender.org/api/current/bpy.ops.gpencil.html#bpy.ops.gpencil.frame_clean_duplicate | Python API documentation ]].

Reviewed By: antoniov

Differential Revision: https://developer.blender.org/D16887
2022-12-31 16:25:16 +01:00
f891ddd98d Cleanup: Use indices in curve to mesh, decrease variable scope 2022-12-30 23:52:44 -05:00
3340cc8102 Nodes: add asserts to detect invalid links earlier 2022-12-30 14:35:15 +01:00
9cef74f58b install_deps.sh: Enable NVPTX backend for LLVM (and OSL).
Based on suggestion from Ray molenkamp (@LazyDodo), thanks.

Also fix patching of OSL code, would not work properly when using repo
checkout instead of archive download.

Re. T99618.
2022-12-30 14:43:18 +09:00
c8741a3c03 Cleanup: Simplify node clipboard, use Vector instead of ListBase
- Move from blenkernel to the node editor, the only place it was used
- Use two vectors instead of ListBase
- Remove define for validating the clipboard, which shouldn't be skipped
- Comment formatting, other small cleanups to whitespace

Differential Revision: https://developer.blender.org/D16880
2022-12-29 16:40:29 -05:00
81935098f1 Fix: Debug build failure after recent variable name change 2022-12-29 15:36:33 -05:00
83b103fd2f Geometry Nodes: use static instead of dynamic cast
In my (fairly extreme) test file this results in a 6% speedup.
The assumption that the dynamic cast would succeed was in place
before already.
2022-12-29 21:13:52 +01:00
dba2d82846 Geometry Nodes: avoid using enumerable thread specific on single thread
The geometry nodes evaluator supports "lazy threading", i.e. it starts out
single-threaded. But when it determines that multi-threading can be
benefitial, it switches to multi-threaded mode.

Now it only creates an enumerable-thread-specific if it is actually using
multiple threads. This results in a 6% speedup in my test file with many
node groups and math nodes.
2022-12-29 21:05:58 +01:00
c744d5453f Nodes: Make more node and socket declaration fields public
When these declarations are built without the help of the special
builder class, it's much more convenient to set them directly rather
than with a constructor, etc. In most other situations the declarations
should be const anyway, so theoretically this doesn't affect safety too
much. Most construction of declarations should still use the builder.
2022-12-29 14:56:04 -05:00
a09accb496 Geometry Nodes: speedup compute context hash generation
Whenever a node group is entered during evaluation, a new compute
context is entered which has a corresponding hash. When node groups
are entered and exited a lot, this can have some overhead. In my test
file with ~100.000 node group invocations, this patch improves performance
by about 7%.

The speedup is achieved in two ways:
* Avoid computing the same hash twice by caching it.
* Invoke the hashing algorithm (md5 currently) only once instead of twice.
2022-12-29 20:46:05 +01:00
5dcce58510 Cleanup: Use simpler vector for dragged node links
Use a vector of node links instead of pointers to node links allocated
separately. Only allocate a link if it's added (back) to the tree.
2022-12-29 14:09:58 -05:00
4d39b6b3f4 Geometry Nodes: skip logging socket values for invisible trees
Geometry nodes used to log all socket values during evaluation.
This allowed the user to hover over any socket (that was evaluated)
to see its last value. The problem is that in large (nested) node trees,
the number of sockets becomes huge, causing a lot of performance
and memory overhead (in extreme cases, more than 70% of the
total execution time).

This patch changes it so, that only socket values are logged that the
user is likely to investigate. The simple heuristic is that socket values
of the currently visible node tree are logged.

The downside is that when the user changes the visible node tree, it
won't have any logged values until it is reevaluated. I updated the
tooltip message for that case to be a bit more precise.
If user feedback suggests that this new behavior is too annoying, we
can always add a UI option to log all socket values again. That shouldn't
be done without an actual need though because it takes up UI space.

Differential Revision: https://developer.blender.org/D16884
2022-12-29 19:36:36 +01:00
363e5e28ee DRW: Fix issues with multiview
Resource ids buf must be allocated for the worst case scenario.
Also fix issue with non procedural data overriding procedural view.
2022-12-29 18:23:39 +01:00
2652029f3b Cleanup: Clang tidy
Addressed almost all warnings except for replacing defines
with enums and variable assignment in if statements.
2022-12-29 12:01:32 -05:00
31f2242691 Fix T103520: Incorrect selection in paint mode operators
Read the selection attribute on the proper domain using implicit
interpolation rather than just using its oiginal domain that might
not match the domain of the color attribute.
2022-12-29 10:59:10 -05:00
b6ca942e47 Functions: support cycles in lazy-function graph
Lazy-function graphs are now evaluated properly even if they contain
cycles. Note that cycles are only ok if there is no data dependency cycle.
For example, a node might output something that is fed back into itself.
As long as the output can be computed without the input that it feeds into,
everything is ok.

The code that builds the graph is responsible for making sure that there
are no actual data dependencies.
2022-12-29 16:39:40 +01:00
47b9ed2409 Cleanup: Rename flag for node socket link status
"Is linked" is much clearer than "in use"
2022-12-29 10:30:47 -05:00
887105c4c9 Cleanup: Use inline function for node socket visibility
This may very slightly improve performance too, the old function
was showing up in profiles when it shouldn't, since it's so small.
2022-12-29 10:30:46 -05:00
2bd8c67d10 Cleanup: Rename function create_new_layer_dialog
* Renamed function to include `ED_gpencil_` prefix.
* Removed redundant `else`.
2022-12-29 16:12:20 +01:00
Aleš Jelovčan
f53bb93af9 GPencil: Rename popup on Change active layer -> New Layer
This patch adds rename popup when using Y key to switch 
active layer and choosing New layer in Draw mode.
It follows https://developer.blender.org/D15092, which introduced this 
for moving selected strokes to layers in Edit mode.

Reviewed By: antoniov

Differential Revision: https://developer.blender.org/D16877
2022-12-29 16:12:20 +01:00
7e4f988072 BLI: improve node graph export in dot format
This makes it bit easier to export node graphs and also allows for
more customization of links and sockets.
2022-12-29 15:09:52 +01:00
cc48610d2c BLI: improve support for using vectors as hash table keys
To support this, I had to add comparison and hashing functions for
vectors or sequences more generally.
2022-12-29 15:00:04 +01:00
72b4f91914 Fix T103526: crash when subsurface connects to Shader to RGB
This was caused by {rB7b82d8f029cd1088efd5fbb8bf}.
2022-12-29 14:19:50 +01:00
8c194e1ba6 Cleanup: format 2022-12-29 20:49:08 +13:00
4e027fdde6 update_deps.sh: Update OSL and USD for Blender 3.5.\
OSL: 1.13-dev-1a7670600c8b08c2443a78d03c8c27e9a1149140
USD: 22.11

Re. T99618.
2022-12-29 15:33:42 +09:00
9e332b113b install_deps.sh: Update OIIO, OpenVDB, OSD and OCIO for Blender 3.5.
OIIO: 2.4.6.0
OpenVDB: 10.0.0
OSD: 3.5.0
OCIO: 2.2.0

NOTE: Had to fight OpenVDB to force it to use 'deprecated' TBB 2020, it
really wants to use oneTBB when it can find it.

Re. T99618.
2022-12-29 12:56:46 +09:00
6347562fb0 install_deps.sh: Update python, numpy and boost for 3.5.
- Python: 3.10.9
- NumPy: 1.23.5
- Boost: 1.80.0

Re. T99618
2022-12-29 11:03:51 +09:00
c9b06505d8 Cleanup: Grammar in comments
"spend" is a verb, not a noun.
2022-12-28 20:39:14 -05:00
3176b113e4 Geometry Nodes: Reduce socket logging overhead
Use socket indices to keep track of logged values instead of their
identifiers. This decreases memory pressure when there are many
sockets. In cases with many cheap nodes, this can give a relatively
large improvement to overall performance. We observed a 15% increase
in a case with many math nodes and a larger increase in an experimental
softbody node setup. The log is invalidated when we add/remove/move
sockets anyway.
2022-12-28 20:37:16 -05:00
8c6fe60844 Cleanup: Use const parameters for node poll functions
This requires a const cast in RNA, but it really is wrong
to change the nodes and node trees in these callbacks.
2022-12-28 20:15:41 -05:00
d7dad425c0 Nodes: Make socket declaration member variables public
This is the best way I found to make building socket declarations without
the builder helper class work. Besides a vague hope for non-leaky
abstractions, I don't think there's any reason for these fields not to be
accessible directly.

Ref D16850
2022-12-27 11:50:17 -05:00
6aad3c7297 GPencil: Show Display Cursor popover for Eraser
The Eraser tool was not showing the display cursor popover.

This commit fixes this inconsistency.
2022-12-27 16:45:17 +01:00
87594726ab Cleanup: Improve documentation in Curves DNA header 2022-12-27 10:31:49 -05:00
b6a11ae7d5 Cleanup: Warning in debug console due to full stop in description
Fix warning generated due to the full-stop in the description message of
the property `use_auto_mask`

Property added in: rBa9cb66b856e80d0542a9ad3fec0b0fb47d28f805
2022-12-27 15:40:13 +05:30
a2cf9a8647 GPencil: Display real brush cursor size always
Remove the option to display the real size of the cursor
and set as default. Now the cursor is displayed or not using
show_cursor option, but if it's displayed always use the real size.
2022-12-27 10:26:28 +01:00
3adbe82e07 GPencil: Extract function to calculate cursor size
This function will be used in other areas of Blender.
2022-12-27 10:26:28 +01:00
dce7917717 Sculpt: Invert Expand behavior for masking consistency
This patch makes sure that each of the expand keymap entries will use consistent "invert" and "use_mask_preserve" properties.

Based on previous discussions we decided to flip the default Mask Expand behavior.
This has multiple benefited:

- The mask creation is more consistent with other masking tools (Always add to existing mask. Mask selected areas)
- It's easier to use expanding for masking face sets (Snapping with `Ctrl`) or building a mask from repeated operations
- It's less likely to mask certain areas unintentionally (Loose mesh islands)
- If the current behavior is desired for an expand operation the user can use `E` & `F` in the modal keymap (Which is less often the case).

If we want to revisit the original design of inverted masking again in the future we should do this via {T97903}.

Reviewed By: Joseph Eagar
Differential Revision https://developer.blender.org/D16434
Ref D16434
2022-12-26 21:46:33 -08:00
a9cb66b856 Sculpt: Fix expand invert mode
* Invert mode now properly subtracts from mask
* Added an "auto-create" mode to automatically
  fill in the mask if everything is unmasked.
2022-12-26 21:43:08 -08:00
204de8c6db Sculpt: fix T103156: Scale square brush uvs by sqrt2.
Scale texture coordiantes for square brushes by sqrt2,
proportionally to how square they are (how close
tip_roundness is to zero).

Note: this is done in `calc_brush_local_mat()`, the
result of which appears to be used exclusively for
texture mapping.
2022-12-26 21:03:26 -08:00
Iliya Katueshenock
997eb77fd4 Fix T103453: Don't allow call Attribute Convert operator in edit mode
Don't allow calling Attribute Convert operator in edit mode.
Right now BMesh does not support attribute operations.

Differential Revision: https://developer.blender.org/D16864
2022-12-26 14:49:20 -05:00
Iliya Katueshenock
5206d72dca Cleanup: Remove boolean template instantiation in Blur node
The node doesn't support blurring boolean attributes, so avoid
compiling an implementation for boolean data.

Differential Revision: https://developer.blender.org/D16867
2022-12-26 14:46:21 -05:00
Jamell Moore
a7cec5a4db Fix T103011: Exact boolean skips copying edge custom data layers
When converting from imesh to mesh for the final result, custom
data should be copied from ALL operands including the main mesh.

Differential Revision: https://developer.blender.org/D16854
2022-12-26 14:43:32 -05:00
7911954b40 Fix T103452: Active & default color attributes reset on modifier apply
I missed adding the "convert type/domain to mask" macros.
Also refactor slightly to split the matching attribute test to a
separate function to ease debugging and reduce duplication.
2022-12-26 10:49:21 -05:00
6b9825e6f7 Fix T103463: Repeat last crashes in node editor
ae886596a0 tried to retrieve keymap data from a null pointer.
2022-12-26 10:17:51 -05:00
7be5ca63ae Python API Docs: explain the CANCELLED return code of operators.
The effect of CANCELLED on the undo stack is quite obscure, and
mistakenly using it after doing some changes causes confusing
behavior. It's better to describe it explicitly in the docs.
2022-12-26 14:47:38 +02:00
cb93433a56 Band-aid fix crash when appending an overridden collection from T103062.
This commit addresses that specific case related to Collection ID type,
using a band-aid fix which is hopefully safe enough.

T103062 will remain open as a TODO task for a proper fix later.
2022-12-26 20:34:40 +09:00
87cf495860 Fix cloth regression after removing mvert pointers in Mesh.
This is an obvious editing mistake introduced in 05952aa94d,
resulting in incorrect vertex coordinates used when raycasting
for internal springs with a rest shape key.
2022-12-26 11:16:33 +02:00
9e0feec0d3 Fix T103421: Library weak reference generates "Could not find .blend" errors when "Find Missing Files".
Do not consider weak references in `BKE_bpath_missing_files_find`, just
as already done in `BKE_bpath_missing_files_check`.
2022-12-26 16:31:25 +09:00
32b1947be2 Fix T103389: Invalid flags in default_material_surface->nodetree->tag.
There are still codepaths that can create embedded IDs with `NO_MAIN`
tag. Related to T88555 TODO.
2022-12-26 16:22:50 +09:00
09ba00974f Fix recent liboverride diff report refactor.
In rBfcddb7cda766 I forgot to update part of the whole diffing chain,
effectively breaking the report flags propagation from any sub-structs
of RNA IDs structs.
2022-12-25 20:01:59 +09:00
00b3f863b8 Curves: Remove option to disable selection
Remove the redundant option to disable selection in order to simplify
the tools and UI, both conceptually and internally.

It was possible to disable curves selection completely by clicking on
the active selection domain. However, that was redundant compared to
just selecting everything by pressing "A". The remaining potential use
could have been saving a selection for later, but that can be done with
more complete attribute editing tools in the future.
2022-12-24 16:09:40 -05:00
8fab53c023 BLI: add last time to scoped averaged time 2022-12-24 14:01:05 +01:00
e1180bfdb2 GPencil: Use Material or Vertex Color for Brush cursor
The color of the brush cursor is changed depending
of the mode selected.

If the mode is stroke vertex color, use vertex color, otherwise
it uses material stroke color.
2022-12-24 11:37:21 +01:00
14667de65b Fix uninitialized ColorSceneLinear4f occuring in certain situations.
On gcc 11.3, Ubuntu 22.04 the default constructor for
ColorSceneLinear4f did not zero the r,g,b,a member variables. Replacing
the empty constructor with a default constructor circumvents this
problem (compiler bug? ) even though it *should* be more or less
equivalent.
2022-12-24 10:39:22 +01:00
4701421dbe UI: Remove unused light object panel (Correction)
This panel showed a duplication of options that were in the main light panel and only mistakenly shows up in the workbench engine where lights should have no options.

This panel was also used by the POV-Ray add-on but that was removed recently.
2022-12-23 19:06:29 -05:00
014d0a8ede Update RNA to User manual mappings 2022-12-23 19:00:02 -05:00
fea60eccbf UI: Remove unused light object panel
This panel showed a duplication of options that were in the main light panel and only mistakenly shows up in the workbench engine where lights should have no options.

This panel was also used by the POV-Ray add-on but that was removed recently.
2022-12-23 18:58:48 -05:00
Sietse Brouwer
a44c128482 GPencil: show brush size in Draw tool cursor
When drawing strokes in Grease Pencil, it was always a bit hard
to predict how thick the strokes would be, because there was
no visual reference of the thickness in the cursor.
This patch adds that visual reference. It shows the brush size
as a circle in the draw cursor.
Showing the brush size can be toggled in the Cursor menu
of the Grease Pencil draw tool.

Request in RCS with 26 upvotes for this option:
https://blender.community/c/rightclickselect/0zfbbc

On the technical side: the brush size is calculated
in 3D space and takes zoom level into account, as well as
object/layer transfrom, layer thickness change (gpl->line_change)
and thickness scale (gpd->pixfactor).

Reviewed By: mendio, antoniov

Differential Revision: https://developer.blender.org/D16851
2022-12-23 16:02:54 +01:00
b024577452 Fix: dangling attribute name pointer 2022-12-23 13:16:42 +01:00
2838d9324d Cleanup: clang format
Missed in rB15c433d7d564.
2022-12-23 12:04:56 +01:00
Eimear Crotty
a521960fdd Fix T103426: Crash on Insert Keyframe
Add required additional_info to shader using gpu_shader_point_uniform_color_aa_frag.glsl. This is the only other reference to the shader which requires the additional_info to be added.

{F14085803}

Reviewed By: #eevee_viewport, fclem

Maniphest Tasks: T103426

Differential Revision: https://developer.blender.org/D16853
2022-12-23 11:39:49 +01:00
a8aae66f0e Asset Browser: New catalog menu
This replaces the old Edit menu, creating a menu only for catalog
operators. The Undo/Redo were already working only for catalogs, so now
this is more clear.

The menu also contains the Save and New catalog operators.

Differential Revision: https://developer.blender.org/D16820
2022-12-23 11:31:38 +01:00
834ca5d682 GPU: Fix Shader Builder stubs after removal of UNUSED macro in C++
This was introduced by rBfb7f12dc4078
2022-12-23 11:19:04 +01:00
fb8778a28c Fix T103394: default/active color status lost after remeshing
Caused by rB6514bb05ea5a.

For the remeshing, we have to make sure these names are brought over
each time a mesh is made from another in the process.

This happens when reprojecting the colors in
`BKE_remesh_reproject_vertex_paint` and also again in
`BKE_mesh_nomain_to_mesh`. A bit unsure if this should happen as deep as
in `BKE_mesh_nomain_to_mesh` (if not, this can be isolated to
`voxel_remesh_exec`), but I would assume other callers of
`BKE_mesh_nomain_to_mesh` would actually benefit from it, too?

Maniphest Tasks: T103394

Differential Revision: https://developer.blender.org/D16847
2022-12-23 09:18:33 +01:00
f803a0a95b Sculpt: Fix T103341: Move sculpt overlay flags to View3DOverlay.flag
"Show mask" and "Show face sets" were being stored in
`Sculpt`, yet their opacities are in `View3dOverlay`.
Now `View3DOverlay` has the flags too.
2022-12-22 16:56:50 -08:00
Philipp Oeser
15c433d7d5 Fix: Missing UI context members after recent refactor
Caused by 7d7e90ca68.

When accessing context members from the windowmanager context
(`C->wm.store` which is mainly used for UI related stuff) the above
commit broke behavior in `CTX_store_ptr_lookup` in that it changed and
would **always** return NULL if no type is passed in. The call to
`CTX_store_ptr_lookup` from `ctx_data_get` **always** passes in NULL
though.

Accessing other context members survived since they take a different
code path in `ctx_data_get` and dont use `CTX_store_ptr_lookup`.

Now also return the entry if a NULL type was passed as it was before.

Fixes T103370, T103405, T103417

Differential Revision: https://developer.blender.org/D16840
2022-12-22 16:14:41 -05:00
Damien Picard
d9510f02c8 Animation: separate constraint owner space descriptions for objects
Until now the owner spaces in the object constraint properties used the
same descriptions as the target spaces, unlike bone constraints.

For instance, if you chose World Space as owner space, you'd get the
description: "The transformation of the target is evaluated relative to
the world coordinate system".

Reuse the existing descriptions from the bone constraints instead, so
now you get: "The constraint is applied relative to the world coordinate
system".

Reviewed By: sybren

Maniphest Tasks: T43295

Differential Revision: https://developer.blender.org/D16747
2022-12-22 16:53:51 +01:00
Eimear Crotty
a7ad2dea62 Fix T97394: single points are brighter than stroke in 3D viewport
Convert 3D point shader fragment color from sRGB space to framebuffer space to match 3D line shader.

Reviewed By: fclem

Maniphest Tasks: T97394

Differential Revision: https://developer.blender.org/D16831
2022-12-22 14:22:56 +01:00
7d2dbe7849 DRW: Pass: Add bind_ssbo for indexbuf
This is a simple wrapper to GPU_indexbuf_bind_as_ssbo.
Add simple recording test for and fix other test.
2022-12-22 14:19:58 +01:00
dc30c9971d Anim: clarify the "Clear Motion Paths" operators
Make the "Clear Motion Paths" operators more intuitive. Previously, the
only way to clear the motion path of the selected object/bone would be
to shift-click the "Clear ALL Motion Paths" button. Now there are two
"X" buttons, one for "selected" and one for "all".

The "Clear Selected" and "Clear All" buttons align with the
corresponding "Update Selected" and "Update All" buttons.
2022-12-22 12:46:19 +01:00
4d22a517c9 Cleanup: animation, refactor motion paths UI code
Simplify the UI code for the motion paths properties panel.

No functional changes.
2022-12-22 12:38:46 +01:00
e4e17cf1df Anim: change wording of Clear Motion Paths operator
Change the wording of `OBJECT_OT_paths_clear` and `POSE_OT_paths_clear`
tooltips, so that they mention "motion path" instead of "path cache".
2022-12-22 12:08:56 +01:00
b617ddc004 Anim: rearrange the motion paths panel
Move the "Calculation Range" property above the "Frame Range" properties,
as you have to select the former before adjusting the latter.
2022-12-22 11:10:35 +01:00
0bcfe2788d Fix T103376: Grease pencil frames selected from python are not updated in the dopesheet
Differential Revision: https://developer.blender.org/D16832
2022-12-22 09:59:28 +01:00
cef5841e12 Cmake: Fix building with WITH_WINDOWS_BUNDLE_CRT Off
When building without WITH_WINDOWS_BUNDLE_CRT the manifest
did not contain the blender.shared dependentAssembly leading
to missing dll errors at blender startup.
2022-12-21 13:25:02 -07:00
b621483659 GPU: Fix incorrect attribute usage in vk_shader.
Detected when reviewing the code. Just wanted it to be in
master before holiday season starts.
2022-12-21 21:19:23 +01:00
f4b03031e8 GPU: Select GPU Backend from Preferences.
(MacOS) only: In the System tab of the user preferences the user has the
ability to select a GPU backend that Blender will use. After changing
the GPU backend setting, the user has to restart Blender before the
setting is used.

It was added to start collecting feedback on the Metal backend without
using the command lines.

By default Blender will select OpenGL as backend. When Metal is selected
(via `--gpu-backend metal` or via user preferences) OpenGL will be used as
fallback when the platform isn't capable of running Metal.
2022-12-21 20:54:36 +01:00
b492dc3579 Cleanup: Remove unused modifier and BMesh includes 2022-12-21 13:10:51 -06:00
fa3ca9afdb Nodes: Rewrite group creation operator
Separate the "insert nodes into group" operation into more distinct
phases. This helps to clarify what is actually happening, to avoid
redundant updates to group nodes every time a new socket is discovered,
and to make use of the topology cache to avoid the "accidentally
quadratic" alrogithms that we have slowly been removing from node
editing.

The change is motivated by the desire to use dynamic node declarations
for group nodes and group input/output nodes, where it is helpful to
avoid updating the declaration and sockets multiple times.
2022-12-21 12:26:17 -06:00
908c539219 Nodes: Add non-const access to cached group output node pointer 2022-12-21 12:26:17 -06:00
8fe1499796 Cleanup: Use const arguments for node interface socket functions 2022-12-21 12:26:17 -06:00
688086e01f Cleanup: Simplify node duplicate operator
Use the map created for copying nodes more instead of iterating over all
nodes unnecessarily a few times. Use the map empty check instead of
a separate boolean variable. Use a utility function to retrieve a
separate buffer of selected nodes in case the  nodes by id Vector
is reallocated (that part is technically a fix).
2022-12-21 12:26:17 -06:00
8bbf823716 Cleanup: Simplify arguments to deselect all nodes function
Take the node tree as an argument directly instead of retrieving it from
the editor struct. Then use the utility function in two more places.
2022-12-21 12:26:17 -06:00
d0348bcb8a Fix: Crash when grouping frame node but not its children
Most likely caused by ab4926bcff
2022-12-21 12:26:17 -06:00
51e2ce7df5 Metal: Turn Metal backend build option ON by default
This enable building the metal backend by default on Apple hardware.
This is needed for further testing and the new backend selector D16774.

Ref T96261
2022-12-21 16:03:50 +01:00
Jason Fielder
3535670ff1 Metal: Optimize local shader memory usage.
Global scope arrays can incur suboptimal per-shader-thread memory allocations, resulting in excessive usage of limited local memory resources. These changes ensure that any arrays are limited to the closest scope in which they are required and thus will get correctly optimized by the compiler.

A number of constants have also been replaced with Macro's as these can result in better runtime performance for complex shader code.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D16825
2022-12-21 14:29:00 +01:00
Jason Fielder
7ff47f7a94 Metal: Add missing MIP_SWIZZLE texture usage flags. Fix compilation warnings.
Authored by Apple: Michael Parkin-White

Ref T96261

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D16824
2022-12-21 14:08:08 +01:00
b015fc4247 Cleanup: Use single declaration of TileNumber.
We used int and int32_t.
2022-12-21 08:42:19 +01:00
fd9a1d62f5 install_deps: Enable building OIIO tools.
These tools are needed by some unittests doing image comparison e.g.
2022-12-21 15:58:03 +09:00
Bastien Montagne
fcddb7cda7 Small refactor of some of the RNA diffing API.
Propagate `eRNAOverrideMatchResult` 'return' flags at higher level into
BKE API, instead of just returning a boolean true when new override
rules have been created.

NOTE: This is an intermediary step towards fixing T102766.

Differential Revision: https://developer.blender.org/D16761
2022-12-21 12:43:26 +09:00
4c295276f0 Cycles: Fix Metal kernel compilation 2022-12-21 04:24:22 +01:00
40e5954e39 Cleanup: Use ampersand instead of "and" for labels
UI guideline is use '&' for labels, use "and" for descriptions.
2022-12-20 18:32:30 -05:00
fb7f12dc40 Cleanup: hide 'UNUSED' macro definition for C++
This may allow the `C4100` warning to be re-enabled in the MSVC for C++.

Differential Revision: https://developer.blender.org/D16828
2022-12-20 19:16:33 -03:00
6383ed9956 Fix: Assert failure in mirror modifier
This was harmless because the function would just return null in release
builds, which was checked. Theoretically this vertex group mapping
shouldn't depend on the object type, but the vertex group API would
have to move away from the object-level first.
2022-12-20 14:07:24 -06:00
Germano Cavalcante
cc13934442 Cleanup: convert 'MOD_mirror.c' to C++
It will be useful to use the merge verts API in C++.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D16823
2022-12-20 15:53:10 -03:00
99fcfdd9fb Tests: Print when mesh test starts, to help debugging crashes 2022-12-20 12:02:05 -06:00
7907803694 Tests: Remove random shuffling from modifiers test
These are meant to be regression tests, not fuzz tests. The "random"
shuffling made debugging quite annoying, even though the random order
was the same every time. Instead, hard-code the two lists to make
things more obvious. The resulting list doesn't make much sense
(for example, the multires modifier has to be first in the stack),
but for now avoid changing things further.

Also remove some comments that weren't helpful.
2022-12-20 10:40:52 -06:00
adc92cc23e Fix T103357: Grease pencil layer color not displayed in main dopesheet backdrop
Reviewed By: Sybren A. Stüvel

Differential Revision: https://developer.blender.org/D16822
2022-12-20 14:45:17 +01:00
ddd24186d9 Geometry Nodes: avoid some overhead during field inferencing
Previously, the same `FieldInferencingInterface` was build for every node
multiple times. Now only once during the inferencing. Going forward,
it would be even better to store the inferencing interface as part of the
node declaration to avoid building it during inferencing at all.
2022-12-20 14:36:26 +01:00
Jason Fielder
dedca2c994 Fix T103313: Resolve shader compilation failures when enabling GPU workarounds.
A number of paths resulted in compilation errors after porting EEVEE to use Create-Info. Namely the fallback path for cubemap support. A number of other strict compilation failures regarding format comparison also required fixing when this mode is enabled.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261, T103313

Differential Revision: https://developer.blender.org/D16819
2022-12-20 14:22:09 +01:00
3efb31ee31 Cleanup: add some deformation-related comments
Add documentation for `BKE_id_defgroup_list_get()` and document that
`CD_MDEFORMVERT` mesh layers contain `MDeformVert` structs.

No functional changes.
2022-12-20 14:17:30 +01:00
Jason Fielder
b3464fe152 Metal: Implement suppot for clip plane toggling via GPU_clip_distances.
The Metal backend already supports output for the 6 clipping planes via gl_ClipDistances equivalent, however, functionality to toggle clipping plane enablement was missing.

Authored by Apple: Michael Parkin-White

Ref T96261
Depends on D16777

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D16813
2022-12-20 14:16:23 +01:00
Jason Fielder
df1fe18ed7 Metal: Fix GPencil texture buffer attribute packing issue and cutting tool rendering.
Line Loop topology support for cutting tool and add support for packing several vertex attributes across individual pixels within a texture buffer.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D16783
2022-12-20 14:08:58 +01:00
Jason Fielder
2712265598 Metal: Addressing a number of small outstanding issues across Metal backend.
- Support for non-contiguous shader resource bindings for all cases required by create-info
 - Implement missing geometry shader alternative path for edit curve handle.
 - Add support for non-float dummy textures to address all cases where default bindings may be required.

Authored by Apple: Michael Parkin-White
Ref T96261
Depends on D16721

Reviewed By: fclem
Differential Revision: https://developer.blender.org/D16777
2022-12-20 14:05:34 +01:00
844b6e3982 Nodes: use CacheMutex to protect topology cache
No functional changes are expected.
2022-12-20 13:05:02 +01:00
105c0aa5b6 Fix T103064: Realtime Compositor crashes on undo
The Realtime Compositor crashes on undo after an operation like Dissolve
node.

The compositor evaluator stored a reference to the compositor node tree
assuming that it will always be valid. This is not guaranteed, however,
and changes to the node tree can invalidate that reference. So we get
the node tree from the context directly every time to fix the crash.
2022-12-20 10:09:25 +02:00
edb5dcaa31 Cleanup: Uninitialized variables in lineart_shadow.c 2022-12-20 12:53:42 +08:00
Bastien Montagne
b93025db59 Add concept of 'runtime' ID in Main data-base.
Such IDs are tagged with the new `LIB_TAG_RUNTIME`. They are essentially
like any other regular ID, except that they do not get written in .blend
files. They also do not make their linked data usages directly linked.
They do be written in undo steps however.

This tag should be ignored in any non-Main IDs (e.g. evaluated data,
`NO_MAIN`, etc.).

This commit also adds a new RNA ID property, `is_runtime`. This is not a
direct mapping to the DNA tag, as a non-main ID will also return True,
and the property is only editable for Main IDs.

Some basic testing for expected behavior of that new tag was also added
to `blendfile_io` py unittest.

Required for brush asset project, see T101908.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16675
2022-12-20 13:15:51 +09:00
9837a32822 Correction to previous commit re ID tags and undo.
Explicitely separate handling of ID tags for undo read/write versus
regular .blend file read/write.
2022-12-20 13:05:47 +09:00
194cc8410b Fix (unreported) lost ID tags on undo.
ID tags were fully cleared on file write, however some should be written
so that they are preserved accross undo steps.

Currently this likely did not cause any serious issue, as the missing
ones were not that critical.
2022-12-20 12:14:12 +09:00
c2a8d8b18d Fix T103301: Active and default color attributes lost in many operations
When creating a new mesh to change it in some way, the active and
default color attribute names should be copied to the new mesh.
Doing that in the generic "copy parameters for eval" function should
cover the vast majority of cases.
2022-12-19 14:56:39 -06:00
4ae0da1bbc Geometry Nodes: Avoid mesh copy in some cases
Accessing a mesh with write access can be costly if it is used
elsewhere at the same time because of copy-on-write. When always did
that at the end of the modifier calculation, but it's trivial to only
do that when we might need actually use the mesh to add original
index layers.
2022-12-19 14:24:49 -06:00
5fe297df48 Fix: Set position node doesn't tag mesh normals dirty
Caused by b08301c865. This also contains an optimization
compared to the previous version to avoid recalculating normals when
the entire mesh has moved by the same offset.

Reported by Demeter in chat.
2022-12-19 13:59:41 -06:00
9f575ece39 Fix T103307: Crash reading particle hair key.co
05952aa94d accessed the vertex array when the mesh was null.
2022-12-19 13:05:05 -06:00
Jason Fielder
81f425a36f Metal: Remove Vec3 packing from uniform buffer generation as this causes UBO misalignment in Metal.
Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem
Differential Revision: https://developer.blender.org/D16721
2022-12-19 17:09:56 +01:00
1a986f7eba Revert "Fix erratic mouse wrapping movement on Windows (2)"
This reverts commit a3a9459050.

And fixes T103337.

a3a9459050 has some flaws and it needs to go through review (See D16803).

Conflicts:
	intern/ghost/intern/GHOST_SystemWin32.cpp
2022-12-19 10:41:05 -03:00
4cb2204d3a Fix T103037: Regression: Grease Pencil Line Texture last point gets distorted
This was due to a missing endpoint case that wasn't handled in the port.

The last point still have to be discarded manually because of the
dot/stroke setting of the material.

The first test `ma1.x == -1` is not necessary anymore since the index
buffer do not contain this point (which was rendered using instance
rendering before.

Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D16812
2022-12-19 14:04:58 +01:00
288d4c9545 Fix: asset handle in context is always none
The issue was introduced in rBf0ac5e8aec03f7d0ca07d3792e5.
2022-12-19 12:50:09 +01:00
923f394485 Fix Outliner: Click next to View Layer name triggers object select
Unlike other (closed) hierarchies, view layers dont show their contents
next to their names.

Code would still find the item via outliner_find_item_at_x_in_row though,
this is now prevented (same as if the viewlayer was open [instead of
collapsed]).

Fixes T102357.

Maniphest Tasks: T102357

Differential Revision: https://developer.blender.org/D16662
2022-12-19 09:25:10 +01:00
c3cc8d2f6a Realtime Compositor: Implement Streaks Glare node
This patch implements the Streaks Glare node. Which is an approximation
to the existing implementation in the CPU compositor. The difference due
to the approximation is bearily visible in artificial test cases, but is
less visible in actual use cases. Since the difference is rather similar
to that we discussed in the Simple Star mode, the decision to allow that
difference would probably hold here.

For the future, we can look into approximating this further using a
closed form IIR recursive filter with parallel interconnection and
block-based parallelism. That's because the streak filter is already
very similar to the causal pass of a fourth order recursive filter,
just with exponential steps.

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

Reviewed By: Clement Foucault
2022-12-19 10:08:59 +02:00
67318b1977 Realtime Compositor: Implement variable size blur
This patch implements the variable size mode of the blur node. This is
not identical to the CPU implementation, but is visually very close.

That's because of two things. First, the Extend Bounds option introduces
a 2px offset that doesn't make sense, which is likely a bug in the CPU
implementation. Second, the CPU implementation approximate the result
using three passes, the first two of which are separable morphological
operators applied on the size input. But this approximation does not
provide an advantage because the last pass is non-separable anyways. So
the GPU implementation does not attempt this approximation for more
accurate and faster results.

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

Reviews By: Clement Foucault
2022-12-19 10:04:03 +02:00
1eb90ee519 UI: Use vector instead of linked list for block button groups
This simplifies some memory management, ammortizes some of the many
small allocations when building UI layouts, and simplifies the code
that deals with the groups. `uiBlock` is no longer a trivial type.
In my testing this saved a few ms when drawing a large node tree.
2022-12-18 21:45:32 -06:00
7d7e90ca68 UI: Use vector instead of linked lists for context store
Duplicating context lists took a measurable amount of time when drawing
large node trees in the node editor. Instead of using a linked list of
entries, which results in many small allocations, use a vector. Also,
use std::string and StringRefNull instead of char buffers and pointers.
2022-12-18 19:13:15 -06:00
d59f6ffdcb Fix: Wrong const iterator type for blender::Vector 2022-12-18 18:35:40 -06:00
f0ac5e8aec Cleanup: Move context.c to C++ 2022-12-18 14:40:30 -06:00
50c7eb14f4 Fix T103321: NodeSocket.node is None in Node.copy callback
Tag the topology cache dirty before Python can do arbitrary things
in the RNA copy callback.
2022-12-18 14:06:43 -06:00
8666791b2e Fix T103261: Undo after mask extract doesn't restore active object 2022-12-18 07:50:35 -08:00
17e266cd55 Cleanup: make paint_init_pivot an api method.
I had forgotten about curves sculpt mode when I wrote
this function. It just initializes the viewport
pivot point to the evaluated object bounding box.
Should be used inside the mode entry function.
2022-12-18 07:20:12 -08:00
0beb358a69 Fix T103198: Missing bounds check for material_index attr in texpaint
Texpaint now bounds checks material indices when looking up
materials, in case the user has corrupted the material_index
attribute somehow.  We may wish to report this to the user
somehow on entering texture paint mode.
2022-12-18 07:08:57 -08:00
5a761a47e1 Cleanup: replace StringIO seek() & read() with a call to getvalue() 2022-12-18 14:18:01 +11:00
8709a51fa9 Fix T103293: GPencil Multiframe Scale affects stroke thickness inversely
The problem was the falloff factor was applied directly
and in the thickness must be inversed. Now the thickess
is calculated using an interpolation.
2022-12-17 16:36:02 +01:00
28511ac6cf Fix T103294: bring back modifyMesh function for geometry nodes modifier
This was removed inrBb1494bcea7b6bb608 under the assumption that
it is not needed anymore. Apparently it is, so this commit brings it back.
2022-12-17 14:46:15 +01:00
c18055ba5c Cleanup: quiet warning 2022-12-17 11:51:12 +01:00
e07c5a14c9 Cleanup: sort cmake file lists 2022-12-17 16:00:40 +11:00
0cc573c8c4 Cleanup: white space around comment blocks 2022-12-17 15:58:30 +11:00
a0a7db9f70 Cleanup: duplicate words in comments 2022-12-17 14:11:11 +11:00
02c8ce449e License headers: add missing license identifiers 2022-12-17 14:04:34 +11:00
68ba311c5c Cleanup: use SPDX license headers 2022-12-17 13:59:20 +11:00
dc8355cfe2 Correct GCC version in message
Missed last commit.
2022-12-17 13:56:01 +11:00
025570c44e Build: bump minimum GCC version from 9.3.1 to 11.0.0
Increase the minimum version as part of the VFX platform 2023.
2022-12-17 13:54:38 +11:00
2ac6e26c25 Cleanup: cmake formatting 2022-12-17 13:33:27 +11:00
6797de4e10 Cleanup: spelling in comments 2022-12-17 13:15:33 +11:00
067fe443d8 Cleanup: consistent naming for normals
Use consistent naming for {vert/poly/loop/face}_normals.
2022-12-17 13:06:43 +11:00
6d3cc9c38a Cleanup: cmake indentation 2022-12-17 12:33:55 +11:00
347c82be6d Fix T98951: Shadow catcher objects are double-counting data passes
Differential Revision: https://developer.blender.org/D16627
2022-12-17 01:45:07 +01:00
7c85f11c42 Cycles: Change bake jittering to avoid issues with skinny triangles
Partially addresses T72011.

The problem here is that the previous barycentric clamping did not deal well
with skinny triangles and would end up generating "sub-pixel jittering"
locations that were actually >20 pixels away.

Differential Revision: https://developer.blender.org/D16727
2022-12-17 01:16:14 +01:00
4254810e50 Cleanup: Slightly refactor cancelling link drag operator
Clarify that the dragged links aren't stored in the tree, use a
separate function for cancelling vs. applying the links to the tree.
2022-12-16 14:43:44 -06:00
4352ac0558 Cleanup: Return early in node link operator, remove useless comments 2022-12-16 14:43:44 -06:00
c9288ab41f Cleanup: Remove redundant information from node link drag struct 2022-12-16 14:43:44 -06:00
a43e498878 Cleanup: Remove unnecessary node link flag
Links that are currently being dragged are now stored outside
of the node tree, so we don't need a flag to distinguish them
from "proper" links.
2022-12-16 14:43:44 -06:00
5ffcd8779e Fix: socket tooltip not showing when there was no type conversion 2022-12-16 19:39:14 +01:00
3aca0bc66a Geometry Nodes: simplify handling of invalid group interface sockets
Previously, the code tried to keep node groups working even if some of
their input/output sockets had undefined type. This caused some
complexity with no benefit because not all places outside of this file
would handle the case correctly. Now node groups with undefined
interface sockets are disabled and have to be fixed manually before
they work again.

Undefined interface sockets are mostly caused by invalid Python
API usage and incomplete forward compatibility (e.g. when newer
versions introduce new socket types that the older version does
not know).
2022-12-16 18:31:01 +01:00
6ced6c9545 Fix std::optional value() build error on older macOS SDK
Patch from @dupoxy

Differential Revision: https://developer.blender.org/D16796
2022-12-16 11:02:43 -06:00
ea731f42db Fix T103187: Opening node search menu is slow because of assets.
Avoid utility function call that would query the file system, this was a
bottleneck. The path joining was also problematic. See patch for more
details.

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

Reviewed by: Jacques Lucke
2022-12-16 17:01:03 +01:00
d77a6849e6 Cleanup: Remove duplicate UV islands header
This code was duplicated from `pbvh_uv_islands.hh`,
which was the version that was actually used.
2022-12-16 09:43:57 -06:00
Christophe Hery
9e94135f17 Fix: Crash after mesh color attribute name commit
6514bb05ea missed a null check when accessing the active
and default color attribute names, since the CustomData API does not
do that check itself.
2022-12-16 09:43:57 -06:00
bea5fe6505 Nodes: Add Exclusion color mix mode
Expands Color Mix nodes with new Exclusion mode.

Similar to Difference but produces less contrast.

Requested by Pierre Schiller @3D_director and
@OmarSquircleArt on twitter.

Differential Revision: https://developer.blender.org/D16543
2022-12-16 15:42:41 +00:00
a8530d31c2 Fix T103258: Deleting a shader with OptiX OSL results in an illegal address error
Materials without connections to the output node would crash with OSL
in OptiX, since the Cycles `OSLCompiler` generates an empty shader
group reference for them, which resulted in the OptiX device
implementation setting an empty SBT entry for the corresponding direct
callables, which then crashed when calling those direct callables was
attempted in `osl_eval_nodes`. This fixes that by setting the SBT entries
for empty shader groups to a dummy direct callable that does nothing.
2022-12-16 15:41:21 +01:00
c9eb583460 Fix T103257: Enabling or disabling viewport denoising while using OptiX OSL results in an error
Switching viewport denoising causes kernels to be reloaded with a new
feature mask, which would destroy the existing OptiX pipelines. But OSL
kernels were not reloaded as well, leaving the shading pipeline
uninitialized and therefore causing an error when it is later attempted to
execute it. This fixes that by ensuring OSL kernels are always reloaded
when the normal kernels are too.
2022-12-16 14:04:03 +01:00
599c0db3ff Cleanup: indentation in CMake files 2022-12-16 23:47:35 +11:00
9a25c48f08 Build: resolve failure to copy indirect dependencies for USD on Linux
Even when building without OpenImageIO and OpenVDB, USD depends on these
libraries.

Ensure these libraries are copied when building with USD.
2022-12-16 23:31:50 +11:00
3334ff0e32 CMake: warn Linux references old linux_centos7_x86_64 paths
When the centos7 library dir is found, warn when the values of cached
variables reference it, listing the variables and their values.
2022-12-16 23:06:03 +11:00
c37e07bc01 Geometry Nodes: improve dot graph export of lazy function graph
* Dim default input values.
* Print default input values instead of type name.
* Add node/socket names to group input/output nodes.
2022-12-16 12:18:49 +01:00
ba89f640fe Fix T102792: Sculpt cursor jumps to random place
Restrict the condition under which paint cursors read use the cursor
location from the the operating-system.

This caused a glitch when dragging UI elements in painting context
popup. Since the paint cursor would display using mouse motion
which was clamped to the window center - an internal detail of hidden
cursor grabbing.

Now only read the cursor coordinates when clamped to a region which
is used for the transform cursor to stay visible even when the cursor
wraps around.
2022-12-16 18:40:17 +11:00
79a34758f5 Fix T103253: Infinite drag of number buttons is broken on WIN32
Recent reverting of changes to cursor grabbing intended to match
Blender 3.3 release. This is the case for 3.4x branch, however there is
an additional change to grabbing on WIN32 by Germano [0] which is a
significant improvement on old grabbing logic for Windows.
So instead of matching 3.3x behavior, restore logic that keeps
the cursor centered while grabbing & hidden.

This re-introduces T102792 issue displaying the paint-brush while
dragging buttons, this will have to be solved separately.

Re-apply [1] & [2], revert [3] & [4].

[4]: a3a9459050
[0]: 9fd6dae793
[1]: 4cac8025f0
[2]: 230744d6fd
[3]: 0240b89599
2022-12-16 18:38:22 +11:00
f2945f3895 UI: don't change mouse cursor while it's grabbed
The paint cursor was continuously set which meant hiding the cursor
while interacting with buttons would immediately show it again.

This exposed cursor warping.
2022-12-16 17:22:09 +11:00
8b2afe93b4 Build: correct extension type for SNDFILE 2022-12-16 15:35:43 +11:00
ba7afbe3a1 Build: remove opus workaround for sndfile
For some reason SNDFILE now builds without this workaround,
which broke building FFMPEG.
2022-12-16 15:35:43 +11:00
0079460dc7 Fix T102923: replace zero check with epsilons with uv constrain to bounds
Small roundoff errors during UV editing can sometimes occur, most likely
due to so-called "catastrophic cancellation".

Here we set a tolerance around zero when using Constrain-To-Bounds and UV Scaling.

The tolerance is set at one quarter of a texel, on a 65536 x 65536 texture.

TODO: If this fix holds, we should formalize the tolerance into the UV editing
subsystem, perhaps as a helper function, and investigate where else it needs
to be applied.

Differential Revision: https://developer.blender.org/D16702
2022-12-16 17:26:24 +13:00
a6c30e1a0c Fix T103237: Prevent UV Unwrap from packing hidden UV islands
When migrating to the new packing API, pin_unselected was not
implemented correctly.

Regression from rB143e74c0b8eb, rBe3075f3cf7ce, rB0ce18561bc82.

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

Reviewed By: Campbell Barton

Duplicated in blender-v3.4-release as rB3dcd9992676a
2022-12-16 16:59:22 +13:00
75c2e81103 Cleanup: format 2022-12-16 16:55:16 +13:00
841020dba2 Fix active/default color names not being editable
Revert [0] and enable the editable flag as the intent for [1] was that
these values would be editable.

[0]: e58f5422c3
[1]: 6514bb05ea
2022-12-16 12:33:15 +11:00
Damien Picard
edfef62371 Fix T103183: UV map name of mesh converted from curve is untranslated
Upon conversion, the newly-created UV map with default name "UVMap"
should be translated.

Reviewed By: mont29

Maniphest Tasks: T103183

Differential Revision: https://developer.blender.org/D16775
2022-12-16 09:47:56 +09:00
e58f5422c3 Cleanup: remove unused active name set callback functions 2022-12-16 10:50:18 +11:00
2c22795dfd Build: upgrade pre-built libraries for Linux
Replace ../lib/linux_centos7_x86_64 with ../lib/linux_x86_64_glibc_228,
built with Rocky8 Linux, compatible with the VFX platform CY2023,
see: T99618.

- Update build-bot configuration.
- Remove unnecessary check for Blosc, this is part of OpenVDB lib now.
- Remove WITH_CXX11_ABI, always use new C++11 ABI now
- Replace centos7 by glibc_228 everywhere

Note that existing builds with cached paths pointing to
"../lib/linux_centos7_x86_64" will need to be updated.

Includes contributions by Brecht.
2022-12-16 10:42:40 +11:00
3d29bbcc38 Fix T103049: Cycles specular light leak regression
The logic here is not ideal but was unintentionally changed in refactoring
for path guiding, now restore it back to 3.3 behavior again.
2022-12-15 21:49:59 +01:00
6514bb05ea Mesh: Store active & default color attributes with strings
Attributes are unifying around a name-based API, and we would like to
be able to move away from CustomData in the future. This patch moves
the identification of active and fallback (render) color attributes
to strings on the mesh from flags on CustomDataLayer. This also
removes some ugliness used to retrieve these attributes and maintain
the active status.

The design is described more here: T98366

The patch keeps forward compatibility working until 4.0 with
the same method as the mesh struct of array refactors (T95965).

The strings are allowed to not correspond to an attribute, to allow
setting the active/default attribute independently of actually filling
its data. When applying a modifier, if the strings don't match an
attribute, they will be removed.

The realize instances / join node and join operator take the names from
the first / active input mesh. While other heuristics may be helpful
(and could be a future improvement), just using the first is simple
and predictable.

Differential Revision: https://developer.blender.org/D15169
2022-12-15 14:21:35 -06:00
b1494bcea7 Geometry Nodes: Add error message when applying modifier with no mesh
If the resulting geometry from applying a geometry nodes modifier
contains no mesh, give an error message. This gives people something to
search and makes the behavior more purposeful.

Also remove the `modifyMesh` implementation from the geometry nodes
modifier, since it isn't necessary anymore. And remove the existing
"Modifier returned error, skipping apply" message which was cryptic
and redundant if applying returns an actual error message.

Resolves T103229

Differential Revision: https://developer.blender.org/D16782
2022-12-15 14:21:35 -06:00
ae886596a0 Nodes: Allow skipping node attachment after dragging
This patch allows skipping the automatic insertion of nodes on top of
links when the transform operator ends. When putting nodes into small
spaces this often gets in the way and wastes time. Now, when holding
`alt`, this is turned off.

The header text is also improved to add this shortcut and to remove
the Dx and Dy values and improve the formatting a bit.

Making this functionality optional might allow us to use it in more
places in the future, like for the nodes added by link-drag-search.

Differential Revision: https://developer.blender.org/D16230
2022-12-15 14:21:35 -06:00
Iliya Katueshenock
7608ebe44a Fix: ignore unavailable sockets linked to multi-input socket
Differential Revision: https://developer.blender.org/D16784
2022-12-15 19:33:13 +01:00
ef35247ee1 Fix make deps harvest error on Linux, due to macOS specific folder in Vulkan 2022-12-15 19:17:36 +01:00
62f8d0d8c8 Fix T103170: missing Cycles viewport light threshold update after exposure edit 2022-12-15 19:13:55 +01:00
c6ff8eb837 Fix build issue with NanoVDB and HIP on Linux
This patch was already accepted upstream, so this is temporary until we update
to a new OpenVDB release that includes it.
2022-12-15 18:58:52 +01:00
6546113f1e Cleanup: fix warning 2022-12-15 17:31:14 +01:00
970f4c2f9f Cleanup: Various improvements to modifier apply operator
Use C++ casts, decrease variable scope, use references, use const.
2022-12-15 10:13:43 -06:00
bd04e80c09 Cleanup: Move mesh modifier apply function to editors module
The function was highly related to the apply modifier operator,
and only used once. This was too specific to be in the blenkernel,
especially in a mesh conversion file.
2022-12-15 10:13:43 -06:00
d2aebf10fa cmake/win: Allow running blender_test from the VS debugger
This was missing some paths setup in the environment, ctest
normally sets this up before running the tests from the CLI
but that does not help the IDE all that much.
2022-12-15 09:04:59 -07:00
51759e6595 Fix T101130: Scaling of NLA Strip Via S Hotkey Not Working
After switching over to using start_frame / end_frame, scaling an NLA strip didn't scale the strip, it just repeated the action.

Now withing the NLA transform code, we look for TFM_TIME_EXTEND / TFM_TIME_SCALE transform mode, and handle the update to strip scale accordingly
2022-12-15 08:59:52 -05:00
9fe1db1d2b GPencil: Fix potential memory leak
If the layer was omitted there was a memory leak.
2022-12-15 13:08:55 +01:00
0e1440eefd Paint: Orbit around selection/stroke: remove redundant case
Since rB8014180720d8, all paint modes support orbiting around last
stroke, so [a] the comment there is out of date and [b] the fallback
case of orbiting around the center will never be used (unless there is
no stroke information - but BKE_paint_stroke_get_average handles that
anyways).

Spotted while looking into T101766.

Maniphest Tasks: T101766

Differential Revision: https://developer.blender.org/D16779
2022-12-15 12:27:31 +01:00
e0ef5f3602 Fix T103234: GPencil applying armature does not work
The problem was the bake function was using the evaluated
data and must use the original data.

The problem was caused by commit: rBcff6eb65804d: Cleanup: Remove duplicate Bake modifier code.

Fix by Philipp Oeser
2022-12-15 10:53:22 +01:00
ba347d7c9e Fix Cycles UI for Scrambling Distance, only works with Tabulated Sobol.
Thanks to Alaska for finding this.
2022-12-15 10:44:56 +01:00
69d1ddd4c6 Fix Cycles Light Tree UI after recent changes. 2022-12-15 10:25:06 +01:00
e5f139e99d Fix T101889: Curves editmode points are drawn from evaluated curves
Editmode should display the original (non-evaluated) points unless there
is something like an "On Cage" option of a modifier [which none of the
curves modifiers have].

This was not the case since the introduction in rBe15320568a29.

So we now draw the editpoints from the original curves. This also means
that original and evaluated curves might not have the same number of
points, so we have to get independent of `proc_point_buf` since that
would possibly create vertexbuffers of different sizes (compared to the
original curves) which is not allowed for a single batch.

- remove the "pos" alias from the vertex buffer format of proc_point_buf
- instead, create a new "edit_points_pos" vertex buffer
- fill that with the original (un-evaluated) curves positions
- dont request `proc_point_buf` anymore
- rename the editpoints flags buffer to be more consistent

And since original and evaluated points might also be in completely
different positions, we also need to draw connecting lines between those
editpoints to not have them float in thin air. For drawing these in
editmode, a simple polyline was chosen (instead of drawing lines in a
resolution that is take from the old particle system -- which is not
depending on points even but has a hardcoded resolution that can only be
upped by the hair_subdiv scene render setting)

- create appropriate batch and indexbuffer for this
- positions vertex buffer can be reused
- reuse particle edit shader (instead of curve edi shader) to get
segment highlighting

{F14055436}

NOTE: this also removes the broken depth handling and instead makes it
work (also XRay is properly taken into account) by binding the correct
overlay framebuffer.

NOTE: to further clarify the distinction between curves drawing (that is
based on the old partice system drawing) and drawing in editmode, the
corresponding vertexbuffers have been moved out of CurvesEvalCache into
CurvesBatchCache directly.

NOTE: drawing the lines in editmode could be improved (taking the "real"
resolution of splines into account, but since this should happen on the
GPU in a compute shader, this is for later)

Potentionally fixes T101889.

Maniphest Tasks: T101889

Differential Revision: https://developer.blender.org/D16281
2022-12-15 08:44:16 +01:00
9e47db4f43 Correct build error with MSVC 2022-12-15 18:03:09 +11:00
7571222a69 Cleanup: add trailing commas for multi-line collections
Avoid accidentally missing commas between strings, see: T101020.
Also use single quotes for enum identifiers.
2022-12-15 17:34:09 +11:00
657a5f205a Cleanup: remove redundant property lookups in RNA API use 2022-12-15 16:30:42 +11:00
18cc1b1108 Fix cursor warping display under Wayland
Under Wayland the transform cursor wasn't displaying the warped cursor.

This worked on other platforms because cursor motion is warped where as
Wayland simulates cursor warping, so it's necessary to apply warping
when requesting the cursor location too.
2022-12-15 15:22:52 +11:00
d715573aea Cleanup: declare GHOST_Window::getCursorGrabBounds as const
Needed so it the method can be called on a cosnt GHOST_Window.
2022-12-15 15:10:51 +11:00
b147af2b7e Cleanup: remove duplicate doc-strings 2022-12-15 14:56:58 +11:00
5da11e22de Cleanup: improve docs for grab functions & use rcti for the wrap region
- Use typed enum for the wrap axis.
- Rename `bounds` to `wrap_region`.
- Take a `rcti` argument instead of an `int[4]`.
- Pair wrap & wrap_region arguments together.
2022-12-15 14:34:50 +11:00
0240b89599 Fix T102346: Mouse escapes window during walk navigation
This is an alternative fix to [0] which kept the cursor centrally
located as part of GHOST cursor grabbing which caused T102792.

Now this is done as part of walk mode as it's the operator that most
often ran into this problem although ideally this would be handled by
GHOST - but that's a much bigger project.

[0]: 9fd6dae793
2022-12-15 12:17:26 +11:00
c969a533f9 WM: support checking windowing capabilities
Historically checks for windowing capabilities used platform
pre-processor checks however that doesn't work when Blender is built
with both X11 & Wayland.

Add a capabilities flag which can be used to check which functionality
is supported. This has the advantage of being more descriptive/readable.
2022-12-15 12:17:01 +11:00
230744d6fd Revert "Fix T102346: Mouse escapes window during walk navigation"
This reverts commits
9fd6dae793,
4cac8025f0 (minor cleanup).

Re-introducing T102346, which will be fixed in isolation.

Unfortunately even when the cursor is hidden & grabbed,
the underlying cursor coordinates are still shown in some cases.

This caused bug where dragging a button in the sculpt-context popup
would draw the brush at unexpected locations because internally
the cursor was warping in the middle of the window, reported as T102792.

Resolving this issue with the paint cursor is possible but tend towards
over-complicated solutions.

Revert this change in favor of a more localized workaround for walk-mode
(as was done prior [0] to fix T99021).

[0]: 4c4e8cc926
2022-12-15 12:15:23 +11:00
b13a92a238 Cleanup: wrap long lines in CMake
Also remove `mingw_LIBDIR` from PKG_CONFIG_PATH since it's not a
package-file path.
2022-12-15 12:14:11 +11:00
530b232309 Cleanup: use more descriptive name for function in BMesh doc generation
Avoid the term "print" as the function doesn't print.
2022-12-15 12:02:57 +11:00
7766a20b8f Build: clarify some comments in the rocky8 setup script
also moved the install of the config manager to before it is needed.
2022-12-14 17:26:40 -07:00
36ca1312c4 Cleanup: use doxy sections and comments in DNA_scene_types.h 2022-12-15 10:31:46 +11:00
e0fbeb6e7b Fix T103225: Line Art modifier skips loose edges
1ea169d90e neglected to increase the loose edge count.
2022-12-14 17:07:51 -06:00
2dd27d5f06 Cleanup: remove function for accessing supported add-ons
This was only called once in a situation where such functions
are typically used as a dynamic enum callbacks.

Prefer keeping the items close to the EnumProperty definition &
avoid the need to note why this is a special case that doesn't follow
the common pattern for enum callbacks.
2022-12-15 09:46:14 +11:00
e476afff41 Cleanup: format 2022-12-15 09:37:02 +11:00
d173a52f56 Cleanup: doc-strings and minor changes to anim_utils.py
- Follow sphinx conventions for doc-strings.
- Use __slots__ for KeyframesCo as dynamically assigning new members
  isn't needed.
- Import from bpy.types instead of assigning.
- Split typing imports across multiple lines as they tend to become
  quite large.
2022-12-15 09:34:00 +11:00
2d21fc3f5d Cleanup: avoid multiplying lists multiple times
Parenthesis are important in this case to avoid creating a list with
multiplication, then multiplying it again.

Oversight in 58c8c4fde3.
2022-12-15 09:34:00 +11:00
f167e366da Build: add missing packages for the rocky8 setup script 2022-12-15 09:02:40 +11:00
918df11a1a Build: prefer underscores for script naming
Matches convention for most existing scripts.
2022-12-15 09:02:40 +11:00
c725a53e89 Cleanup: Use standard node function names and namespace 2022-12-14 14:40:02 -06:00
a3a9459050 Fix erratic mouse wrapping movement on Windows (2)
This is a solution in response to the issues mentioned in comments on
rBe4f1d719080a and T103088.

Apparently the workaround of checking if the mouse is already inside
the area on the next event doesn't work for some tablets.

Perhaps the order of events or some very small jitter is causing this
issue on tablets. (Couldn't confirm).

Whatever the cause, the solution of checking the timestamp of the event
and thus ignoring the outdated ones is theoretically safer.

It is the same solution seen in MacOS.

Also calling `SendInput` 3 times every warp ensures that at least one
event is dispatched.
2022-12-14 16:08:21 -03:00
56237f33a1 Fix T103101: random Cycles animation rendering freezing up the application 2022-12-14 19:48:13 +01:00
Iliya Katueshenock
4121e32edd Fix T102740: don't allow inserting group into itself
Differential Revision: https://developer.blender.org/D16602
2022-12-14 19:35:43 +01:00
Hallam Roberts
a501a2dbff Images: add mirror extension type
This adds a new mirror image extension type for shaders and
geometry nodes (next to the existing repeat, extend and clip
options).

See D16432 for a more detailed explanation of `wrap_mirror`.

This also adds a new sampler flag `GPU_SAMPLER_MIRROR_REPEAT`.
It acts as a modifier to `GPU_SAMPLER_REPEAT`, so any `REPEAT`
flag must be set for the `MIRROR` flag to have an effect.

Differential Revision: https://developer.blender.org/D16432
2022-12-14 19:27:29 +01:00
8c14992db2 Fix syntax errors in Cycles float8 test 2022-12-14 19:01:42 +01:00
Iliya Katueshenock
7efba6c59a Geometry Nodes: show correct type in socket tooltip
Differential Revision: https://developer.blender.org/D16748
2022-12-14 18:48:53 +01:00
d33758755b Revert "Fix T102571: Can't stop audio playback when using multiple windows"
This reverts commit 42b51bf6a9.

Commit caused crash when playback is stopped, see T103008.
2022-12-14 18:45:04 +01:00
77a4ab3ccf Fix wrong syntax in Cycles float8 test fix 2022-12-14 18:36:48 +01:00
Iliya Katueshenock
c5f5046efd Fix T103208: unavailable socket linked to multi-input socket crashes
Differential Revision: https://developer.blender.org/D16772
2022-12-14 18:29:10 +01:00
9fd834fbb3 Fix T103143: Cycles can lose default color attribute
The `render_color_index` skips attributes with different types
and domains in order to give the proper order for the UI list.
That is a different than an index in the group of all attributes.

The most solid solution I could think of is exposing the name of
the default color attribute. It's "solid" because we always address
attributes by name internally. Doing something different is bound
to create problems. It's also aligned with the design in T98366 and
D15169.

Another option would be to change the way the "attribute index"
is incremented in Cycles. That would be a valid solution, but would
be more complex and annoying.

For consistency, I also exposed the name of the active color attribute
the same way, though it isn't necessary to fix this particular bug.

The properties aren't editable, that can come in 3.5 as part of D15169.

Differential Revision: https://developer.blender.org/D16769
2022-12-14 11:26:11 -06:00
eae1be548d Fix T103186: Missing anonymous attribute reference
Creating the `WeakAnonymousAttributeID` doesn't
increase the reference count, but destructing it does.
2022-12-14 11:26:11 -06:00
f879c20f72 Geometry Nodes: output uv map from primitive nodes as anonymous attributes
This is essentially a left-over from the initial transition to fields where this was
forgotten. The mesh primitive nodes used to create a named uv map attribute
with a hard-coded name. The standard way to deal with that in geometry nodes
now is to output the attribute as a socket instead. The user can then decide
to store it as a named attribute or not.

The benefits of not always storing the named attribute in the node are:
* Improved performance and lower memory usage when the uv map is not
  used.
* It's more obvious that there actually is a uv map.
* The hard-coded name was inconsistent.

The versioning code inserts a new Store Named Attribute node that
stores the uv map immediatly. In many cases, users can probably just
remove this node without affecting their final result, but we can't
detect that.

There is one behavior change which is that the stored uv map will be
a 3d vector instead of a 2d vector which is what the nodes originally created.
We could store the uv map as 2d vector inthe Store Named Attribute node,
but that has the problem that older Blender versions don't support this
and would crash immediately. Users can just change this to 2d vector
manually if they don't care about forward compatibility.

There is a plan to support 2d vectors more natively in geometry nodes: T92765.

This change breaks forward compatibility in the case when the uv map
was used.

Differential Revision: https://developer.blender.org/D16637
2022-12-14 18:15:16 +01:00
Nathan Vegdahl
d9192aaa6d Cycles: limit the internal sample index of Sobol-Burley for performance
This is done based on the render sample count so that it doesn't impact
sampling quality. It's similar in spirit to the adaptive table size in D16561,
but in this case for performance rather than memory usage.

Differential Revision: https://developer.blender.org/D16726
2022-12-14 17:39:13 +01:00
Nathan Vegdahl
b0cc8e8dde Cycles: switch from pretabulated 2D PMJ02 to pretabulated 4D Sobol
The first two dimensions of scrambled, shuffled Sobol and shuffled PMJ02 are
equivalent, so this makes no real difference for the first two dimensions.
But Sobol allows us to naturally extend to more dimensions.

Pretabulated Sobol is now always used, and the sampling pattern settings is now
only available as a debug option.

This in turn allows the following two things (also implemented):

* Use proper 3D samples for combined lens + motion blur sampling. This
  notably reduces the noise on objects that are simultaneously out-of-focus
  and motion blurred.
* Use proper 3D samples for combined light selection + light sampling.
  Cycles was already doing something clever here with 2D samples, but using
  3D samples is more straightforward and avoids overloading one of the
  dimensions.

In the future this will also allow for proper sampling of e.g. volumetric
light sources and other things that may need three or four dimensions.

Differential Revision: https://developer.blender.org/D16443
2022-12-14 17:39:13 +01:00
ecfcf1b97b Cycles: disable light tree for existing scenes, enable on new scenes
While it helps on many scenes, it can be disruptive for existing scenes and
for benchmarks the differences in timing can be confusing. So be a bit more
conservative and only it enable it for new scenes.
2022-12-14 17:39:13 +01:00
2221cfc044 Cleanup: GCC compiler warnings in Cycles float8 test 2022-12-14 17:39:13 +01:00
d88ebd31d6 Cleanup: add comments explaining need for requests dependencies 2022-12-14 17:39:13 +01:00
f0dc4d67e5 Geometry Nodes: support storing 2d vector attributes
This allows choosing the 2d vector type in the Store Named Attribute
node. Similar to byte-colors, there is not a special socket type for this
(currently). In geometry nodes itself, vectors are all still 3d.
2022-12-14 16:44:01 +01:00
45dbd69296 Fix compiler error on MSVC after a243a9dc79 2022-12-14 16:09:10 +01:00
8daaf71688 deps_builder: add missing freetype dep to harfbuzz
without it harfbuzz could build before freetype which
it needs to build.
2022-12-14 08:03:28 -07:00
fe3110a285 Fix FallbackCyclesBlitShader compilation error
Error: C0204: version directive must be first statement and may not be
repeated
2022-12-14 11:59:40 -03:00
f4912e7f5b Fix asset loading indicator in node add menu disappearing too early
The "Loading Asset Libraries" label in the menu would already disappear
before the asset libraries are done loading. It only queried if the
loading was started, not if it was finished. Especially notable when the
asset library was slow to load, e.g. because it is not yet in the asset
index.
2022-12-14 15:43:05 +01:00
a243a9dc79 Cleanup: Remove unused headers in asset files 2022-12-14 15:43:05 +01:00
c30fdb9cf5 Fix mismatching PTX function declarations for OSL intrinsics with string parameters
The use of a struct for device strings caused the CUDA compiler to
generate byte arrays as the argument type, whereas OSL generated
primitive integer types (for the hash). Fix that by using a typedef
instead so that the CUDA compiler too will use an integer type in the
PTX it generates.

Maniphest Tasks: T101222
2022-12-14 15:23:27 +01:00
dba7837d44 Fix typo in rB2c5a525d6409
`MOD_MIR_AXIS_Y` -> `MOD_MIR_AXIS_Z`

This causes mirror-Z clipping to be non-functional.
2022-12-14 09:23:10 -03:00
8930395912 Fix T101765: Curves sculptmode: object origin and 3D cursor are visible
This is because OB_MODE_SCULPT_CURVES is not part of OB_MODE_ALL_PAINT
(yet). While there is some chance it ends up there, there are a lot of
more places that need checking and so patch only fixes the report very
isolated.

NOTE: T93501 is related (since the option to show these should also be
hidden in sculptmode)

Maniphest Tasks: T101765

Differential Revision: https://developer.blender.org/D16764
2022-12-14 08:22:05 +01:00
4263919270 Build: fix building FFMPEG on Linux
PKG_CONFIG_PATH wasn't set properly on Linux.

Also wrap long lines for better readability.
2022-12-14 17:49:46 +11:00
fd36221930 GHOST/Wayland: fix memory leak when Wayland fails to start 2022-12-14 17:09:55 +11:00
nutti
b848de7546 Fix T102213: Invalid font size in the image editor with some scripts
The size could be left at an unexpected value by scripts, causing
the wrong size to be shown.

Ref D16493
2022-12-14 15:40:53 +11:00
ad39c0f312 Build: add missing library to the linux-rocky8-setup.sh script 2022-12-14 15:23:47 +11:00
396816faac Libs: bump libspnav to 1.1
Version 0.2.3 doesn't include the fix needed for space-mouse enterprise,
see T101866.
2022-12-14 15:10:34 +11:00
491fc5cace Build: disable X11 support for spnav on Linux
This prevented building Blender without X11 (Wayland only).
2022-12-14 14:57:13 +11:00
1324db0ad1 Cleanup: cmake indentation 2022-12-14 14:21:51 +11:00
5025a3833a CMake: fix build error on Linux where MAN page generation failed
Move man-page generation to an install step to ensure the shared
libraries have been copied before running Blender.
2022-12-14 14:13:38 +11:00
Ian Karanja
4710582f8f UI: Fix typo in 'CONSTRAINT_SPACE_PARLOCAL' description
Differential Revision: https://developer.blender.org/D16690
2022-12-13 21:52:01 -05:00
93a629f147 Fix T103119: Allow Win32 Diacritical Composition
Allow keyboard layouts which include "dead keys" to enter diacritics
by calling MapVirtualKeyW even when not key_down.

See D16770 for more details.

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

Reviewed by Campbell Barton
2022-12-13 18:30:20 -08:00
76aba51a21 Build: update centos7 script to run on rocky8 2022-12-14 12:32:32 +11:00
b1b5b48d53 Cleanup: quiet format warning 2022-12-14 12:25:35 +11:00
75ad8da1ea Refactor: Replace old Mesh edge split implementation
Recently a new geometry node for splitting edges was added in D16399.
However, there was already a similar implementation in mesh.cc that was
mainly used to fake auto smooth support in Cycles by splitting sharp
edges and edges around sharp faces.

While there are still possibilities for optimization in the new code,
the implementation is safer and simpler, multi-threaded, and aligns
better with development plans for caching topology on Mesh and other
recent developments with attributes.

This patch removes the old code and moves the node implementation to
the geometry module so it can be used in editors and RNA. The "free
loop normals" argument is deprecated now, since it was only an internal
optimization exposed for Cycles.

The new mesh `editors` function creates an `IndexMask` of edges to
split by reusing some of the code from the corner normal calculation.

This change will help to simplify the changes in D16530 and T102858.

Differential Revision: https://developer.blender.org/D16732
2022-12-13 18:40:06 -06:00
ae7ef8bcc6 Cleanup: Use const variables in node drawing 2022-12-13 16:44:46 -06:00
f613614fce Fix T103136: Cannot activate viewer node in group
90ea1b7643 created an item for the viewer node path
but didn't add it to the list, which also caused memory leaks.
2022-12-13 16:44:46 -06:00
a55163c880 Cleanup: Reduce indentation when setting node active 2022-12-13 16:44:46 -06:00
23b776e5b3 Cleanup: Remove disabled code 2022-12-13 16:44:46 -06:00
9f1d7d930d Cleanup: fix comile error from last commit 2022-12-13 13:58:27 -08:00
939b63bcd6 Sculpt: Fix more attribute bugs when switching PBVH modes
Fixed more cases where attributes weren't being reinitialized
on switching PBVH mode:

* When PBVH_GRIDS and PBVH_BMESH force attributes into simple
  array mode they no longer override simple_array in the
  SculptAttributeParams parameters, instead they set a field
  in SculptAttribute itself.  Thus if the attribute is
  reinitialized in another mode it won't retain the simple_array
  parameter.
* sculpt_attribute_ensure_ex now calls sculpt_attr_update if
  the attribute already exists.
* Fixed a bug from a couple commits ago that set
  SculptAttribute.data_for_bmesh wrong.
2022-12-13 13:48:07 -08:00
6f9cfb037a Sculpt: Fix T102991: Multires fast navigate not implemented
PBVH draw code now builds coarse triangle index buffers
for multires. Note that the coarse grids can be at any
multires depth but is currently hardcoded to 1.
2022-12-13 13:46:25 -08:00
8ee020d11f Fix T103195: Initialize face sets from bevel weights broken
The conversion from char to float (divide by 255) wasn't removed in
291c313f80. Also fix a crash when the edge crease layer
didn't exist.
2022-12-13 15:17:55 -06:00
29f342774c Fix T103052: Box trim does not create face sets attribute
Previously the sculpt box trim operator always created face sets,
but after face sets became optional it only modified them if they
already existed. Absent a better way to turn the behavior on and off,
the fix is to just always create face sets.
2022-12-13 15:17:55 -06:00
bdd34f4fa2 Fix T103051: Changed behavior when removing a material slot
Before f1c0249f34 the material was assigned to the previous
slot rather than the next. Though the behavior is arbitrary, there
is no reason to change it.
2022-12-13 15:17:55 -06:00
2c5a525d64 Cleanup: indentation, remove and rename variables
The `transform_convert_clip_mirror_modifier_apply` code is made more readable by:
- decreasing indentation;
- removing `axis` and `tolerance` variables;
- renaming `int clip` to `bool is_clipping`;
2022-12-13 14:59:55 -03:00
31ba4dd82e Build: bump OSL version to hash in 1.13 which is under development
This includes string table changes to make the Cycles OptiX support work.
2022-12-13 18:53:12 +01:00
b50c475cd2 Cleanup: move listbase.c to c++ 2022-12-13 18:13:10 +01:00
0a5e8a6342 Sculpt: Fix crash in dyntopo
Attribute wrangler in PBVH_BMESH mode was
converting real attributes (e.g. vertex node index)
into simple arrays when validating the attribute list.
2022-12-13 08:47:54 -08:00
246df68095 Sculpt: Fix crash with unsupported attr types in pbvh draw 2022-12-13 08:47:53 -08:00
ea7570989d Cleanup: add utility method to get group input nodes 2022-12-13 17:25:51 +01:00
0cd56b7a36 Fix T101169: fcurve.c: solve_cubic: incorrect comment
The comment of `solve_cubic()` put the coefficients of the to-be-solved
cubic equation in the wrong order. This is now fixed.

No functional change, just a comment fix.
2022-12-13 16:20:24 +01:00
9579e3eef2 Cleanup: remove unused parameter in calc_brush_local_mat. 2022-12-13 15:52:50 +01:00
85a743e08b Fix T103061: GPencil export to SVG wrong line thickness
When the line was very thin the precision of the thickness
calculation was not precise enough.

The algorithm has been improved. This affects SVG and PDF.
2022-12-13 11:39:22 +01:00
e8c7866608 Add-ons: Exclude contrib for beta, rc and release builds.
* Make it clearer that contrib isn't shipped with releases, by already excluding it in beta.
* Improve the UI by hiding the "Testing" enum item in these case.

Differential Revision: https://developer.blender.org/D16729
2022-12-13 11:12:36 +01:00
a14a152024 PBVH: Fix crash with incorrect initialized span lengths.
PBVH doesn't store the loop size. We need to get that from the mesh.
We should perhaps also store the mloop len insize the PBVH.
2022-12-13 10:15:32 +01:00
8f5df25f33 Cleanup: Use BKE_brush_mask_texture_get in sculpt code.
In preparation to sanatize the mask texture and color texture in sculpt code. In sculpt
mode the mask texture is read from mtex, leaving the mask_mtex when we want to use color
textures in sculpt mode.
2022-12-13 09:14:33 +01:00
e6e57cebec CMake: add missing headers 2022-12-13 12:46:12 +11:00
adb49ffa24 Cleanup: spelling in comments 2022-12-13 12:35:53 +11:00
cfcc728de6 Cleanup: split python packages across multiple lines
Having all packages on one line made reviewing changes difficult.

Also note why Python modules are needed (with some TODO's where I wasn't
able to find any reason given for their inclusion).
2022-12-13 12:25:10 +11:00
b751c28f78 Build: resolve build error with vulkan_loader not finding Wayland 2022-12-13 12:25:10 +11:00
9f11129d28 Build: fix building sndfile with OPUS on Linux
The PKGCONFIG file exposes the OPUS include: requiring <opus/opus.h>
to be replaced with <opus.h>. Manipulate the PKGCONFIG file instead of
patching the source since the small change is only needed in one place.
2022-12-13 12:25:10 +11:00
2761f7c4a5 Build: fix MESA failing to build with missing EXPAT dependency 2022-12-13 12:25:10 +11:00
6ce95c34ae Build: disable cairo for harfbuzz
This is only used for command line utilities, disable the dependency.
2022-12-13 12:25:10 +11:00
dd6f7c1318 Build: remove patch to build with older meson version for Wayland
Revert part of [0] which was required to build with meson 0.55.1,
rocky8 has version 0.58.2.

[0]; 8bb084cda3
2022-12-13 12:25:10 +11:00
982fb66fb1 Build: ensure meson is built before use
Meson is built as part of external_python_site_packages,
without this dependency it would be called before being built.

Also remove Meson as a build requirement since the version is used.
2022-12-13 12:25:10 +11:00
17a20ed7fe Cleanup: resolve missing-declarations warning 2022-12-13 12:24:57 +11:00
485c5abedc Fix T103067: Regression: Workbench render crash in 3.4
The workbench engine assumes that the Z pass exists, but didn't register it before.
Since rB3411a96e7493, this is mandatory.
2022-12-13 01:45:52 +01:00
ab1c36ad3f Cleanup: Move two modifier files to C++ 2022-12-12 18:19:32 -06:00
57090a4b72 Cleanup: Remove ifdef'd node transform code
This has been turned off since 2013.
2022-12-12 17:09:58 -06:00
e41abf9e26 Cleanup: Remove runtime node flag, various node transform cleanups
Remove another runtime node flag that's simpler as a local variable.
Use references, C++ types, simpler for loops, etc.
2022-12-12 17:03:17 -06:00
4ee2504eff Cleanup: Remove cryptic "PET" acronym
There is no need to make this an acronym, it only makes the code
less accessible. It's a comment anyway, so brevity isn't the goal.
2022-12-12 17:03:17 -06:00
9437abdbce Cleanup: Use LISTBASE_FOREACH macro 2022-12-12 17:03:17 -06:00
b08301c865 Geometry Nodes: Optimization in Set Position node
Adds an early return if Position/Offset inputs won't lead
to any changes in the Geometry.

It now also compares with the read-only Position attribute instead of
getting it for write only, to work correctly with Copy-on-Write.
Before, the `is_same`-check only worked for geometry created
in the node tree.

Differential Revision: https://developer.blender.org/D16738
2022-12-12 23:01:49 +01:00
f56488c20f Fix Cycles ellipse area light returns zero pdf in volume segment 2022-12-12 21:38:23 +01:00
e378bd70ed Cleanup: remove code duplication in cycles light sampling
There has been an attempt to reorganize this part, however, it seems that didn't compile on HIP, and is reverted in
rBc2dc65dfa4ae60fa5d2c3b0cfe86f99dcb5bf16f. This is another attempt of refactoring. as I have no idea why some things don't work on HIP, it's
best to check whether this compiles on other platforms.
The main changes are creating a new struct named `MeshLight` that is shared between `KernelLightDistribution` and `KernelLightTreeEmitter`,
and a bit of renaming, so that light sampling with or without light tree could call the same function.
Also, I noticed a patch D16714 referring to HIP compilation error. Not sure if it's related, but browsing
https://builder.blender.org/admin/#/builders/30/builds/7826/steps/7/logs/stdio, it didn't work on gfx1102, not gfx9*.

Differential Revision: https://developer.blender.org/D16722
2022-12-12 21:25:09 +01:00
42def76831 Cleanup: Add a bit more detail to curves offsets comment 2022-12-12 13:40:28 -06:00
e4f9c50928 Fix T102990: OpenVDB files load very slow from network drives
The OpenVDB delay loading of voxel leaf data using mmap works poorly on network
drives. It has a mechanism to make a temporary local file copy to avoid this,
but we disabled that as it leads to other problems.

Now disable delay loading entirely. It's not clear that this has much benefit
in Blender. For rendering we need to load the entire grid to convert to NanoVDB,
and for geometry nodes there also are no cases where we only need part of grids.
2022-12-12 18:28:09 +01:00
95a792a633 Fix wrong Cycles standalone exposure default value, should be 1 2022-12-12 18:28:09 +01:00
f53bd17836 Cycles: take into account film exposure for light sampling threshold
To avoid issues with lights being either skipped or sampled unnecessarily
when the exposure is set low or high.

Contributed by Alaska.

Differential Revision: https://developer.blender.org/D16703
2022-12-12 18:28:09 +01:00
312e42708f Fix T103066: Cycles missing full constant foler for mix float and mix vector 2022-12-12 18:28:09 +01:00
18abc2feaa Fix Cycles light tree not working with negative light strength
Use absolute value of emission as estimate to make this work.

Contributed by Alaska.

Differential Revision: https://developer.blender.org/D16718
2022-12-12 18:28:09 +01:00
Iliya Katueshenock
f95de78ca2 Fix memory leak in lite build with animation rendering
Differential Revision: https://developer.blender.org/D16745
2022-12-12 18:28:09 +01:00
54aec4629e Cleanup: Remove unused code in Cycles
* preempt_attr was copied from CUDA, but not used in HIP.
* Remove shadowed variable before conditional in EnvironmentTextureNode code.

Differential Revision: https://developer.blender.org/D16741
2022-12-12 18:15:41 +01:00
d72c7eefd1 Fix T101522: Animation: motion path range overwritten by 'Update Paths'
Expand the motion path frame range options with an extra option "Manual
Range". When chosen, Blender will not automatically update the path
range any more.

Additionally, the start/end frame fields are greyed out in the UI when
one of the automatic range options is selected (i.e. all but the new
"Manual Range" one). It is still possible to set the start/end frame
temporarily, but the original behaviour (of recomputing those on update)
remains.

Manifest Task: T101522
2022-12-12 17:36:36 +01:00
014ffc4615 Cycles: using concentric mapping when sampling disk 2022-12-12 17:15:55 +01:00
85d92afbd4 Cleanup: Move asset catalog tree tests to own file
The catalog tree is a unit on its own, and should be tested separately.
This makes the testing files smaller and more focused, which can help
maintaining them.
2022-12-12 17:07:55 +01:00
dbd3822329 Cleanup: Extract asset test class into own header
This manages setting up asset library directories for testing, which is
useful for testing multiple asset library related compontents. So move
it to a common header. No reason to squeeze everything into one file
then.
2022-12-12 16:59:26 +01:00
db68e2d4d3 Build: install shaderc and vulkan libraries for Linux and macOS 2022-12-12 16:54:49 +01:00
d17858cb37 Fix Cycles rectangular area light in volume segment sampled by ellipse 2022-12-12 15:59:04 +01:00
baf8b3bb88 Cleanup: Standardize variable names, use spans to pbvh uv islands. 2022-12-12 14:15:59 +01:00
Alaska
3e1152428d Cleanup: Code comments in tree.h
Differential Revision: https://developer.blender.org/D16751
2022-12-12 12:37:50 +01:00
Jeroen Bakker
9c0d822737 GPU: Compile vulkan shaders to Spir-V binaries.
Compile each static shader using shaderc to Spir-V binaries.

The main goal is to make sure that the GLSL created using ShaderCreateInfo and able to compile to Spir-V.
For the second stage a correct pipeline needs to be created and some shader would need more
adjustments (push constants size).

With this patch future changes to GLSL sources can already be checked against vulkan, without the
backend finished.

Mechanism has been tested using MacOS and MoltenVK. For other OS, we should finetune CMake
files to find the right location to shaderc.

```
************************************************************
*** Build Mon 12 Dec 2022 11:08:07 CET
************************************************************
Shader Test compilation result: 463 / 463 passed (skipped 118 for compatibility reasons)
OpenGL backend shader compilation succeeded.
Shader Test compilation result: 529 / 529 passed (skipped 52 for compatibility reasons)
Vulkan backend shader compilation succeeded.
```

Reviewed By: fclem

Maniphest Tasks: T102760

Differential Revision: https://developer.blender.org/D16610
2022-12-12 12:25:22 +01:00
719513dd9f Tests: make mesh comparisons more strict
Previously, it wouldn't detect the case when one mesh had an attribute
that the other one did not. Not sure if this always was the case or whether
this less strict test was implemented accidentally at some point.
2022-12-12 12:13:33 +01:00
40bc5aa7e5 Cleanup: Comment formatting in normal calculation
But it below the `else` case to make the control flow clearer, since
in the end that is more important. Also clarify the wording and fix
grammar slightly.
2022-12-11 23:28:01 -06:00
8c11c04448 Cleanup: Rename adjacent mesh loop accessors
But the common, more important part of the function names at the
beginning, to make them easier to find and more consistent.
2022-12-11 23:14:01 -06:00
2bb47e03f7 Cleanup: Use Span instead of MutableSpan for normals array 2022-12-11 23:09:03 -06:00
9e9ebcdd72 Mesh: Reduce memory consumption when calculating corner normals
Similar to previous commits, avoid using pointers that are redundant
to their corresponding index. Also avoid storing the edge vectors stack
in the data-per-loop when it can just be a function argument.

Face corner normals are calculated when auto smooth or custom
per-corner normals are used.

This brings the per-face-corner data from 64 to 24 bytes, as measured by
`sizeof`. In a large test file I observed a 20% performance improvement,
from 285 to 239 ms.
2022-12-11 22:47:46 -06:00
f06d7c98db Cleanup: Remove unnecessary MLoop argument
The loop was also retrievable with the index. This needed some care
though, because previously the index became "detached" from the
corresponding MLoop pointer for a short time.
2022-12-11 21:48:52 -06:00
0485baaf98 Cleanup: Reduce use of redundant local variables in normal calculation
Since face corner indices are available, using pointers to MLoop and
other data is redundant. Using fewer local variables means there is less
state to keep track of when reading the algorithm, even if it requires
more characters in some cases.
2022-12-11 21:33:29 -06:00
9338ab1d62 Mesh: Avoid storing redundant pointer in corner normal calculation
The `lnor` pointer was only used for fans containing a single face,
and can be retrieved for a specific loop from the common data anyway.
Also saves 8 bytes per corner during the calculation
2022-12-11 20:30:05 -06:00
178eb5bac5 Cleanup: Add accessor for node index
Add `bNode::index()` to allow accessing node indices directly without
manually de-referencing the runtime struct. Also adds some asserts to
make sure the access is valid and to check the nodes runtime vector.

Eagerly maintain the node's index in the tree so it can be accessed
without relying on the topology cache.

Differential Revision: https://developer.blender.org/D16683
2022-12-11 20:23:18 -06:00
05bf5c4e0e Nodes: simplify handling of function nodes in declaration
This adds an explicit post processing step to node declarations.
The purpose of this is to keep the actual node declaration functions
concise by avoiding to specify redundant information. Also it improves
the separation of the creation of the declaration from using it.
2022-12-11 19:38:26 +01:00
19491e5fc0 Nodes: extract function that builds the node declaration
This also makes it easier to add some post processing on top of
the node-defined declaration.
2022-12-11 19:12:19 +01:00
b2bee8416b Fix oslc precompiled binary not working on macOS due to wrong rpath 2022-12-11 15:08:34 +01:00
c2ca30ea24 Cleanup: avoid calling generic node update functions from versioning code
This made it harder to change these functions in the future.

No functional changes are expected and the versioning worked correctly
in my test with a files created in Blender 2.69.

Adding the sockets in the function was not necessary in my test, because
those were already added before as part of `node_verify_sockets` in
`ntreeBlendReadLib`. I kept it in just to be on the safe side.
2022-12-11 14:15:46 +01:00
f6b67f92a1 Cleanup: unused parameter 2022-12-11 12:39:59 +01:00
fe30856d83 Fix T102992: GPencil Array doesn't respect restriction in Offset
The problem was the bounding box was calculated using
all strokes, but if a filter is added, the bounding box must
include only selected strokes.

Fix by @frogstomp
2022-12-10 13:43:02 +01:00
eac8e820f2 Cleanup: move node tree field inferencing to separate file 2022-12-10 11:32:04 +01:00
Damien Picard
19d90c7a33 UI: fix several labels and tooltips
See the differential revision for details about each change.

Differential Revision: https://developer.blender.org/D15608
2022-12-09 16:10:14 -06:00
Iliya Katueshenock
a9cc10b5bb Geometry Node: Make collection info socket tooltips more consistent
Make hints and descriptions consistent with the new socket name.

Differential Revision: https://developer.blender.org/D16631
2022-12-09 16:10:14 -06:00
Iliya Katueshenock
a3251e66a7 Geometry Nodes: Image Input Node
Add a simple node to choose an image data-block.

Ref T102854

Differential Revision: https://developer.blender.org/D16644
2022-12-09 16:10:14 -06:00
Damien Picard
538d4cc998 UI: Fix and improve various labels and tooltips
Improve a few messages, but mostly fix typos in many areas of the UI.
See inline comments in the differential revisiion for the rationale
behind the various changes.

Differential Revision: https://developer.blender.org/D16716
2022-12-09 16:10:14 -06:00
Iliya Katueshenock
fc5f7a1e2d Cleanup: Use topology cache of group output node
Using a cache greatly simplifies access to the output node.
I touched on the most common and understandable cases for me.
The texture nodes were touched because it looked pretty generic.

Differential Revision: https://developer.blender.org/D16699
2022-12-09 16:10:14 -06:00
Iliya Katueshenock
ad05b78d09 Geometry Nodes: Improve viewer node domain choice for blur node
Add preferred domain based on the "Value" input field. Most often,
the domain must match the original domain for the value.

Differential Revision: https://developer.blender.org/D16730
2022-12-09 16:10:14 -06:00
07b67894e8 Fix macOS precompiled libraries built on Xcode 14 not working in Xcode 13
Disable some symbols amd linking features not available in Xcode 13.
2022-12-09 22:49:31 +01:00
3552f5d83c Build: don't bundle versioned dylib symbolic links on macOS
Apple notarization rejects packages containing them.

Similar to rpaths we handle generically this as part of the harvest step rather
than patches individual library builds systems.

Ref T99618
2022-12-09 22:49:31 +01:00
019b930d6b Fix build error with new USD libraries in debug mode
Solve conflict between TBB and Boost Python.
2022-12-09 22:49:31 +01:00
d5bcc1ef16 Cleanup: Tweak variable name in extrude node
These ranges aren't only used to index corners, also other arrays.
Also use const for some variables, mostly for aesthetic reasons.
2022-12-09 15:22:28 -06:00
d17db1d11a Geometry Nodes: Support original indices in extrude node
This allows using the "On Cage" feature in edit mode to interact with
original mesh elements via the newly created geometry. The original
indices are only set for new elements that copy attribute values
from original elements directly, so it can also be a helpful way
to visualize attribute propagation.

The change was simplified by refactoring the individual mode slightly
to create separate index maps for the new edges and vertices. That
simplified attribute copying a bit too.
2022-12-09 14:26:15 -06:00
46993958fd Geometry Nodes: Support original index layer in split edges node
This is partially a bug fix, since the original index layer wasn't
handled at all before, and could be left initialized. That was caused
by my recent change to modify a mesh in place rather than create a
new one. Also copy over any orco data, which was another unhandled
layer type.

It's also a new feature though, since it allows using the "On Cage"
feature of edit mode to adjust original mesh elements by selecting
the new ones. This brings the functionality inline with the Edge Split
modifier.
2022-12-09 14:26:15 -06:00
b000fc308b Cleanup: Resolve unused variable warnings in modifier 2022-12-09 14:26:15 -06:00
bcbd13201a deps_builder: python updates
- Added comment for additional tasks to do when bumping python
- updated sqlite to 3.39.4
- downgrade setuptools to 63.2.0 to avoid numpy build issues
- numpy 1.23.5
2022-12-09 12:27:44 -07:00
874319a344 Fix T103031: ViewLayer: Crash in indirect_only_get due to missing null check
Previous fix (rBe00f76c6a8cca) accidentally lost a null check.
Fixes T103031.
2022-12-09 20:20:21 +02:00
c85ca5e365 Fix T103015: Line art crash after recent refactor
Caused by 0940719b5a which neglected to assign the
mesh loops data.
2022-12-09 09:24:57 -06:00
0a56198139 Cleanup: Split sharp edge tagging from face corner normal calculation
Don't use the same "context" struct for tagging sharp edges from auto-
smooth / poly flags and actually calculating face corner normals. That
required more arguments, and it required breaking const slightly to
reuse the code. Also split apart pre-populating corner normals
with vertex normals, since it isn't related at all and is only used
in one code path.
2022-12-09 09:13:51 -06:00
9a7fa1b3e9 Cleanup: Use array in face corner normals calculation 2022-12-09 09:13:51 -06:00
34722fa8a0 Cleanup: Reduce indentation in mesh operator
Also use local variable for BMesh.
2022-12-09 09:13:51 -06:00
c20e456ee0 ImageEngine: Reduce memory size by dividing the region in smaller parts.
Image engine uses 4 gpu textures that are as large as the area being
drawn. The amount of needed GPU memory can be reduced by dividing the
region in smaller parts. Reducing the GPU memory also reduces the stalls
when updating the textures, improving the performance as well.

This optimization works, but is disabled for now due to some rounding
errors that drawn lines on the screen where the screen is divided.
2022-12-09 16:10:48 +01:00
bdd196661e Cleanup: ImageEngine-Move Responsibility of Texture Creation.
It used to be a number of fixed full screen images where the
responsibility was at image engine. Now moved the responsibility to the
drawing mode to make sure we can allocate non-full region-size textures
in a future refactoring.
2022-12-09 16:10:48 +01:00
595b302231 Cleanup: Remove unused method BatchUpdater::discard_batch.
Batch discarding is done by the owner of the batch.
2022-12-09 16:10:48 +01:00
255c7f26af Cleanup: Use enum class for image drawing flags. 2022-12-09 16:10:48 +01:00
83b78b1976 Cleanup: Equalize ImageEngine method names with Eevee-next.
- `cache_init` -> `begin_sync`
- `cache_populate` -> `image_sync`
- `draw_scene` -> `draw_viewport`
2022-12-09 16:10:48 +01:00
50ef008c61 Cleanup: Remove unused method from image_engine.
`get_gpu_textures` was created when the image engine didn't support
texture streaming and used the gpu textures that were stored in the
image buffer itself.
2022-12-09 16:10:47 +01:00
5ee116d448 Realtime Compositor: Implement Simple Star Glare node
This patch implements the Simple Star Glare node. This is only an approximation
of the existing implementation in the CPU compositor, an approximation that
removes the row-column dependency in the original algorithm, yielding an order
of magnitude faster computations. The difference due to the approximation is
readily visible in artificial test cases, but is less visible in actual use
cases, so it was agreed that this approximation is worthwhile.

For the future, we can look into approximating this further using a closed form
IIR recursive filter with parallel interconnection and block-based parallelism.
Which is expected to yield another order of magnitude faster computations.

The different passes can potentially be combined into a single shader with some
preprocessor tricks, but doing that complicated that code in a way that makes
it difficult to experiment with future optimizations, so I decided to leave it
as is for now.

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

Reviewed By: Clement Foucault
2022-12-09 17:05:30 +02:00
0d21b9e2da Cleanup: fix compile error on macos 2022-12-09 15:58:13 +01:00
fa27a5d066 Realtime Compositor: Implement Ghost Glare node
This patch implements the Ghost Glare node. It is implemented using
direct convolution as opposed to a recursive one, which produces
slightly different results---more accurate ones, however, since the
ghosts are attenuated where it matters, the difference is barely
visible and is acceptable as far as I can tell.

A possible performance improvement is to implement all passes in a
single shader dispatch, where an array of all scales and color
modulators is computed recursively on the host then used in the shader
to add all ghosts, avoiding usage of global memory and unnecessary
copies. This optimization will be implemented separately.

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

Reviewed By: Clement Foucault
2022-12-09 16:50:52 +02:00
a45284b855 BLI: remove deduplicated memory utility functions
These functions were originally implemented because:
- Not all of them existed pre C++17, but now we are using C++17.
- The call stack depth is quite a bit deeper with the std functions, making
  debugging slower and more annoying. I didn't find this to be a problem
  anymore recently.

No functional changes are expected.
2022-12-09 14:15:41 +01:00
7c5b7713f1 Fix T103001: Width of some compositor nodes is incorrect
Nodes which are common in multiple editors (RGB, Value, Switch, RGB to BW)
has less width in compositor editor. Patch changes compositor node width to
140 for consistency.

Reviewed by: HooglyBoogly

Differential Revision: https://developer.blender.org/D16719
2022-12-09 16:51:34 +05:30
a55c356a1c BLO: shrink old-new-map when it is cleared
This was accidentally changed in {rB57613630c7faa41aa20ae9}.
Not shrinking the map can degrade performance.
2022-12-09 12:07:40 +01:00
bf1791ba92 BLI: add clear-and-shrink method to more data structures
Also renames the existing `clear_and_make_inline` to `clear_and_shrink`
which is more concise.
2022-12-09 12:00:37 +01:00
122d6d67e6 Fix: Points to Volume node crashes with too small radius
OpenVDB likes to crash even in release builds when volumes become too small.
To fix this I used the same function that we use in other places already to
determine if the resulting volume will be too small.
2022-12-09 11:42:10 +01:00
f06a1368bb Cleanup: sanatize namespaces in image engine.
Some files were missing namespaces and sometimes the closing comment of
namespaces were incorrectly placed. No functional changes.
2022-12-09 10:29:34 +01:00
6fb4ca1eec Image Engine: Add assert to check for correct float colorspace.
Float images loaded in Blender are converted to scene linear and don't
require additional conversion. Image engine can reuse the rect_float of
those images. An assert statement is added tp make this more clear and
to test on missing code paths or future developments.
2022-12-09 10:08:51 +01:00
9785f84dd2 Cleanup remove incorrect TODO in image engine.
Float rect is always in scene linear space, so we can always reuse
rect_float when available.
2022-12-09 09:57:52 +01:00
9b57a2ac6a Cleanup: helper function for MeshSequenceCache ORCO evaluation
This splits the logic to detect if the MeshSequenceCache modifier
evaluation is for the ORCO mesh into its own function. This will allow
reusing the logic for when GeometrySet support is added to the modifier
(D11592).

No functionnal changes.

Differential Revision: https://developer.blender.org/D16611
2022-12-09 04:25:29 +01:00
f898190362 GPU: Fix static compilation errors
- Missing explicit cast to `int` for bitwise operator.
- UBO struct member macro colision. Rename fixes it.
2022-12-09 00:10:14 +01:00
c50e25c5f0 BLI: Math: Rename BLI_math_rotation.hh in preparation for new rotation lib
Incoming with the new matrix API (D16625) are the new rotation types.
There is typename colision if we simply reuse the same header.
2022-12-08 23:41:38 +01:00
237fd48d01 Metal: Add back static compilation for no_geom shaders
These are metal specific shaders and needed to be tagged as such before
enabling static compilation.
2022-12-08 23:32:17 +01:00
Jason Fielder
2e61c446ac GPU: Explicit Texture Usage Flags for enabling GPU Backend optimizations.
Texture usage flags can now be provided during texture creation specifying
the ways in which a texture can be used. This allows the GPU backends to
perform contextual optimizations which were not previously possible. This
includes enablement of hardware lossless compression which can result in
a 15%+ performance uplift for bandwidth-limited scenes on hardware such
as Apple-Silicon using Metal.

GPU_TEXTURE_USAGE_GENERAL can be used by default if usage is not known
ahead of time. Patch will also be relevant for the Vulkan backend.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem
Differential Revision: https://developer.blender.org/D15967
2022-12-08 23:31:05 +01:00
Jason Fielder
359d98423e Metal: Fix memory leaks.
Fix a number of small memory leaks in the Metal backend. Unreleased blit
shader objects and temporary textures addressed. Static memory manager
modified to defer creation until use. Added reference count tracker to
shared memory manager across contexts, such that cached memory allocations
will be released if all contexts are destroyed and re-initialized.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem
Differential Revision: https://developer.blender.org/D16415
2022-12-08 23:08:57 +01:00
Jason Fielder
9ec20f2ede Metal: Add support for Workbench Shadows.
Implementing non-geometry-shader path for rendering stencil shadows,
used by the workbench engine.
Patch also contains a few small modifications to Create-info to ensure
usage of gl_FragDepth is explicitly specified.
This is required for testing of the patch.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem
Differential Revision: https://developer.blender.org/D16436
2022-12-08 23:02:59 +01:00
Jason Fielder
a83f2834c7 Metal: Overlay UV Edge support.
Implemented geometry shader alternative for rendering of UV edges in Metal, as geometry shaders are unsupported.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem
Differential Revision: https://developer.blender.org/D16452
2022-12-08 22:23:24 +01:00
18a91ecee7 Fix: Assert failure when joining nodes with frame
The node "index in tree" needs to be updated when adding the frame node.
2022-12-08 15:14:28 -06:00
3d00ac2961 Cleanup: Various improvements to old mesh edge split code
There is a more recent implementation as a geometry node, but this code
is used by RNA and Cycles still. In order to help understand the code
to tell if it can be replaced this makes some small changes:
 - Use indexing instead of pointer incrementing
 - Add const to unchanged arguments
 - Avoid unnecessary indentation
 - Use references for expected non-null arguments
2022-12-08 15:14:28 -06:00
ba523bd010 Cleanup: Reduce indentation in corner normal calculation 2022-12-08 15:14:28 -06:00
a92f2931ce Cleanup: Avoid double negative in face corner normal calculation 2022-12-08 15:14:28 -06:00
ce4c16b7e2 USD: fix startup issue on linux
On linux a man page is generated before the
scripts are installed, this lead to USD getting
a null pointer for it's pluging path and crashing
the process.
2022-12-08 14:08:06 -07:00
ce961c4c2e Cleanup: DRW: Fix style, was missing clang-format 2022-12-08 22:04:14 +01:00
Jason Fielder
2744ee2262 Metal: Enable object selection support
Porting conservative depth rendering to use non-geometry shader path for
Metal.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem
Differential Revision: https://developer.blender.org/D16424
2022-12-08 21:58:00 +01:00
3608af24fd Cleanup: EEVEE: Fix clang-tidy warnings 2022-12-08 21:34:26 +01:00
Jason Fielder
d90a2b0ab7 Metal: GLSL compatibility.
Additional mat3 constructors added, global variable namespace collisions
for uniform and object color avoided via re-name.

Metal vertex format compatibility added for shaders wherein vertex data
goes through a double-conversion and cannot be implicitly converted during
Metal vertex assembly e.g. bitmasks passed directly as unsigned type in
shader interface for certain shader interfaces.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem
Differential Revision: https://developer.blender.org/D16433
2022-12-08 21:30:13 +01:00
6b8bb26c45 EEVEE: Port existing EEVEE shaders and generated materials to use GPUShaderCreateInfo.
Required by Metal backend for efficient shader compilation. EEVEE material
resource binding permutations now controlled via CreateInfo and selected
based on material options. Other existing CreateInfo's also modified to
ensure explicitness for depth-writing mode. Other missing bindings also
addressed to ensure full compliance with the Metal backend.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D16243
2022-12-08 21:12:19 +01:00
2efdbeb58b Cleanup: Organize and comment bNode struct
I organized the fields so that similar variables were closer together and
more "important" fields were closer to the beginning. I also added
comments to help describe the purpose of most fields.

Differential Revision: https://developer.blender.org/D16710
2022-12-08 11:59:06 -06:00
570acac795 Geometry Nodes: Improve switch node search for booleans
Prioritize the "Switch" input for boolean sockets, since that is by
far the most common goal when connecting a boolean to the
switch node.
2022-12-08 11:59:06 -06:00
01fb8a555b Nodes: Improve search weights for mix node sockets
Based on feedback from Simon Thommes, for link-drag-serach it's most
useful to have the A and B sockets connected, first, then the factor
sockets, then the special color mix operations. This addresses that by
adding the search items in order and decrementing a weight manually
as items are added.
2022-12-08 11:59:06 -06:00
62434a9d21 Geometry Nodes: Improve search weight for named attribute exists socket
Weight the "Exists" output below the "Attribute" output. This would
happen automatically if we had proper multi-type sockets.
2022-12-08 11:59:06 -06:00
b20e89f69c Cleanup: Return early in mix node link-drag-search
Also simplify the handling for different socket types a bit.
2022-12-08 11:59:06 -06:00
508815cc71 UI: Correct improper capitalization
Fixes T103034
2022-12-08 11:26:31 -06:00
009047ee0a Cleanup: remove unused variable and simplify computation in the light tree 2022-12-08 18:24:49 +01:00
8e46ef2fa5 Sculpt: Fix crash when sculpting after disabling dyntopo
Attributes weren't being reinitialized properly.
2022-12-08 04:40:42 -08:00
a84384a56f Geometry Nodes: fallback to point domain in viewer instead of corners
For people it's usually unexpected that the node uses the corner domain because
one thinks about the points in most cases.
2022-12-08 13:09:37 +01:00
4dbb8e96c2 Cleanup: silence warning
Unused parameter in `mesh_merge_by_distance.cc`
2022-12-08 08:53:05 -03:00
Alaska
a21d948fd7 Fix mesh light brightness when not using the light tree
The PDF of mesh lights were not being scaled by `pdf_selection` when
the light tree was disable. This resulted in the mesh lights having
the wrong PDF and thus the wrong brightness.

Differential Revision: https://developer.blender.org/D16717
2022-12-08 11:54:28 +01:00
96e1684a9d Cleanup: USD, pass object & mesh as const to USD_mesh_topology_changed
Make the `Object *` and `Mesh *` parameter of `USD_mesh_topology_changed()`
`const`. This function only inspects them, and doesn't need to modify
them.

No functional changes.
2022-12-08 10:48:09 +01:00
3780a40265 Fix T93829: Stop header text from jiggling while resizing the region
Since moving to float scaling, the method of accessing the text
width with the aspect applied wasn't working properly.

Based on contributions by @lone_noel & @harley, see D15043.
2022-12-08 14:58:00 +11:00
a132b068bc Cleanup: use ELEM macro 2022-12-08 13:59:42 +11:00
a0dc062816 Cleanup: use function style casts for integer types in C++ 2022-12-08 13:47:55 +11:00
cb45b0bb2a Cleanup: spelling in comments 2022-12-08 13:47:55 +11:00
a5d391919c Cleanup: format 2022-12-08 13:46:26 +11:00
04693f9074 Mesh: small optimization and better readability in Merge by Distance
The optimization is done by removing the `len` member from the groups
and using fewer `for` loops.

But it's not a really impactful optimization.
Only 1.9% in the weld operation of a high poly mesh.
(disregarding getting the vertex map and all other operations on a
Blender frame).

The readability improvement comes from using more familiar types like
`int` and `int2` instead of `WeldGroup` and `WeldGroupEdge` structs.
2022-12-07 23:10:20 -03:00
4e3494b588 Cleanup: rename 'ofs' to 'offs'
Also remove unnecessary `wegroups` variable.

Also, don't create the `wegroups` variable just to rename another one.
2022-12-07 21:34:28 -03:00
81b9a475d3 Cleanup: remove inactive and outdated code
`USE_WELD_NORMALS` no longer works
2022-12-07 19:55:46 -03:00
8410e7f857 Cleanup: use more descriptive names for variables
In the merge_by_distance code, `vert_dest_map` is modified to become a
vertex group map. But this is not clear from the code.

Also use the `_map` suffix on `vert_final` and `edge_final`.

And remove some unnecessary variables.
2022-12-07 19:55:46 -03:00
a63a41177d Fix: Uninitialized variable in mesh primitive refactor
Caused by ff324ab716
2022-12-07 16:28:51 -06:00
c082ebfaa5 Compositor: Remove non operational UI property for directional blur node
The wrap function was a feature of the old compositor
but was never ported to the new CPP compositor node.

This simply removes the unused property, the function could alternatively be
restored but in has been missing for a decade so it does not seem missed.

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

Fixes T102796
2022-12-07 15:48:41 -06:00
Michal Srb
be5afe9987 PyAPI Docs: Add default values for bmesh API
This diff improves the docs for bmesh by adding the default values to all methods. This is motivated by this issue https://github.com/nutti/fake-bpy-module/issues/118 in fake-bpy-module which generates a typed API for authoring Blender scripts and addons from the docs.

After this diff gets merged, the Blender docs get updated, and `fake-bpy-module` gets regenerated, the type signatures in `fake-bpy-module` will match the reality of Blender's API.

Here's a diff for the docs using the modified script:
https://gist.github.com/xixixao/1c83153adbcefbe0859f9cc9ba757d46

I "hardcoded" the defaults based on the types of the arguments, after some testing and consulting the Blender .c source for these APIs.

Here's a test script that verifies that the arguments with defaults added in this diff are indeed not required by Blender 3.3: https://gist.github.com/xixixao/adc4e5a076e80a63735bd60c7c9e7a0d

I made the minimum changes required to get this doc generation script fixed, but let me know if I should restructure this script more.

I also amended the comments of three args, 2 to align them with Python (NULL -> None) and one to mark it as optional (CurveProfile).

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D16400
2022-12-07 15:48:41 -06:00
3494ba3815 Python: update to version 3.10.9
Among other bugs, this fixes an issue with Python libs built on macOS 13 not
working on older macOS versions (bug gh-97897 in Python).

Ref T99618
2022-12-07 21:32:52 +01:00
fedef4c13a Fix cycles_test link error on macOS due to boost python in new 3.5 libraries
The executable would get boost python linking in when not needed, and even when
linking to Python libraries there were still unresolved symbols. Instead split
off boost python libraries and link them only where needed.
2022-12-07 20:45:47 +01:00
bf18032977 Cycles: support spread angle 0 for area lights
Ref: T87053
2022-12-07 20:05:20 +01:00
c2dc65dfa4 Fix Cycles HIP compiler error for some architectures even with light tree off
Revert some refactoring that is not strictly necessary and causes issues for
unknown reasons.
2022-12-07 19:56:51 +01:00
bbfb074155 Fix macOS tests failures with new libraries on buildbot
Don't assume a trailing slash in the install path.
2022-12-07 19:56:51 +01:00
f68634a379 Cleanup: store tan instead of cot in area lights to increase precision 2022-12-07 18:54:41 +01:00
Leszek Godlewski
07d3a3962a Fix Cycles build in VS2022, use explicit two's complement in find_first_set()
Compiling Cycles in Visual Studio 2022 yields the error:
C4146: unary minus operator applied to unsigned type, result still unsigned

Replacing it with explicit two's complement achieves the same result as signed
negation but avoids the error.

Differential Revision: https://developer.blender.org/D16616
2022-12-07 18:34:57 +01:00
howetuft
937130a294 Cycles: apply basic gamma correction in stadalone OpenImageIO output driver
For file formats like PNG, JPEG and TIFF. Eventually this should use
the OpenColorIO view transform, but this at least makes the image
closer to what it should be in most cases.

Differential Revision: https://developer.blender.org/D16482
2022-12-07 18:34:57 +01:00
ec04870091 Fix Cycles standalone float textures not taking into account colorspace metadata
This got lost in colorspace refactoring at some point. It probably does not
affect many files in practice, but implementation was wrong regardless.
2022-12-07 18:34:57 +01:00
f627abea2d Fix Cycles Hydra build issue with USD 22.05
Thanks to Alex Fuller for proposing the solution.
2022-12-07 18:34:57 +01:00
Thomas Lindemeier
d70ef8dbf1 Fix Cycles Hydra segmentation fault in usdview
Ensure render buffer is allocated when calling WritePixels.

Differential Revision: https://developer.blender.org/D16272
2022-12-07 18:34:57 +01:00
904cab0418 Fix Cycles Hydra build errors
Still initializing GLEW after libepoxy switch, and ellipse area light.
2022-12-07 18:34:27 +01:00
Iliya Katueshenock
d68c47ff34 Geometry Nodes: new Blur Attribute node
The Blur Attribute node mixes values of neighboring elements in meshes and curves.

Currently it supports points, edges and faces on meshes and points on curves.
In theory, support for face corners could be added, but useful semantics are not
obvious yet.

The node calculates a weighted average of each element with its neighbors (based
on curve/mesh topology). The weight of the element itself is always 1, and the weight
of the neighbor elements is controlled by the weight input socket. In the future,
more options for how different elements are weight can be added (e.g. smoothing
groups and selection).

The node can perform multiple blurring iterations to achieve a blurrier result.
Generally, it is better to do multiple iterations in one node instead of using
multiple blur nodes because it has better performance in the current implementation.

We use the term "Blur" (instead of "Smooth") because smoothing is generally more
related to removing roughness from surfaces. When viewing the result of the
Blur Attribute node in the viewport, it looks like an image is blurred. While the
node can also be used to smooth surfaces, other/better algorithms exists for that
purpose (which e.g. don't reduce the volume of the mesh to zero with too many
iterations).

Differential Revision: https://developer.blender.org/D13952
2022-12-07 18:22:44 +01:00
53ef52f165 Cycles: improve sampling of ellipse area light with spread
**Problem**:
Area lights in Cycles have spread angle, in which case some part of the area light might be invisible to a shading point. The current implementation samples the whole area light, resulting some samples invisible and thus simply discarded. A technique is applied on rectangular light to sample a subset of the area light that is potentially visible (rB3f24cfb9582e1c826406301d37808df7ca6aa64c), however, ellipse (including disk) area lights remained untreated. The purpose of this patch is to apply a techniques to ellipse area light.
**Related Task**:
T87053
**Results**:
These are renderings before and after the patch:
|16spp|Disk light|Ellipse light|Square light (for reference, no changes)
|Before|{F13996789}|{F13996788}|{F13996822}
|After|{F13996759}|{F13996787}|{F13996852}
**Explanation**:
The visible region on an area light is found by drawing a cone from the shading point to the plane where the area light lies, with the aperture of the cone being the light spread.
{F13990078,height=200}
Ideally, we would like to draw samples only from the intersection of the area light and the projection of the cone onto the plane (forming a circle). However, the shape of the intersection is often irregular and thus hard to sample from directly.
{F13990104,height=200}
Instead, the current implementation draws samples from the bounding rectangle of the intersection. In this case, we still end up with some invalid samples outside of the circle, but already much less than sampling the original area light, and the bounding rectangle is easy to sample from.
{F13990125}
The above technique is only applied to rectangle area lights, ellipse area light still suffers from poor sampling. We could apply a similar technique to ellipse area lights, that is, find the
smallest regular shape (rectangle, circle, or ellipse) that covers the intersection (or maybe not the smallest but easy to compute).
For disk area light, we consider the relative position of both circles. Denoting `dist` as the distance between the centre of two circles, and `r1`, `r2` their radii. If `dist > r1 + r2`, the area light is completely invisible, we directly return `false`. If `dist < abs(r1 - r2)`, the smaller circle lies inside the larger one, and we sample whichever circle is smaller. Otherwise, the two circles intersect, we compute the bounding rectangle of the intersection, in which case `axis_u`, `len_u`, `axis_v`, `len_v` needs to be computed anew. Depending on the distance between the two circles, `len_v` is either the diameter of the smaller circle or the length of the common chord.
|{F13990211,height=195}|{F13990225,height=195}|{F13990274,height=195}|{F13990210,height=195}
|`dist > r1 + r2`|`dist < abs(r1 - r2)`|`dist^2 < abs(r1^2 - r2^2)`|`dist^2 > abs(r1^2 - r2^2)`
For ellipse area light, it's hard to find the smallest bounding shape of the intersection, therefore, we compute the bounding rectangle of the ellipse itself, then treat it as a rectangle light.
|{F13990386,height=195}|{F13990385,height=195}|{F13990387,height=195}
We also check the areas of the bounding rectangle of the intersection, the ellipse (disk) light, and the spread circle, then draw samples from the smallest shape of the three. For ellipse light, this also detects where one shape lies inside the other. I am not sure if we should add this measure to rectangle area light and sample from the spread circle when it has smaller area, as we seem to have a better sampling technique for rectangular (uniformly sample the solid angle). Maybe we could add [area-preserving parameterization for spherical
ellipse](https://arxiv.org/pdf/1805.09048.pdf) in the future.
**Limitation**:
At some point we switch from sampling the ellipse to sampling the rectangle, depending on the area of the both, and there seems to be a visible line (with |slope| =1) on the final rendering
which demonstrate at which point we switch between the two methods. We could see that the new sampling method clearly has lower variance near the boundaries, but close to that visible line,
the rectangle sampling method seems to have larger variance. I could not spot any bug in the implementation, and I am not sure if this happens because different sampling patterns for ellipse and rectangle are used.
|Before (256spp)|After (256spp)
|{F13996995}|{F13996998}

Differential Revision: https://developer.blender.org/D16694
2022-12-07 18:21:55 +01:00
Jason Fielder
96b6ea9ee6 Fix T102944: fix Cycles viewport issues on macOS + NVIDIA
Part of the workaround for NVIDIA driver issue got lost in the changes to
switch to the GPU module.

Differential Revision: https://developer.blender.org/D16709
2022-12-07 18:18:33 +01:00
0361afb165 GPencil: Fix unreported interpolate crash if no frames
If there is a layer that hasn't frames but is not the active layer
the pointer to frames can be NULL and crash.

Now, the empty layers are skipped.

Reported to me by Samuel Bernou.
2022-12-07 17:23:50 +01:00
d384ad38bc cmake: fix windows debug build
debug library for yaml-cpp was set to an incorrect name
2022-12-07 09:22:32 -07:00
2ffc9b72ad Draw: Improve performance image engine.
Image engine is used to draw the image inside the image editor, uv editor and node editor. The
performance during scrolling wasn't smooth when using larger textures on a dedicated GPU. Main
reason was the data transfers that happens when panning the image.

The original idea of the image engine was to have 4 textures that are as large as the editor.
Those textures would be used to simulate a larger canvas where if the texture is out of the
visible area the texture would be reused to contain the data of a new visible area. This would
reduce the data transfers to only on certain x/y coordinates. Between those coordinates no
data transfers would be needed.

This patch implements the mechanism described above. During development other areas to
improve have been detected (incorrect color management for float textures, using different
image formats to reduce data transfer bandwidths, using different render techniques for
images upto 8k). More improvements will follow.
2022-12-07 15:40:22 +01:00
f423c4191f Cycles: credit the original light tree paper and explain modifications 2022-12-07 15:38:09 +01:00
d8ffb4655c Fix missed libraries in auto CMake config update for 3.5 libraries 2022-12-07 15:37:06 +01:00
388bbc3290 Build: library updates for Blender 3.5
This updates the libraries dependencies for VFX platform 2023, and adds various
new libraries. It also enables Python bindings and switches from static to
shared for various libraries.

The precompiled libraries for all platforms will be updated to these new
versions in the coming weeks.

New:

Fribidi 1.0.12
Harfbuzz 5.1.0
MaterialX 1.38.6 (shared lib with python bindings)
Minizipng 3.0.7
Pybind11 2.10.1
Shaderc 2022.3
Vulkan 1.2.198

Updated:

Boost 1.8.0 (shared lib)
Cython 0.29.30
Numpy 1.23.2
OpenColorIO 2.2.0 (shared lib with python bindings)
OpenImageIO 2.4.6.0 (shared lib with python bindings)
OpenSubdiv 3.5.0
OpenVDB 10.0.0 (shared lib with python bindings)
OSL 1.12.7.1 (enable nvptx backend)
TBB (shared lib)
USD 22.11 (shared lib with python bindings, enable hydra)
yaml-cpp 0.8.0

Includes contributions by Ray Molenkamp, Brecht Van Lommel, Georgiy Markelov
and Campbell Barton.

Ref T99618
2022-12-07 15:28:17 +01:00
6d27a2ff76 Windows: install shared libraries in blender.shared
Instead of the the same folder as the Blender executable, generate a manifest
that lets us move the libraries out of the way of users and into a separate
folder.

Ref T99618
2022-12-07 15:28:17 +01:00
20883841c7 Linux: stop using static libstdc++ for release builds
This is not compatible with upcoming shared libraries usage, where we can't
let each library have their own libstdc++ and safely exchange memory.

Hopefully it is no longer required either. This is from before Blender builds
were even made on CentOS 7, and there is no obvious reason it is still needed.

Ref T99618
2022-12-07 15:28:17 +01:00
70375c96d5 USD: prepare for building with Python support and shared libraries
Shared libraries and USD plugins will be placed in the same folder, where USD
already looks for plugins.

This means that specifying the path to the plugins will no longer be needed
once the new libraries are available for all platforms. For now the code was
refactored to support both cases.

Ref T99618
2022-12-07 15:28:17 +01:00
ebff39d5bb Build: make running executables as part of build/tests work with shared libs
Ensure the environment is set up for blender_test, idiff and oslc so that they
can find the required shared libraries.

Also deduplicate add_bundled_libraries() between Linux and macOS.

Includes contributions by Ray Molenkamp and Brecht Van Lommel.

Ref T99618
2022-12-07 15:28:17 +01:00
2dc51fccb8 Fix T101787, T102786. Cycles: Improved out-of-memory messaging on Metal
This patch adds a new `max_working_set_exceeded()` check on Metal so that we can display a "System is out of GPU memory" message to the user. Without this, we get obtuse "CommandBuffer failed" errors at render time due to exceeding the size limit of resident resources.

Likely fix for T101787 & T102786.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16713
2022-12-07 13:56:21 +00:00
4d05a000cb Fix light tree header file included while feature disabled 2022-12-07 14:47:11 +01:00
f8ddf16e5a Cleanup: Typo in comment 2022-12-07 14:44:45 +01:00
cc1ba74ce2 Fix T102966: Curves editmode selection drawing not stable / flickering
Issue was the lifetime of GPUVertFormat & GPUVertAttr.
Both need to be static in the function to be persistent here (and
handled appropriately).

Was an error in rB319ee296fd0c.

Maniphest Tasks: T102966

Differential Revision: https://developer.blender.org/D16704
2022-12-07 09:40:54 +01:00
0b85d6a030 3D View: support canceling viewport operations
Support Esc / RMB to cancel dolly, move, rotate & zoom.
Previously only roll could be canceled.

This can be useful to temporary orbit away from the camera or an
orthographic view without having to manually set it back.
2022-12-07 17:45:24 +11:00
dcd4eb4c25 Cleanup: minor refactor to view operator event handling
- Add VIEW_CANCEL event_code.
- De-duplicate operator freeing logic for the roll operator.
- Structure checks so adding cancel is is simplified.
- Split event checks into two blocks, one for model events, another
  for all other events.
2022-12-07 17:45:24 +11:00
0e90896cba Cleanup: simplify udim parameters when uv packing
Migrate (some) of the UDIM offset calculation from inside one
of the packing engines (where it's consumed) to the packing
operator (where it's produced).

This change (and others) will help simplify the future migration
of the packing engine inside editors/uvedit/uvedit_islands.cc
to the Geometry module, so it can eventually replace the other
packing engine in geometry/intern/uv_parametrizer.cc
2022-12-07 15:30:13 +13:00
a5f9f7e2fc OBJ: Avoid retrieving mesh arrays, improve const correctness
Store the potentially owned mesh separately from the original/evaluated
mesh which is now stored with a const pointer. Also store mesh spans
separately in the class so they don't have to be retrieved for every
index.
2022-12-06 15:26:42 -06:00
a459018a99 Cleanup: Simplify naming in UV sphere primitive
It's obvious that these are indices, no need for it to be part of names.
2022-12-06 14:25:43 -06:00
c1d4105005 Cleanup: Remove unnecessary indentation in cone primitive
The loop is skipped if there are zero iterations anyway.
2022-12-06 14:25:43 -06:00
ff324ab716 Cleanup: Make mesh primitive topology building more parallel
Avoid using an incremented "loop index" variable which makes the whole
data-filling necessarily sequential. No functional changes expected,
this just simplifies some refactors to face corner storage.
2022-12-06 14:25:43 -06:00
fd9b197226 GPU: Fix using FLOAT_2D_ARRAY and FLOAT_3D textures via Python.
Translation from python enum values were incorrect and textures created
in python using those types would result in faulty textures. In
renderdoc those textures would not bind.
2022-12-06 20:16:39 +01:00
3124241256 Fix Cycles SSE4 define for fast math rint function.
Differential Revision: https://developer.blender.org/D16708
2022-12-06 19:06:43 +01:00
48b5dcdbe8 Animation: Removal of most of the old pose library
Remove most of the old (pre-3.0) pose library:

- Remove The entire `editors/armature/pose_lib.c` file
- Deprecate `Object::poselib` in DNA
- Remove Operators marked as deprecated in T93405
- Remove RNA property `Object.pose_library`
- Add comment to clarify that the call `BLO_read_id_address(reader,
  ob->id.lib, &ob->poselib);` handles deprecated data.

Note that this functionality has been documented as deprecated since
Blender 3.2.

What remains of the old pose library: The DNA for action markers
(`bAction::markers`) and the corresponding Python API. This will allow
future versions of Blender to still convert old pose libraries to new
ones (via the Pose Library panel in the Action editor).

Manifest task: T93406
2022-12-06 18:37:10 +01:00
de9f32a666 Merge branch 'blender-v3.4-release' 2022-12-06 18:27:44 +01:00
38e1b92b7a Fix T102964: Key-map event type values changed for NDOF buttons
Regression in [0] changed NDOF key-map values.

Restore the previous values & add missing view buttons to
rna_enum_event_type_items.

[0]: ecda118be4

Differential Revision: https://developer.blender.org/D16701
2022-12-06 18:26:24 +01:00
7d99c51e17 Cycles: enable light tree again
Bugs that caused wrong renders should be fixed now, and tests that showed minor
floating point differences on platforms were tweaked to sidestep the problem.

Ref T77889
2022-12-06 18:18:53 +01:00
bc9548da80 Merge branch 'blender-v3.4-release' 2022-12-06 18:05:08 +01:00
Joseph Eagar
31ccf79011 Fix T102336: dynamic topology crash
Ensure there is always an active vertex when a face is hit.

Differential Revision: https://developer.blender.org/D16705
2022-12-06 18:03:26 +01:00
658220e815 Fix T101245: Allow Thumbnails of > 256:1 Images
Ensure that thumbnails of images with aspect greater than 256:1 have
dimensions of at least one pixel.

See D16707 for more details

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

Reviewed by Brecht Van Lommel
2022-12-06 08:17:50 -08:00
64541b242a Fix T102940: "Mask by Color" sculpt tool crash
We need to ensure the mask layer exists before running the operator.
I made the order of function calls here the same as in newer code later
on in this file for consistency.

Differential Revision: https://developer.blender.org/D16696
2022-12-06 08:17:50 -08:00
87582d95df Fix T101245: Allow Thumbnails of > 256:1 Images
Ensure that thumbnails of images with aspect greater than 256:1 have
dimensions of at least one pixel.

See D16707 for more details

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

Reviewed by Brecht Van Lommel
2022-12-06 08:15:05 -08:00
995f757049 Fix T102940: "Mask by Color" sculpt tool crash
We need to ensure the mask layer exists before running the operator.
I made the order of function calls here the same as in newer code later
on in this file for consistency.

Differential Revision: https://developer.blender.org/D16696
2022-12-06 10:00:12 -06:00
16b6116b9d Fix Cycles light tree render errors on Windows
Due to mistake in popcount implementation. Thanks to Weizhen for help
figuring this out.
2022-12-06 16:52:15 +01:00
8f213e7436 Merge branch 'blender-v3.4-release' 2022-12-06 16:39:51 +01:00
37b02b0432 Fix T102965: Crash when compiling shader tree with undefined mix nodes
node_set_typeinfo leaves the bNode::type value as-is for nodes with undefined types.
2022-12-06 16:39:21 +01:00
adea6681c0 Merge branch 'blender-v3.4-release' 2022-12-06 16:35:44 +01:00
212b054bb3 Update freedesktop file with Blender 3.4 features. 2022-12-06 16:34:53 +01:00
6428c847fd Cycles oneAPI: clarify Linux Driver requirements in GUI
"Linux Driver" wasn't precise enough for users, the actual driver
requirement is on "Intel® Graphics Compute Runtime for oneAPI Level Zero
and OpenCL™ Driver", ie. https://github.com/intel/compute-runtime /
intel-level-zero-gpu package.

This follows-up the discussion on
https://developer.blender.org/rBff89c1793d8c75615ed43248def25812ec13e6e3
2022-12-06 13:21:19 +01:00
67dd652557 Tests: anim keylist test, avoid interaction between checks
Simplify checks so that one check doesn't influence the following one.

Checks no longer pass the last-visited frame number into the "start frame"
parameter of the next check. This way all test values are hard-coded and
easy to read, without having to understand how all the checks fit together.

No functional changes.
2022-12-06 12:27:16 +01:00
979930f8b6 Test: animation, avoid segfault in keylist unit tests
Replace `EXPECT_NE(column, nullptr)` with `ASSERT_NE(column, nullptr)` to
abort the test on failure. With `EXPECT_NE`, the test would continue onto
the next like, which accesses `column->cfra` and would segfault.

No functional changes to the tests. Just better reporting of failures.
2022-12-06 12:27:16 +01:00
997ff54d30 Fix: UI: broken texpaintslot/color attributes/attributes name filtering
rB8b7cd1ed2a17 broke this for the paint slots
rB4669178fc378 broke this for regular attributes

Name filtering in UI Lists works when:
- [one] the items to be filtered have a name property
-- see how `uilist_filter_items_default` gets the `namebuf`
- [two] custom python filter functions (`filter_items`) implement it
themselves
-- if you use `filter_items` and dont do name filtering there, the default
name filtering wont be used

So, two problems with rB8b7cd1ed2a17:
- [1] items to be listed changed from `texture_paint_images` to
`texture_paint_slots`
-- the former has name_property defined, the later lacks this
- [2] the new `ColorAttributesListBase` defined a `filter_items` function,
but did not implement name filtering

And the problem with rB4669178fc378:
- it added `filter_items` functions, but did not implement name filtering.

These are all corrected now.

Fixes T102878

Maniphest Tasks: T102878

Differential Revision: https://developer.blender.org/D16676
2022-12-06 11:09:28 +01:00
31943d1313 Fix T102937: "view3d.view_roll" operator conflicts with RMB invocation
When RMB is used to start the operator, don't use it for canceling.
2022-12-06 20:50:51 +11:00
ea14c48c09 Fix T102276: Hotkey conflict Alt D in Node Editor with Duplicate Linked and Detach
This unassign the Alt+D shortcut from the detach operator. Right now the
operator has to be accessed via the menu.

Alt+D is left for duplicate link, following the other editors.
2022-12-06 09:45:20 +01:00
979b295154 Fix incorrect cursor motion coordinates for WIN32
Cursor motion events on windows read the position from GetCursorPos()
which wasn't always the same location stored in `lParam`.

In situations where events were handled immediately this wasn't often a
problem, for heavier scenes or when updates between event handling was
slow - many in-between cursor events would be incorrect.

This behavior dates back to the initial commit, there doesn't seem to be
a good reason not to use the cursor coordinates from the event.

Noticed when investigating T102346.
2022-12-06 17:18:01 +11:00
d486f33d63 GHOST: OpenGL errors now use "file:line: " contention for errors
Make OpenGL errors match formatting used by GCC & clang
(as well as Blender's logging), so utilities that recognize this
convention can be used to quickly access this location.
2022-12-06 14:48:38 +11:00
f68e50a263 WM: operators that add their own undo pushes now clears the redo panel
Detect when the operator adds its own undo step and clear the panel.

An alternative fix for [0] which caused T101743.

Needed to prevent changing values in the last operator panel from
destructively undoing brush steps.

[0]: 11bdc321a2.

Reviewed By: mont29, joeedh

Ref D16523
2022-12-06 14:01:36 +11:00
7465aa8965 Merge branch 'blender-v3.4-release' 2022-12-06 13:47:40 +11:00
26f66e1423 Revert "Sculpt: Register sculpt brush op so it clears last operator panel"
This reverts commit 11bdc321a2.

This change caused T101743, in general OPTYPE_UNDO should not be used
to control the UI.

This also caused 2x undo pushes to be performed when sculpting,
although sculpt mode doesn't add a step for the second undo push
so it wasn't visible to the user.

An alternative fix will be applied separately as it's too risky this
close to a release.
2022-12-06 13:45:20 +11:00
db54b99ee1 BLI_path_util: support both forward and back slashes for WIN32
The following functions only supported back slashes on WIN32,
which can use both forward and back slashes.

- BLI_path_append
- BLI_path_append_dir
- BLI_path_slash_ensure
- BLI_path_slash_rstrip

Follow up to [0] which is a more limited bug-fix.

[0]: a16ef95ff6
2022-12-06 13:28:39 +11:00
ed0125afe5 Merge branch 'blender-v3.4-release' 2022-12-06 13:19:04 +11:00
a16ef95ff6 Fix T102914: bpy.ops.wm.append no longer supports / in paths for WIN32
Support both forward and back slashes on WIN32.

Forward slashes for paths in WIN32 was removed in [0] (for BLI_path_join)
& [1] (for BLI_path_name_at_index), this is correct on UNIX as back
slashes can be used in paths but not on WIN32 which can use both.

Note that other path functions such as BLI_path_append &
BLI_path_slash_ensure should be updated too, but this is out of scope
for a bug-fix.

Documenting and ensuring Windows path handling functions all handle
forward slashes can be done separately.

[0]: 8f7ab1bf46
[1]: 511ae22264

Reviewed By: harley

Ref D16700
2022-12-06 13:09:47 +11:00
f450d39ada Fix T84078: improve UV unwrapping for quads with an internal reflex angle
When triangulating meshes, the UV unwrapper was previously using a
heuristic to split quads into triangles. If one of the internal angles
is greater than 180degrees, a so-called "reflex angle", the heuristic
was giving a poor choice of split.

Instead of using a special case for quads, this change routes everything
through the generic n-gon `BLI_polyfill_beautify` method instead.

Reviewed By: Brecht Van Lommel

Differential Revision: https://developer.blender.org/D16505
2022-12-06 13:56:02 +13:00
644afda7eb Fix T102543: improve uv unwrapping with n-gons and shared vertices
When n-gons share vertices, their triangulation can be non-manifold,
even if the original mesh is manifold.

The UV Unwrapper does not currently work with non-manifold meshes.

This workaround attempts to modify the triangulation of n-gons in
the UV unwrapper to preserve the manifold property.

This change replaces the previous fix for quads, and extends it
to all n-gons.

See T84078 as motivation for this change.

Differential Revision: https://developer.blender.org/D16521
2022-12-06 13:42:24 +13:00
7a12934f1e Merge branch 'blender-v3.4-release' 2022-12-06 11:12:53 +11:00
e29068aaed Cleanup: remove unused argument 2022-12-06 10:37:15 +11:00
Ramil Roosileht
587a1b16ae Attributes: Autofill for attribute conversion operators
Make "Convert Attribute" and "Convert Color Attribute" operators
auto-fill their initial settings with active attribute's domain
and data type if it wasn't already set explicitly.

Differential Revision: https://developer.blender.org/D16550
2022-12-05 16:30:50 -06:00
294e41477b Fix T102961: mirrored vertices sometimes get locked in transform
Two vertices within the threshold can mirror each other causing neither
to be transformed.
2022-12-05 19:11:11 -03:00
0808eaf44e Cycles: temporarily disable light tree again due to platform differences
Regression tests are failing with some platform/compiler combinations, and
fixing this is taking some time.

Ref T77889
2022-12-05 21:57:43 +01:00
5270610b29 Fix Cycles uninitialized variables in mesh light sampling
Causing wrong renders and differences between platforms.
2022-12-05 20:20:51 +01:00
1af8ddf69f Merge branch 'blender-v3.4-release' 2022-12-05 12:47:25 -06:00
c82749c0c0 Fix: memory leak in curve circle primitive node 2022-12-05 12:33:43 -06:00
2ce6ac462b Cleanup: Const correctness for node find functions
You shouldn't be able to retrieve a mutable node from a const node tree
or a mutable socket from a const node. Use const_cast in one place in
order to correct this without duplicating the function, which is still
awkward in the C-API.
2022-12-05 11:37:55 -06:00
ca2ca0ce5d Geometry Nodes: add instance test category 2022-12-05 17:56:47 +01:00
f646a4f22c Cleanup: renaming tan_spread to cot_half_spread to avoid ambiguity
Differential Revision: https://developer.blender.org/D16695
2022-12-05 17:04:04 +01:00
ee89f213de Cycles: improve many lights sampling using light tree
Uses a light tree to more effectively sample scenes with many lights. This can
significantly reduce noise, at the cost of a somewhat longer render time per
sample.

Light tree sampling is enabled by default. It can be disabled in the Sampling >
Lights panel. Scenes using light clamping or ray visibility tricks may render
different as these are biased techniques that depend on the sampling strategy.

The implementation is currently disabled on AMD HIP. This is planned to be fixed
before the release.

Implementation by Jeffrey Liu, Weizhen Huang, Alaska and Brecht Van Lommel.

Ref T77889
2022-12-05 16:09:03 +01:00
0731d78d00 Cycles: remove shadow pass
This was not working well in non-trivial scenes before the light tree, and now
it is even harder to make it work well with the light tree. It would average the
with equal weight for every light object regardless of intensity or distance, and
be quite noisy due to not working with multiple importance sampling.

We may restore this if were enough good use cases for the previous implementation,
but let's wait and see what the feedback is.

Some uses cases for this have been replaced by the shadow catcher passes, which
did not exist when this was added.

Ref T77889
2022-12-05 15:52:10 +01:00
ccae00c9e2 Fix: memory leak in curve circle primitive node 2022-12-05 15:34:54 +01:00
83077d3683 Fix: wrong pivot point output in String to Curves node
The issue was that using `curves.bounds_min_max` included the radius
which does not make sense in this context.
2022-12-05 13:20:30 +01:00
44ab02fc5c Geometry Nodes: add texture regression test category 2022-12-05 12:06:18 +01:00
42b51bf6a9 Fix T102571: Can't stop audio playback when using multiple windows
Traverse all scene dependency graphs and stop audio playback for each
scene.

Also fixes T71233

Reviewed By: sergey, mont29

Differential Revision: https://developer.blender.org/D16646
2022-12-05 04:45:38 +01:00
9cb061f4f0 Cleanup: spelling in comments 2022-12-05 12:58:18 +11:00
0dee238c8c Cleanup: remove duplicate doc-strings
Duplicating doc-strings in both header & implementation
should be avoided as they often diverge & maintaining them is more work.
2022-12-05 12:54:04 +11:00
2b914a2ecb Cleanup: correct misspelling of occurrence 2022-12-05 12:54:02 +11:00
cc6bdac921 Cleanup: format 2022-12-05 12:54:00 +11:00
997e143a50 Cleanup: quiet compiler warnings 2022-12-05 12:53:56 +11:00
9719fd6964 Cleanup: format 2022-12-03 10:53:44 +13:00
Iliya Katueshenock
18e386613c Attributes: Remove asserts for DefaultMixer negative weight
The attribute smoothing node asks for the ability to have a factor
outside the range of 0 and 1. The problem with this is that there is a
negative weight assertion for some of the mixers. If mixing between 0
and 1, then at a factor of 2, one of the elements will be negative.

Differential Revision: https://developer.blender.org/D16351
2022-12-02 14:44:54 -06:00
ce16fa0f4c Fix: Node Editor: Hide compoitor-specific menu items
Previews and the "Read Viewlayers" operator are specific to the
compositor and shouldn't show in other node editor types.
2022-12-02 14:31:44 -06:00
2155bdd500 Cleanup: Remove "done" variable from node runtime
The runtime storage is meant for more persistent things. These local
states for an algorithm are much better handled by an array now.
2022-12-02 14:14:14 -06:00
1c26341464 Cleanup: Gammar in BMesh mesh conversion comment 2022-12-02 13:28:30 -06:00
ab4926bcff Fix: Various mishandling of node identifiers and vector
In a few places, nodes were added without updating the Identifiers and
vector. In other places nodes we removed without removing from and
rebuilding the vector. This is solved in a few ways. First I exposed
a function to rebuild the vector from scratch, and added unique ID
finding to a few places.

The changes to node group building and separating are more involved,
mostly because it was hard to see the correct behavior without some
refactoring. Now `VectorSet` is used to store nodes involved in the
operation. Some things are handled more simply with the topology
cache and by passing a span of nodes.
2022-12-02 13:28:30 -06:00
948f13a8e7 Cleanup: compiler warning 2022-12-02 19:13:38 +01:00
71071a25a0 Fix crash on File > Link or Append
Would attempt to destruct memory of a null pointer. Use `MEM_delete()`
instead of manual destruction, which allows this case (NOP then).
2022-12-02 19:09:52 +01:00
2a33875065 Fix link error after recent changes to use span for iterating over nodes 2022-12-02 18:51:38 +01:00
0302ab4e02 Fix link error on Linux + Clang due to missing atomic symbols
The new atomic disjoint set uses additional atomics which are not supported
as intrinsics on all architectures and require linking to libatomic.

Now always link to libatomic on Linux when it is available, instead of only
checking if atomic add for int64_t requires linking to this library.

Thanks to Sergey for the help fixing this.
2022-12-02 18:27:07 +01:00
6b7119f9ed Merge branch 'blender-v3.4-release' 2022-12-02 11:24:18 -06:00
99dc90accc Fix: Reversed attribute is_internal RNA property
`is_internal` is supposed to mean that the attribute shouldn't be
visible in lists or the spreadsheet by default, and that it can't be
accessed in geometry nodes. But the value was reversed, which
just happened to work because the list filtering was swapped.

Differential Revision: https://developer.blender.org/D16680
2022-12-02 11:21:54 -06:00
5b8e2ebd97 Cleanup: Use Span to iterate over nodes instead of ListBase
Since 90ea1b7643, there is always a span of nodes
available at runtime. This is easier to read and write.
2022-12-02 11:13:00 -06:00
c5e71cebaa Cycles: Remove OpenGL header
It is not really used from any of the sources, including the
standalone app. Since we are moving to a more backend-independent
drawing it makes sense to remove header which was specific to
how Blender integrates Cycles into viewport.

There is probably some cleanup in CMake files is possible, but
there is some inter-dependency with USD.

Differential Revision: https://developer.blender.org/D16681
2022-12-02 17:19:00 +01:00
ab8946f957 Merge branch 'blender-v3.4-release' 2022-12-02 16:48:09 +01:00
3d9f4012dc Cycles: Fixes for viewport render on Metal drawing backend
This change fixes issues with viewport rendering when Metal
GPU backend is used for drawing. This is not a default build
configuration and requires the following tweaks:

- Enable WITH_METAL_BACKEND CMake option (set it to on)
- Use `--gpu-backend metal` command line arguments

It also helps using the `--factory-startup` command line
argument to ensure Eevee is not used (it is not ported and
will crash).

The root of the problem was in the use of glViewport().
It is replaced with the GPU_viewport_size_get_i() which
is supposed to be portable equivalent form the GPU module.
Without this change the viewport size is detected to be 0
which backfired in few places.

The rest of the changes were to make the code more robust
in the extreme conditions instead of asserting or crashing.

Simplified and streamlined GPU resources creation in the
display driver. It was a bit convoluted mix of creation of
the GPU resources and resizing them to the proper size. It
even seemed to be done in the reverse order. Now it is as
simple as "just ensure GPU resources are there for the
given texture or buffer size".

Also avoid division by zero in the tile manager.

Differential Revision: https://developer.blender.org/D16679
2022-12-02 16:46:43 +01:00
e2f6fb5d35 i18n: Enable Finish language processing. 2022-12-02 16:28:53 +01:00
2bce3c0ac4 Fix: don't allow node identifiers to be zero
Was missing in rB88c6d824e78ebe40b891.
2022-12-02 15:42:15 +01:00
e028662f78 Cycles: store axis and length of an area light instead of their product 2022-12-02 15:23:09 +01:00
6a7917162c Fix asset index only generating empty entries since 1efc94bb2f
Steps to reproduce were:
- Open a .blend file that is located inside of an asset library and
  contains assets.
- Save and close the file.
- Open a new file (Ctrl+N -> General).
- Open asset browser and load the asset library from above.
- If the assets from the file above still show up, press refresh button.
- -> Assets from the file above don't appear.

Likely fixes the underlying issue for T102610. A followup will be needed
to correct the empty asset index files written because of this bug.

We're in the process of moving responsibilities from the file/asset
browser backend to the asset system. 1efc94bb2f introduces a new
representation for asset, which would own the asset metadata now instead
of the file data.

Since the file-list code still does the loading of asset libraries,
ownership of the asset metadata has to be transferred to the asset
system. However, the asset indexing still requires it to be available,
so it can update the index with latest data. So transfer the ownership,
but still keep a non-owning pointer set.

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

Reviewed by: Bastien Montagne
2022-12-02 14:48:51 +01:00
79498d4463 Cleanup: Silenced unused parameter in pbvh.c 2022-12-02 13:43:22 +01:00
ea86ec200a GPU: Added VkVertexBuffer alloc/release data.
This makes sure that the GPU_batch_init will not crash on an assert
where the data of vertex buffer needs to be allocated.
2022-12-02 13:41:23 +01:00
b8c7e93a65 Add experimental option to force all linked data as directly linked.
This is a workaround required to get BAT reliably working again after
recent rB133dde41bb5b, which fixed many indirectly linked IDs being
tagged as directly linked, and therefore having their reference written
in .blend file.

It seems that BAT is still missing proper handling of some ID pointers.

Required for the end of the Heist production here at Blender Studio.
2022-12-02 13:39:28 +01:00
d57f68616a Fix: bump minimum version
rB9fa4ceb340951 caused a forward compatibility issue.
Going forward, when changing socket names, only the name should be
changed and not the identifier if possible.
2022-12-02 13:18:54 +01:00
6d22aa2f84 Cleanup: simplify access to cached mesh normals 2022-12-02 13:12:06 +01:00
198460f6a4 Cleanup: fix compiler warning about using %u with int value
`but->type` is an `enum`, which maps to `int`, so `%d` should be used for
printing its value with `printf()`.
2022-12-02 12:54:11 +01:00
caac5686c5 GPU: Add vulkan to GPU_backend_get_type().
Vulkan backend detection wasn't added to GPU_backend_get_type.
This change will add support for vulkan to the function.
2022-12-02 12:51:11 +01:00
3d5a4fbcc2 Cleanup: move some files that use normals to C++
Doing this to help with T102858.
2022-12-02 12:34:26 +01:00
88c6d824e7 Nodes: ensure that node identifiers are larger than zero
Zero should not be a valid identifier to make it easier to detect when
the identifier has not been set after a node has been allocated.
2022-12-02 11:59:20 +01:00
39615cd3b7 BLI: add atomic disjoint set data structure
The existing `DisjointSet` data structure only supports single
threaded access, which limits performance severely in some cases.

This patch implements `AtomicDisjointSet` based on
"Wait-free Parallel Algorithms for the Union-Find Problem"
by Richard J. Anderson and Heather Woll.

The Mesh Island node also got updated to make use of the new data
structure. In my tests it got 2-5 times faster. More details are in 16653.

Differential Revision: https://developer.blender.org/D16653
2022-12-02 10:39:19 +01:00
5f0120cd35 Merge branch 'blender-v3.4-release' 2022-12-02 08:47:05 +01:00
0197b524e4 Update THIRD-PARTY-LICENSES.txt for Blender 3.4. 2022-12-02 00:38:23 -08:00
46f991dbae Sculpt: Fix broken pivots when entering paint modes
When entering paint modes the paint pivot was cleared,
which broken rotate around pivot.  Fixed for all paint modes.
PBVH modes set the pivot to the PBVH bounding box
while texture paint uses the evaluated mesh bounding box.
2022-12-02 00:37:50 -08:00
6b0e769d14 Nodes: Restrict viewer key tree updates to compositor
The active viewer key is only used by the compositor, so only tag the
node tree for update of it is a compositor node tree.
2022-12-02 10:32:50 +02:00
09ee781a67 GPU: Add placeholders for PixelBuffer to vulkan backend.
PixelBuffer was recently introduced. This change adds empty placeholders to the
vulkan backend and other related API tweaks.
2022-12-02 08:35:17 +01:00
587b213fe1 Fix: Node sorting broken after node identifier commit
90ea1b7643 broke the sorting that happens as nodes are selected.
The compare function for stable sort had different requirements than
the previous implementation.
2022-12-01 17:55:33 -06:00
4d5e8b7caa Cleanup: Use new node identifiers when copying tree
We can avoid creating a new map and use the node vector set that
must be built anyway when updating pointers in the new tree.
2022-12-01 15:40:46 -06:00
e78cd27565 Fix T102895: Grammar in apply scale operator
"Fonts" are referred to as "Text objects" now.
2022-12-01 15:40:46 -06:00
b768a2bf2f Cleanup: Remove unnecessary list clearing in node tree reading
The lists were cleared a few lines below already.
2022-12-01 15:40:46 -06:00
8842a8c4c3 Cleanup: format 2022-12-02 10:14:50 +13:00
90ea1b7643 Nodes: Use persistent integer to identify to nodes
This patch adds an integer identifier to nodes that doesn't change when
the node name changes. This identifier can be used by different systems
to reference a node. This may be important to store caches and simulation
states per node, because otherwise those would always be invalidated
when a node name changes.

Additionally, this kind of identifier could make some things more efficient,
because with it an integer is enough to identify a node and one does not
have to store the node name.

I observed a 10% improvement in evaluation time in a file with an extreme
number of simple math nodes, due to reduced logging overhead-- from
0.226s to 0.205s.

Differential Revision: https://developer.blender.org/D15775
2022-12-01 15:08:12 -06:00
fefe7ddf39 BLI: Add math::orthogonal and math::compare
Port of C BLI API.
2022-12-01 21:46:06 +01:00
2466b2e43c Cleanup: BLI: Rename arguments of math::atan2 2022-12-01 21:46:06 +01:00
730fd0a257 BLI: Add math::sqrt
Allows other number types to overload this function without poluting std
namespace.
2022-12-01 21:46:06 +01:00
4c1b250e17 Fix T102893: Assert Opening File Browser (Win32)
Fix debug assert opening File Browser on Windows platform.

See D16672 for more details.

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

Reviewed by Julian Eisel
2022-12-01 12:25:49 -08:00
25501983bb Cleanup: Spelling mistake in comment 2022-12-01 16:29:38 +01:00
009f7de619 Cleanup: use better matching integer types for graphics interop handle
Ref D16042
2022-12-01 15:55:48 +01:00
Jason Fielder
b132e3b3ce Cycles: use GPU module for viewport display
To make GPU backends other than OpenGL work. Adds required pixel buffer and
fence objects to GPU module.

Authored by Apple: Michael Parkin-White

Ref T96261
Ref T92212

Reviewed By: fclem, brecht

Differential Revision: https://developer.blender.org/D16042
2022-12-01 15:55:48 +01:00
b5ebc9bb24 Fix T101996: merge fcurve keyframes on the same frame after snapping
Use recently introduced BKE_fcurve_merge_duplicate_keys (that was moved
from the transform system to BKE) to merge keyframes on the same frame
after snapping (same as what would happen with the transform system).

This makes behavior consistent and prevents a state after snapping that
cannot be reproduced in any other way.

NOTE: same probably has to be done for greasepencil, but that is for
another commit.
2022-12-01 15:41:55 +01:00
a179246e1f Move fcurve cleanup from transform system to BKE
This exposes the fcurve cleanup from transform system to other callers
in anticipation to use it in the snapping operators.

It has been renamed from `posttrans_fcurve_clean` to
`BKE_fcurve_merge_duplicate_keys` to better describe what it does.
No functional change expected.

Ref. T101996

NOTE: same probably has to be done for greasepencil, but that is for
another commit.

Maniphest Tasks: T101996

Differential Revision: https://developer.blender.org/D16663
2022-12-01 15:41:50 +01:00
f95768d1e0 Update THIRD-PARTY-LICENSES.txt for Blender 3.4. 2022-12-01 15:21:43 +01:00
5e4dcb8cf0 Cleanup: use OB_MODE_ALL_PAINT_GPENCIL in more places
This just replaces the combined usage of OB_MODE_PAINT_GPENCIL
OB_MODE_SCULPT_GPENCIL
OB_MODE_WEIGHT_GPENCIL
OB_MODE_VERTEX_GPENCIL.

Differential Revision: https://developer.blender.org/D16652
2022-12-01 12:15:36 +01:00
1a2e2dcddc Cleanup: Improve function name for asset identifier creation
I find this a bit more explanatory/clear.
2022-12-01 11:42:27 +01:00
5c580ff457 Fix asset-only loading optimizatoin not working as intended
Introduced in fc7beac8d6, but I think this never worked because the
`asset_library_ref` of the temporary file-list used for reading in a
background thread is nulled. Now there's a different pointer that we can
use that works properly.
2022-12-01 11:42:27 +01:00
9f3b0e41bb Fix T102887: crash deleting plane track
Two things here:
- fix ghash lookup from rB4d497721ecd1
-- this was looking in the wrong map (causing an assert on file load)
- set MovieTrackingObject active_plane_track to NULL upon deletion (same
as for regular tracks)
-- rBfe38715600c introduced a crash because `draw_tracking_tracks` would
still get an active plane track (logic for getting these changed)

Maniphest Tasks: T102887

Differential Revision: https://developer.blender.org/D16660
2022-12-01 10:59:59 +01:00
3cebc58936 Fix: Assert in subdivide curves node after span slicing change
a5e7657cee missed this call where clamped slicing is necessary.
The subdivision of a segment purposefully modifies the handle types of
the other side of the following control point, but that didn't work for
the final cyclic segment.
2022-11-30 21:21:58 -06:00
4aac5b92c1 Sculpt: Fix T102824: broken face primitive partitioning in pbvh nodes
The code I wrote to group triangles or multires quads that
belonging to single faces into single PBVH nodes had edge
cases that failed.  The code is now much simpler and simply
assigns groups of primitives to nodes.
2022-11-30 13:55:08 -08:00
65393add52 Sculpt: Fix broken pivots when entering paint modes
When entering paint modes the paint pivot was cleared,
which broken rotate around pivot.  Fixed for all paint modes.
PBVH modes set the pivot to the PBVH bounding box
while texture paint uses the evaluated mesh bounding box.
2022-11-30 13:54:56 -08:00
918282d391 Sculpt: fix crash when no brush
If no brush exists the stroke operator
falls through to the grab transform
op in the global view3d keymap.

This now works.  It would be nice if
we could get rid of that keymap entry
though and add it manually to the edit/paint
modes that need it.
2022-11-30 13:54:03 -08:00
7151c2dc3e Cleanup: Unused variable, RNA description warning 2022-11-30 15:34:08 -06:00
1017b493ed Sculpt: Fix T102824: broken face primitive partitioning in pbvh nodes
The code I wrote to group triangles or multires quads that
belonging to single faces into single PBVH nodes had edge
cases that failed.  The code is now much simpler and simply
assigns groups of primitives to nodes.
2022-11-30 13:26:36 -08:00
fde628ddb3 Sculpt: Fix broken pivots when entering paint modes
When entering paint modes the paint pivot was cleared,
which broken rotate around pivot.  Fixed for all paint modes.
PBVH modes set the pivot to the PBVH bounding box
while texture paint uses the evaluated mesh bounding box.
2022-11-30 13:22:24 -08:00
8fa5206ab0 Sculpt: fix crash when no brush
If no brush exists the stroke operator
falls through to the grab transform
op in the global view3d keymap.

This now works.  It would be nice if
we could get rid of that keymap entry
though and add it manually to the edit/paint
modes that need it.
2022-11-30 13:22:24 -08:00
222b64fcdc Fix Cycles CUDA crash when building kernels without optimizations (for debug)
In this case the blocksize may not the one we requested, which was assumed to be
the case. Instead get the effective block size from the compiler as was already
done for Metal and OneAPI.
2022-11-30 21:46:17 +01:00
b25c301c15 Build: make CUDA kernel compilation output not verbose
Unless using WITH_CYCLES_DEBUG.

This is convenient for investigating kernel performance, but too verbose to
always have in the buildbot logs especially now that we are also compiling HIP
and OneAPI kernels.
2022-11-30 21:19:51 +01:00
396b407c7d Cycles: new setting and heuristics for mesh light importance sampling
Materials now have an enum to set the emission sampling method, to be
either None, Auto, Front, Back or Front & Back. This replace the
previous "Multiple Importance Sample" option.

Auto is the new default, and uses a heuristic to estimate the emitted
light intensity to determine of the mesh should be considered as a light
for sampling. Shaders sometimes have a bit of emission but treating them
as a light source is not worth the memory/performance overhead.

The Front/Back settings are not important yet, but will help when a
light tree is added. In that case setting emission to Front only on
closed meshes can help ignore emission from inside the mesh interior that
does not contribute anything.

Includes contributions by Brecht Van Lommel and Alaska.

Ref T77889
2022-11-30 21:19:51 +01:00
ac51d331df Refactor: Cycles light sampling code reorganization
* Split light types into own files, move light type specific code from
  light tree and MNEE.
* Move flat light distribution code into own kernel file and host side
  building function, in preparation of light tree addition. Add light/sample.h
  as main entry point to kernel light sampling.
* Better separate calculation of pdf for selecting a light, and pdf for
  sampling a point on the light. The selection pdf is now also stored in
  LightSampling for MNEE to correctly recalculate the full pdf when the
  shading position changes but the point on the light remains fixed.
* Improvement to kernel light storage, using packed_float3, better variable
  names, etc.

Includes contributions by Brecht Van Lommel and Weizhen Huang.

Ref T77889
2022-11-30 21:19:51 +01:00
db1728096a Cleanup: Remove unused node socket cache handling
This cache was never written to, only "copied" between sockets in one
case, it dates back at least a decade. It doesn't make sense to store
caches on node trees directly anyway, since they can be used in
multiple places.
2022-11-30 13:25:06 -06:00
31b3b07ad7 Cleanup: Remove useless comments in node.cc
Also remove unnecessary `struct` keywords.
2022-11-30 13:11:12 -06:00
f37e8c2e96 Merge branch 'blender-v3.4-release' 2022-11-30 20:08:31 +01:00
692474ccf9 Release cycle: Bump BLENDER_VERSION_CYCLE to rc for 3.4. 2022-11-30 20:04:37 +01:00
b582028b12 Correct previously missed case of manual path building in file browser
Missed in 39c9164ea1. Also adds a comments to point at the function
that should be used instead.
2022-11-30 20:02:09 +01:00
39c9164ea1 File/Asset Browser: Get full asset path from asset representation
No user visible changes expected.

Add a function to query the full path for a file, so that asset files
can get the path via the asset representation and its new asset
identifier. This is designed to be a reliable way to locate an asset,
and using it is yet another step to rely less on the problematic file
browser code.
Also, previous code would build the full path manually in a few places,
which is good to deduplicate anyway.
2022-11-30 19:44:34 +01:00
ccc9eef1b9 Assets: Get asset path via new identifier (not via file browser hacks)
With the asset identifier introduced in the previous commit, we can now
locate an asset just from its `AssetRepresentation`, without requiring
information from the asset library and the file browser storage. With
this we can remove some hacks and function parameters. A RNA/BPY
function is also affected, but I didn't remove the paramter to keep
compatibility. It's simply ignored and not required anymore, noted this
in the parameter description (noted for T102877).
2022-11-30 19:44:34 +01:00
f68da703a5 Asset system: Initial asset identifier type
No user visible changes expected.

`AssetIdentifier` holds information to uniquely identify and locate an
asset. More information:
https://wiki.blender.org/wiki/Source/Architecture/Asset_System/Back_End#Asset_Identifier

For the start this is tied quite a bit to file paths, so that external
assets are assumed to be in the file system.

This is needed to support an "All" asset library (see T102879), which
would contain assets from different locations. Currently the location of
an asset is queried via the file browser backend, which however requires
a common root location. It also moves us further away from the file
browser towards the asset system (see T87235) and allows us to remove
some hacks (see following commit).
2022-11-30 19:44:34 +01:00
cfaca0d9ab Asset System: Store root path in asset library data
No user visible changes expected.

If an asset library is located on disk, store the path to it in the
asset library data. This is called the "root path" now.
With this we can construct an asset identifier, which is introduced in
the following commit.
2022-11-30 19:44:34 +01:00
2165136740 File/Asset Browser: Refactor how recursive paths are set
When reading directories recursively, the code would first only set the
file name as the relative path and then later iterate over the read files
and prepend the recursed into path, to get the complete path relative to
the recursed into directory. This isn't clear and confused me quite a
bit. And it is not compatible with what we need for creating asset
identifiers, which are introduced in the 2nd following commit.

Instead properly determine the complete relative path when initially
adding the file, and don't change it after. The asset identifier can the
be constructed properly at the time needed.
2022-11-30 19:44:34 +01:00
b78b6e3cd7 Cleanup: Correct comment in hash description
We use the blender namespace now rather than BLI.
2022-11-30 11:49:32 -06:00
7cdcb76815 Cleanup: Remove node tree runtime fields
`done` was only used in one place, and `is_updating` was never read.
Generally we should avoid adding this sort of temporary data to longer
lived structs.
2022-11-30 11:41:01 -06:00
507b724056 Cleanup: Remove unnecessary BMesh unique pointer in OBJ code
This is only used once, it's simpler to just free it in that case and
wait for further RAII improvements from elsewhere in the codebase.
2022-11-30 10:46:37 -06:00
0b13e7ce0f Cleanup: Remove unnecessary use of deprecated DNA define
This was solved by `dna::shallow_copy`
2022-11-30 10:27:33 -06:00
Christoph Lendenfeld
c17d7ddabe Merge branch 'blender-v3.4-release' 2022-11-30 17:26:01 +01:00
Christoph Lendenfeld
5c1cc79cf4 Fix T100879: Bake Action fails with "Nothing to Bake"
When applying the "Bake Action" operator in pose mode
it could throw an error saying "Nothing to Bake"
even though bones are selected

That is because the code was looking for a selected armature
But in Pose Mode, clicking into empty space to de-select would also
deselect the armature.
Then box selecting would not make the armature selected again

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D16593
2022-11-30 17:24:14 +01:00
429771fed5 Add 'work around' to accessing data from volatile iterators in py API.
Re T102550.
2022-11-30 17:04:37 +01:00
Christoph Lendenfeld
18de712257 Fix T100879: Bake Action fails with "Nothing to Bake"
When applying the "Bake Action" operator in pose mode
it could throw an error saying "Nothing to Bake"
even though bones are selected

That is because the code was looking for a selected armature
But in Pose Mode, clicking into empty space to de-select would also
deselect the armature.
Then box selecting would not make the armature selected again

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D16593
2022-11-30 16:57:21 +01:00
313c2e9105 Fix a test after recent changes to lib (in)directly linked ID handling.
rB133dde41bb5b changed handling of (in)directly linked status handling
for IDs, now IDs that are not directly linked get proper status and
handling on file save. this broke parts of the `pyapi_idprop_datablock`
tests.
2022-11-30 15:08:11 +01:00
19dc2157cd BLI: Add trigonometric functions to BLI_math_base.hh``
This is needed for the upcomming matrix library.
2022-11-30 12:59:47 +01:00
249acdf529 Cleanup: Unused variable warning in release build 2022-11-30 12:49:33 +01:00
Bastien Montagne
133dde41bb Improve handling of (in)direclty linked status for linked IDs.
This commit essentially ensures before writing .blend file that only
actualy locally used linked IDs are tagged as `LIB_TAG_EXTERN` (and
therefore get a reference stored in the .blend file).

Previously, a linked ID tagged as directly linked would never get back
to the indirectly linked status. Consequence was a lot of 'needless'
references to linked data in .blend files.

This commit also introduces a new flag for lib_query ID usage types,
`IDWALK_CB_DIRECT_WEAK_LINK`, used currently for base's Object
pointer, and for LayerCollection's Collection pointer.

NOTE: A side-effect of this patch is that even IDs explicitely linked by
the user won't be kept anymore when writing files, i.e. they will not be
there anymore after a file reload, if they are not actually used.

Overhead of new process is below 0.1% in whole file saving process in
a Heist production file e.g.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16605
2022-11-30 11:16:14 +01:00
ae081b2de1 Cleanup: reduce variable scope in uv parametrizer
Also improve const correctness and update comments.

Simplify future fix for T78101
2022-11-30 12:01:40 +13:00
d602d4f15f Cleanup: reduce variable scope in uv parametrizer
Simplify future fix for T78101
2022-11-30 11:56:00 +13:00
5ce72bba7e Cleanup: simplify flush/blend logic in uv parametrizer
Simplify future fix for T78101
2022-11-30 11:50:12 +13:00
b99cdf7472 Cleanup: use blenlib geometry functions in uv parametrizer
Simplify future fix for T78101
2022-11-30 11:44:13 +13:00
b7d27ce914 Fix T102861: Store named attribute warning with empty geometry 2022-11-29 16:36:09 -06:00
cb7e36cfa5 Merge branch 'blender-v3.4-release' 2022-11-29 21:05:45 +01:00
6c4c09b2df Fix T102519: GPU Subdivision : selected vertices not visible in paint mode
Retrieve and load the vertices selected/hidden state in pos_nor extraction.

Reviewed By: fclem

Maniphest Tasks: T102519

Differential Revision: https://developer.blender.org/D16594
2022-11-29 21:05:14 +01:00
68a0846021 Fix T102657: Unable to add strip to new channel
This is usability improvement, rather than bugfix. By default, height of
VSE timeline is clamped to 7 channels, unless more are added. But adding
new strip is not intuitive, since user can't scroll up due to clamping.

Clamp timeline height to n+1 used channels, so there is always 1 free
channel visible.
2022-11-29 19:49:40 +01:00
3f9febcabf Merge branch 'blender-v3.4-release' 2022-11-29 19:09:42 +01:00
412fdc9698 Fix crash when dragging video into VSE preview area
Caused by NULL dereference, because `Editing` data were not initialized.
Ensure data are initialized prior to using them.
2022-11-29 19:07:34 +01:00
9f753e5649 Fix build error after PyGPU changes 2022-11-29 18:46:59 +01:00
8fa8cea8e0 Fix PyGPU: return NULL instead of PyNone on error
Error in d7f124f06f
2022-11-29 13:59:52 -03:00
d7f124f06f Fix T102845: GPU python crash in background mode
`BPYGPU_IS_INIT_OR_ERROR_OBJ` is not implemented in all pygpu functions.

Instead of copying and pasting that call across the API when it has no
gpu context, override the methods with one that always reports error.
2022-11-29 13:55:46 -03:00
71f9fbcf35 Merge branch 'blender-v3.4-release' 2022-11-29 16:46:07 +01:00
85d9f12339 BLI: increase default inline buffer capacity in BitVector
Using 32 does not make much sense, because there will be 4 remaining
padding bytes in the struct anyway. Using 64 instead does not actually
increase the size of the struct, but makes allocations less likely.
2022-11-29 16:35:59 +01:00
7b08298927 BLI: use no_unique_address in BitVector
This allows the vector to be smaller when it has no inline buffer (24 ->32 byte).
2022-11-29 16:34:57 +01:00
01f4b9b32d Fix T102795: Stereoscopy checkbox turns the VSE preview black
With stereoscopy enabled, sseq->multiview_eye is set to left and
right eye during drawing, but this value is not reset, even if
stereoscopy is disabled.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D16639
2022-11-29 16:34:31 +01:00
57613630c7 BLO: use blender::Map in OldNewMap
`OldNewMap` used to have its own map implementation. Given that
the file uses C++ now, it is easy to use a C++ map implementation
instead. This simplifies the code a lot.

Going forward it might make sense to remove the `OldNewMap`
abstraction or to split it up in two (currently, `NewAddress.nr` has
two different meanings in different contexts which is confusing).

No functional changes are expected.

Differential Revision: https://developer.blender.org/D16546
2022-11-29 16:24:45 +01:00
fdf1837120 Merge branch 'blender-v3.4-release' 2022-11-29 13:17:33 +01:00
eae2917fde Fix: crash in node poll function due to missing null check 2022-11-29 13:16:41 +01:00
2b639f671f GPencil: Create Keyframe using Eraser if Auto-key is ONn
Before, the frame was not created, but now if there is
a previous stroke and teh frame changed, the new keyframe
is created.

This is related to T102623
2022-11-29 12:15:10 +01:00
2b85151a32 Cleanup: Braces around initialization of subobject 2022-11-29 11:03:48 +01:00
863cd1ea8e Merge branch 'blender-v3.4-release' 2022-11-29 09:33:41 +01:00
e97443478e Fix T102797: Unlinking an Orphan Action crashes
In `Orphan Data` (or `Blender File`) view, the ID pointer of the
actions's parent tree-element wasn't actually pointing to an ID, but to
the list-base containing the IDs.

Early out (with a warning) if the object or object-data to unlink the
action from is not clear.

Caused by rBb4a2096415d9.

Similar to rBe772087ed664.

Maniphest Tasks: T102797

Differential Revision: https://developer.blender.org/D16635
2022-11-29 09:31:19 +01:00
4067e6bc41 Cleanup: format 2022-11-29 17:33:07 +13:00
3d1594417b UV: support constrain-to-bounds for uv shear operator
For uv rotation operator, see rBd527aa4dd53d4.
2022-11-29 12:04:36 +13:00
6fdddae2b0 Fix T102804: Click & Drag on toggles no longer possible
Typo in 136ea84d9a
2022-11-28 16:29:37 -06:00
01a38c2be9 Fix T102827: 3D View header layout broken after C++ conversion
I missed this flag when removing designated initializers.
2022-11-28 16:29:37 -06:00
0ed4865fd0 Sculpt: Fix T102337: Null pointer error circle (tube) brush test code 2022-11-28 13:11:52 -08:00
0ad8f3ff58 Sculpt: fix T102348: Don't fold area normal automasking into cache
Certain automasking modes build a factor cache.  Modes
that rely on the mirror symmetry pass should not fold into
this pass.
2022-11-28 13:11:51 -08:00
1fc5dc3bf3 Sculpt: fix T102664: Broken multires solid shading
Calculate quad normal directly instead of averaging
the vertex normals.
2022-11-28 13:11:51 -08:00
48143ab001 Sculpt: Fix T102337: Null pointer error circle (tube) brush test code 2022-11-28 13:07:50 -08:00
b1cc2a48f2 Sculpt: fix T102348: Don't fold area normal automasking into cache
Certain automasking modes build a factor cache.  Modes
that rely on the mirror symmetry pass should not fold into
this pass.
2022-11-28 12:59:53 -08:00
2e1a479e29 Sculpt: fix T102664: Broken multires solid shading
Calculate quad normal directly instead of averaging
the vertex normals.
2022-11-28 12:36:32 -08:00
d1d2946f59 Merge branch 'blender-v3.4-release' 2022-11-28 14:12:04 -06:00
07200eaa85 Merge branch 'blender-v3.4-release' 2022-11-28 21:07:13 +01:00
745851e26b Fix T102772: Propagate edge creases in subdivision surface modifier
Before rBa8a454287a27, edge creases were copied to the result mesh as
part of `MEdge`. Now they are stored in a separate `CD_CREASE` layer,
which I mistakenly disabled for interpolation. However, to maintain
the geometry node uses a field input, remove the interpolated attribute
there.
2022-11-28 14:06:25 -06:00
1bacd09abb Fix: Mishandled creases in Cycles adaptive subdivision
Caused by a8a454287a which assumed it was possible
to access the raw data of the edge creases layer. Also allow
processing vertex creases even if there aren't any edge creases.
2022-11-28 14:06:25 -06:00
719ad4f93f Fix T100537: wrong depth pass for background after recent fix for gaps
Also have to write if we hit the background and have not written any valid
value for the pass yet.
2022-11-28 21:03:07 +01:00
9bdde6ca96 Python Module: add source code and credits to project description 2022-11-28 21:03:07 +01:00
6d52975019 Cleanup: remove Cycles standalone repository lib detection
This is only needed in the Cycles repo and having it in the Blender repo
is making merging more complicated than it is helping.
2022-11-28 21:03:07 +01:00
7540842ca7 Fix T99592: Exact Boolean: Skip empty materials, add index-based option
**Empty Slot Fix**
Currently the boolean modifier transfers the default material from
meshes with no materials and empty material slots to the faces on the
base mesh. I added this in a2d59b2dac for the sake of consistency,
but the behavior is actually not useful at all. The default empty
material isn't chosen by users, it just signifies "nothing," so when
it replaces a material chosen by users, it feels like a bug.

This commit corrects that behavior by only transferring materials from
non-empty material slots. The implementation is now consistent between
exact mode of the boolean modifier and the geometry node.

**Index-Based Option**

"Index-based" is the new default material method for the boolean
modifier, to access the old behavior from before the breaking commit.

a2d59b2dac actually broke some Boolean workflows fundamentally, since
it was important to set up matching slot indices on each operand. That
isn't the cleanest workflow, and it breaks when materials change
procedurally, but historically that hasn't been a problem. The
"transfer" behavior transfers all materials except for empty slots,
but the fundamental problem is that there isn't a good way to specify
the result materials besides using the slot indices.

Even then, the transfer option is a bit more intuitive and useful for
some simpler situations, and it allows accessing the behavior that has
been in 3.2 and 3.3 for a long time, so it's also left in as an option.
The geometry node doesn't get this new option, in the hope that we'll
find a better solution in the future.

Differential Revision: https://developer.blender.org/D16187
2022-11-28 21:03:07 +01:00
ca5062071c Fix T100537: wrong depth pass for background after recent fix for gaps
Also have to write if we hit the background and have not written any valid
value for the pass yet.
2022-11-28 20:36:56 +01:00
008070e16c Python Module: add source code and credits to project description 2022-11-28 20:18:26 +01:00
1a34bbc27c Cleanup: remove Cycles standalone repository lib detection
This is only needed in the Cycles repo and having it in the Blender repo
is making merging more complicated than it is helping.
2022-11-28 20:18:26 +01:00
da363d831b Fix assert when calling transform operators in python handles
In these cases `t->spacetype` is `SPACE_EMPTY`.

Returning 0 is not problematic as this space does not support snapping
anyway.
2022-11-28 15:51:01 -03:00
bbb389589a Fix T99592: Exact Boolean: Skip empty materials, add index-based option
**Empty Slot Fix**
Currently the boolean modifier transfers the default material from
meshes with no materials and empty material slots to the faces on the
base mesh. I added this in a2d59b2dac for the sake of consistency,
but the behavior is actually not useful at all. The default empty
material isn't chosen by users, it just signifies "nothing," so when
it replaces a material chosen by users, it feels like a bug.

This commit corrects that behavior by only transferring materials from
non-empty material slots. The implementation is now consistent between
exact mode of the boolean modifier and the geometry node.

**Index-Based Option**

"Index-based" is the new default material method for the boolean
modifier, to access the old behavior from before the breaking commit.

a2d59b2dac actually broke some Boolean workflows fundamentally, since
it was important to set up matching slot indices on each operand. That
isn't the cleanest workflow, and it breaks when materials change
procedurally, but historically that hasn't been a problem. The
"transfer" behavior transfers all materials except for empty slots,
but the fundamental problem is that there isn't a good way to specify
the result materials besides using the slot indices.

Even then, the transfer option is a bit more intuitive and useful for
some simpler situations, and it allows accessing the behavior that has
been in 3.2 and 3.3 for a long time, so it's also left in as an option.
The geometry node doesn't get this new option, in the hope that we'll
find a better solution in the future.

Differential Revision: https://developer.blender.org/D16187
2022-11-28 12:42:08 -06:00
56ae4089eb GPencil: Allow interpolation to use breakdown keyframe as extremes
Actually, the interpolation can be done only between keyframes different of breakdown type,
but in some cases, this is not convenient.

Now, a new option is displayed to allow the interpolation using breakdown keyframes
as interpolation extremes.

Reviewed By: mendio, pepeland

Differential Revision: https://developer.blender.org/D16515
2022-11-28 19:32:18 +01:00
7e7c6bc468 Cleanup: Use spans and lambdas for mesh normal calculation
Makes code safer, easier to understand, and less verbose. I detected
negligible performance differences, only a slight improvement for the
normalize step where the function call overhead was probably more
of a bottleneck.

I kept `memset` instead of `.fill(float3(0))` because that gave
better performance in my tests. In the future that stage could be
parallelized, or we could make sure new arrays are allocated with
`calloc`.
2022-11-28 12:28:27 -06:00
b0bf10889b Merge branch 'blender-v3.4-release' 2022-11-28 18:26:21 +01:00
33ce83984d Fix T102801: Empty metasequence sliding away while moving
Meta strip position relies on strips within. When meta strip is empty,
update function, that would normally update it's position returns early
and this causes translaton to behave erratically.

When strip is empty, treat it as normal strip and move its start frame
as with other strip types.
2022-11-28 18:23:29 +01:00
33b3645d97 Merge branch 'blender-v3.4-release' 2022-11-28 17:11:46 +01:00
9eb1d62ba6 Fix T102638: GPencil: Modifier added on linked object restore its value on reloading the file
One line missing in code handling overrides insertions of gpencil
modifiers...

Fix also suitable for 3.3LTS.
2022-11-28 17:10:02 +01:00
Colin Basnett
c47b6978e3 Animation: Make Bake Animation operator use preview range when enabled
This patch makes the Bake Actions operator fills the Start Frame & End From with that of the Preview Range if "Use Preview Range" is enabled.

{F13973619}

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D16630
2022-11-28 08:04:21 -08:00
19bb30baf6 Fix T102735: Knife tool does not work properly in perspective viewport
Use `ED_view3d_win_to_3d` to unproject the first click coords.

This is the same function used in other tools like Draw Curve.

Differential revision: https://developer.blender.org/D16617
2022-11-28 12:38:47 -03:00
5758d114c1 Dual Mesh: Avoid transferring position attribute twice
The node transferred position once as a generic attribute, and then set
the values again manually. This wastes processing during the attribute
transfer step. On a 1 million face grid, I observed roughly an 8%
improvement, from 231.5 to 217.1 ms average and 225.4 to 209.6 ms min.
2022-11-28 08:19:33 -06:00
d96859c5b1 Cleanup: Move dual mesh topology map to blenkernel
It's helpful to have these topology maps standardized and organized
a bit better so they can be optimized and considered for future caching
together. Also use a more standard name for the map for that purpose.
2022-11-28 08:19:33 -06:00
7a9fce28c0 Cleanup: Pass spans by value in cone mesh primitive
Also use more typical ordering for the arguments.
2022-11-28 08:19:33 -06:00
70041ced14 Cleanup: Remove unused mesh array variables and arguments 2022-11-28 08:19:33 -06:00
6e26d0645e Cleanup: Use spans for voxel remesh mesh data 2022-11-28 08:19:33 -06:00
0940719b5a Line Art: Use local spans for mesh arrays
Avoid accessing arrays from the mesh for every element and add safety
by using Span instead of raw pointers. Similar to previous commits.
2022-11-28 08:19:33 -06:00
baba5d2214 Multires: Avoid retriving mesh arrays for every element
Based on the surrounding code this probably wasn't a
bottleneck, but it's nice to avoid in principle anyway.
2022-11-28 08:19:33 -06:00
653e3e2689 Subdiv: Avoid repeatedly accessing mesh arrays
Fix a performance regression from 05952aa94d by storing pointers
to mesh arrays locally in the subdiv foreach context. In a simple test
of a 1 million face grid, this improved performance by 5% (from 0.31
to 0.295 seconds).
2022-11-28 08:19:33 -06:00
bcabd04e32 Mesh: Avoid retrieving edge and loop arrays repeatedly
A utility function retrieved mesh arrays for every element after
05952aa94d which can be easily avoided. This was used when
building the GPU indices for sculpt mode drawing. In my tests this
saves 0.1ms per PBVH node. There may be very slight improvements
in line art and shrinkwrap as well.
2022-11-28 08:19:33 -06:00
a059b1b0f1 Merge branch 'blender-v3.4-release' 2022-11-28 12:52:32 +01:00
99c5146e9a Fix T101433: crash when deleting hierarchy referenced by Collection Info node
The issue was that geometry nodes was not reevaluated after changing the
content of the collection. That resulted in the other object still having a
reference to the deleted object, which resulted in a crash when it tried to
access it.

Adding the `ID_RECALC_GEOMETRY` tag indicates that the content of the
collection has changed and will trigger geometry nodes setups that depend
on the collection to update.
2022-11-28 12:51:10 +01:00
4ed649352f 3D Texturing: Fix seam bleeding.
{F13294314}
# Process

In the pixel extraction process a larger domain will be extracted then the input mesh.
The borders of uv islands are extended with connected geometry of the input mesh.
The extended mesh is then fed into the pixel extraction process.
A mask is used to limit the extraction so UV islands will not overlap.

Input UV islands.
{F13206401}

Extended UV Island (only one showing).
{F13288764}

This patch doesn't include fixing uv seams at non-manifold edges (like suzannes eyes) as that
would require a different approach (edge extending or pixel copy-ing). The later has already been
implemented in D14702, but should be revisited to only use do the non-manifold edge fixing.

This patch supports fixing UV seams across UDIM textures.
There might be an issue when using a single texture on multiple uv maps.

Reviewed By: brecht, joeedh, JulienKaspar

Maniphest Tasks: T97352

Differential Revision: https://developer.blender.org/D14970
2022-11-28 08:32:06 +01:00
c02ec74405 Cleanup: format 2022-11-28 13:17:59 +13:00
143e74c0b8 Fix (unreported) uv unwrap selected was splitting selection
Add support for `pin_unselected` in new UV Packing API.

Regression introduced by API change in rBe3075f3cf7ce.

Duplicate change to rB0ce18561bc82 in master.
2022-11-28 13:14:42 +13:00
e010890e82 Cleanup: format 2022-11-28 13:14:27 +13:00
95003c99d9 GPU: Change inheritance of depth write and default values
This new inheritance behavior is more beneficial for the metal Backend.
Also change the default depth write behavior of shaders to be unchanged.
This makes fragment shader depth amendment more explicit.

This also add the missing depth_write for metal kernels.
2022-11-27 23:58:55 +01:00
d961119563 Python API Docs: document when fields use mathutils types.
When accessing certain structure fields from Python, they return
mathutils types instead of generic arrays (this is based on subtype).

This exposes this information in the Python API documentation.

Differential Revision: https://developer.blender.org/D16626
2022-11-28 00:33:41 +02:00
57a20b6d52 DRW: Add missing depth_write to certain shader create info
These are required by the Metal backend.
2022-11-27 22:58:10 +01:00
5b4efaeeb3 Merge branch 'blender-v3.4-release' 2022-11-27 21:42:37 +01:00
3a65d2f591 Fix T101211: Image jitters when scaling by large values
Issue was caused by imprecise math due to using float numbers.
Use double instead.

No negative performance impact was observed.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D16517
2022-11-27 21:33:05 +01:00
5a504a0d9d Fix T102663: Meta strips from older versions are broken
Meta strip range was adjusted in versioning because of previous issues
by function `version_fix_seq_meta_range`. After `speed_factor` property
was added, this changed how function works and result was incorrect
function due to uninitialized property value.

Running `version_fix_seq_meta_range` after `seq_speed_factor_set` fixes
this issue.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D16606
2022-11-27 21:31:38 +01:00
ea384fc096 Merge branch 'blender-v3.4-release' 2022-11-27 14:41:36 +01:00
6cd441fdac Draw: GPU Subdivision: Add missing case in get_shader_code 2022-11-27 14:40:47 +01:00
41733a9c08 Fix T102773 & T102777: Regressions in GPU Subdivision
Introduced in D16420.
SHADER_BUFFER_TRIS and SHADER_BUFFER_TRIS_MULTIPLE_MATERIALS flags were accidentally swapped.
2022-11-27 14:40:00 +01:00
3ccf4a3944 Merge branch 'blender-v3.4-release' 2022-11-27 12:41:42 +01:00
b0bcdcdbef Fix: missing greasepencil hook modifier relationship lines
Overlay relationship lines were missing between the object having the
modifier and the target object.

To make this consistent with other objects types, now draw relationship
lines for greasepencil and hooks now, too.

Spotted while looking into T102741.

Maniphest Tasks: T102741

Differential Revision: https://developer.blender.org/D16609
2022-11-27 12:24:48 +01:00
179008f57a Fix T102685: Grease Pencil brush cursors missing on file open
Brush cursors were missing when opening a file saved in sculpt/vertex-/
weightpaint mode.

Since we dont do a full modeswitch on file load in `ED_editors_init` for
grease pencil since rBde994d6b7b1c, we were missing the brush cursor
toggling [`ED_gpencil_toggle_brush_cursor`] normally done in
`ED_gpencil_setup_modes`.

This is now explicitly added for any greasepencil paintmode (in case
object is active).

Maniphest Tasks: T102685

Differential Revision: https://developer.blender.org/D16603
2022-11-27 12:23:01 +01:00
c935a06edb Cleanup: correct comments in ED_editors_init
These comments were from rBcc7460eaa491 / rBde994d6b7b1c /
rB7037ff920447 but ended up in a confusing state.
Moved into the right places and reworded appropriately.

Spotted while looking into T102685.

Maniphest Tasks: T102685

Differential Revision: https://developer.blender.org/D16601
2022-11-27 12:22:42 +01:00
b0810f788c Fix T102650: Wrong cursor in greasepencil fill operation
Caused by {rBbf8507414889}

Above comit set the wrong cursors (WM_CURSOR_DEFAULT).
When releasing MMB, we need to return to WM_CURSOR_PAINT_BRUSH.
When exiting, we need to return to WM_CURSOR_DOT (since this is the
default cursor for the tool, see `_defs_gpencil_paint` >
`generate_from_brushes`)

Maniphest Tasks: T102650

Differential Revision: https://developer.blender.org/D16591
2022-11-27 12:21:22 +01:00
ee56c46c15 Fix: greasepencil selection mask picking points not working
When in greasepencil sculpt-/vertexpaint mode and using selection
masking, picking points wasnt working correctly.

So regular gpencil.select (without modifier keys) was not enabled for the
keymap. This only really makes sense for RCS (right click select) atm
(and not using RC fallback tools - which I dont think are present in
these modes anyways). With RCS, this can be supported and afaict, this
does not cause conflicts.

NOTE: prior to D16576, one could use the ALT modifier key (this
combination was actually in the keymap) -- but it should select the
entire stroke, which is handled in D16576.

Differential Revision: https://developer.blender.org/D16577
2022-11-27 12:21:02 +01:00
5d481d9e55 Fix: greasepencil selection of entire_strokes not working
Caused by rB85f90ed6fd88.

Above commit made sure whole strokes are selected when the
GP_SELECTMODE_STROKE is used in different modes, but ignored the fact
that this can also already be set by the entire_strokes select operator
property.

This is now corrected.

Differential Revision: https://developer.blender.org/D16576
2022-11-27 12:20:06 +01:00
Iliya Katueshenock
9fa4ceb340 Geometry Nodes: Change Collection Info output socket name to Instances
As described in T101948, this commit changes socket name to be more
consistent with other nodes that generate instances output.

Differential Revision: https://developer.blender.org/D16394
2022-11-26 18:11:01 -06:00
Iliya Katueshenock
42485b01d2 Geometry Nodes: Rename Transform node to Transform Geometry
Change name to make navigation easier for beginner users. This should
more clearly hint at the use of this node to change the full geometry,
and not work with fields, and makes the name more consistent.

Differential Revision: https://developer.blender.org/D16396
2022-11-26 18:05:41 -06:00
Iliya Katueshenock
beeeb6da30 Cleanup: Integer types, references in geometry node image texture node
While implementing T102289, I noticed that this node has
several solutions that are different from other, newer nodes.
 - Explicitly set default values
 - Use references
 - Reduce the size of the node settings structure

Differential Revision: https://developer.blender.org/D16548
2022-11-26 18:00:47 -06:00
3f5dfbf681 Geometry Nodes: Modify existing mesh in split edges node
Instead of creating a new mesh from scratch, modify an existing mesh.
This allows us to keep derived caches for triangulation and bounds
alive more easily, and allows keeping materials and non-generic
attributes like vertex groups alive on the mesh.

It also has other performance benefits, since face and face corner
attributes aren't affected at all, and because of reduced overhead
from not allocating a new mesh.

Updating edge attributes is a bit more complicated now, since we
have to completely replace the arrays but keep the existing attribute
IDs around. The new mesh update tag is also slightly too specific IMO.
But I think both of those things will improve in the future because
of existing plans for further refactoring these areas:
- New attribute storage that gives pointer stability
- Further use and granularity of mesh update tagging that will
  make the correct API more clear

Fixes T102711

Differential Revision: https://developer.blender.org/D16615
2022-11-26 17:54:05 -06:00
3a41e0f611 Tests: Automated geometry nodes benchmark
Add a script for a very simple object evaluation benchmark.
There could be more advanced ways of measuring the time
per-node or per modifier, but this just loads the file, tags
the active object for a reevaluation, and times how long
that takes.

Differential Revision: https://developer.blender.org/D16604
2022-11-26 17:15:55 -06:00
828525b268 Fix: MSVC build error without TBB
windows.h once more providing min/max macro's when you least want them.
2022-11-26 11:44:08 -07:00
4ecc7cf14a Cleanup: Move interface_intern.hh
The entire interface directory is now compiled as C++ files.
2022-11-26 10:12:58 -06:00
e47c75aa6e Cleanup: Move interface eyedroppers directory to C++ 2022-11-26 10:12:58 -06:00
136ea84d9a Cleanup: Move interface_handlers.c to C++ 2022-11-26 10:12:58 -06:00
162f0dcb2f Cleanup: Move six more interface files to C++ 2022-11-26 10:12:58 -06:00
1aff91b1a7 GPencil: Add Vertex Opacity Overlay parameter in Sculpt
This option was missing in overlay panel.
2022-11-26 15:39:59 +01:00
b43bdd8ba2 Fix T102751: missing tree update with muted nodes
This was accidentally caused by removing too much code in
{rBb4c3ea264439158df70e837e20f8dd9ec548de2d}.
2022-11-26 13:46:39 +01:00
86ade3df56 Nodes: move node registration to nodes module
The main goal here is to move towards more self contained node
definitions. Previously, one would have to change `blenkernel` to
add a new node which is not necessary anymore. There is no need
for all these register functions to "leak out" of the nodes module.

Differential Revision: https://developer.blender.org/D16612
2022-11-26 13:20:18 +01:00
8d269a2488 PyDocs: Fix incorrect data type of bmesh.types.BMFaceSeq.new
The API documentation of [[ https://docs.blender.org/api/current/bmesh.types.html?highlight=faces#bmesh.types.BMFaceSeq.new | bmesh.types.BMFaceSeq.new ]] indicates that the argument is only `BMVert`.
But the correct one is sequence of `BMVert`.
This patch fixes this mismatch.

Contributed by @Nutti

Differential Revision: https://developer.blender.org/D15668
2022-11-25 19:55:04 -05:00
ed6e1381dc Cleanup: Avoid using macros to refer to theme global variables
Prefer slightly more verbose code to the use of macros where
they aren't really necessary and just add indirection.
2022-11-25 17:11:44 -06:00
248ee6270b Cleanup: Remove unnecessary includes 2022-11-25 17:10:28 -06:00
afd16c487d Cleanup: Move four interface files to C++ 2022-11-25 17:09:47 -06:00
4029cdee7b Merge branch 'blender-v3.4-release' 2022-11-25 15:28:48 -06:00
680a0fb23b Fix T102752: Missing default radius when joining point clouds
Point clouds are meant to use a default radius of 0.01 when there is no
radius attribute. The curve to points node can create curves without a
radius attribute. This affects joining and the realize instances node.

Similar to 30f244d96f.
2022-11-25 15:25:37 -06:00
ed8fee16ac Fix: Hide "Squeeze Value" node from node search
Based on discussion in D10891, this node isn't meant to be exposed and
may be removed in the future. The fact that it was exposed in search
menus was a mistake from the implementation of link-drag-search
and bdb5754147.

I explicitly removed the link drag search implementation, and added
(Legacy) to the node name which hides it from the add node search.
2022-11-25 14:59:27 -06:00
4a0e19e608 Cleanup: Group deprecated mesh DNA fields, improve comments 2022-11-25 12:54:22 -06:00
5ca6965273 Merge branch 'blender-v3.4-release' 2022-11-25 18:54:49 +01:00
0147e09e0b Python Module: add project description for pypi 2022-11-25 18:54:00 +01:00
f07b09da27 Cycles: Improve oneAPI backend support for non-Intel platforms 2022-11-25 17:46:59 +01:00
f83aa1ae08 Fix T102764: Slow change of active material slot
The issue is caused by the combination of the following factors:

- There is a driver from custom property to the subdivision surface
  modifier.
- Active material index tags the ID for the copy-on-write update.

Dependency graph currently does not fully distinguish between
copy-on-write tag and properties-update tag, so the copy-on-write tag
makes the dependency graph believe that it is property which actually
affects evaluation has been changed.

The simple solution is to treat the active material slot index as an
interface data which does not need to trigger copy-on-write tag.

The possible downside of this solution is that if someone has a driver
from this property the driver will stop working. Whether there is such
a real-life setup or not is not clear. Is not something advisable to do
anyway.

Possible alternative would be to introduce more granularity into the
way how property tagging is done. This is something that would be nice
to implement eventually, but it is a much bigger refactor.

Differential Revision: https://developer.blender.org/D16613
2022-11-25 17:44:54 +01:00
d1c21d5673 Fix T102470: Make material LineArt properties animatable.
MaterialLineArt didn't have a path func, now corrected.
2022-11-25 23:18:41 +08:00
b5ca43b2a0 Fix T102470: Make material LineArt properties animatable.
MaterialLineArt didn't have a path func, now corrected.
2022-11-25 23:15:39 +08:00
994e3c6ac5 Clarify depsgraph API usage in the libraries code
Basically copy the information from the commit message of the
03e2f11d48 directly to the code.

This makes the information easier to find when working on the
code.
2022-11-25 15:25:55 +01:00
dad0f37c1e Fix T101824: Line art flickers when light object has scaling.
Line art doesn't expect light or camera objects to have scaling.
2022-11-25 22:21:26 +08:00
118afe1de3 Fix T101824: Line art flickers when light object has scaling.
Line art doesn't expect light or camera objects to have scaling.
2022-11-25 22:00:21 +08:00
ae6e35279f Clarify comment about ID_RECALC_COPY_ON_WRITE
The copy-on-write is really an implementation detail of the
dependency graph. While there are still cases where there is
no better tag to be used, the ID_RECALC_COPY_ON_WRITE should
not be used in combination with a dedicated tag.

For example if location of object changes the proper tag is
`ID_RECALC_TRANSFORM`. Tagging with `ID_RECALC_TRANSFORM |
ID_RECALC_COPY_ON_WRITE` will seemingly work, but this is
not an intended usage.
2022-11-25 14:55:50 +01:00
043673ca70 Cleanup: Alembic, deduplicate CacheObjectPath creation
No functionnal changes.
2022-11-25 14:37:48 +01:00
3cf803cf3c Cleanup: Alembic, use MEM_cnew
Avoids extra cast. No functionnal change.
2022-11-25 14:27:18 +01:00
6422f75088 Merge branch 'blender-v3.4-release' 2022-11-25 12:44:05 +01:00
b918c079da Fix T101402: EEVEE: Wrong Volume transforms
Ensure VolumeUniformPool uses is always incremented when retrieving a buffer in alloc().
Otherwise the same buffer will be retrieved for more than one object when incrementing the pool size.

Reviewed By: fclem

Maniphest Tasks: T101402

Differential Revision: https://developer.blender.org/D16607
2022-11-25 12:43:30 +01:00
6bc3311410 Fix: Missing node warning when compositor is enabled
If the compositor is enabled or disabled, the node warnings for
unsupported nodes is not updated because of a missing redraw. This patch
adds that missing redraw in order to make the change immediate.
2022-11-25 13:19:13 +02:00
60ad5f49fa Cleanup: move C++ declarations to separate .hh header 2022-11-25 12:18:10 +01:00
826535979a Nodes: add non-const utility to find socket by identifier
This does the same as the corresponding const method.
2022-11-25 12:11:13 +01:00
32690cafd1 Fix: Missing compositor warning for Render Layers
The Render Layers node didn't draw a warning in the viewport when an
unsupported pass is used. This patch adds that warning.
2022-11-25 12:59:50 +02:00
64c26d2862 Merge branch 'blender-v3.4-release' 2022-11-25 11:45:01 +01:00
848dff1e4c Fix: assert when converting between types in geometry nodes
This bug only affected debug builds.
2022-11-25 11:44:17 +01:00
b9c358392d BLI: Fix error in vector library and add more test for operators
The operator was wrongly returning a reference to local temp variable.

Add test for all uncovered operators.
2022-11-25 11:28:04 +01:00
0ce18561bc Fix (unreported) uv unwrap selected was splitting selection
Add support for `pin_unselected` in new UV Packing API.

Regression introduced by API change in rBe3075f3cf7ce.
2022-11-25 15:52:04 +13:00
851906744e Merge branch 'blender-v3.4-release' 2022-11-24 15:14:12 -06:00
c4cfa1b23e Fix T102611: Unable to change file output node sockets from python
Similar to 84c66fe9db
2022-11-24 15:11:03 -06:00
0710ec485e Cleanup: Remove unused IMB tile cache code (part 2)
Missed in the first commit[1].

Initially it was reported that the `flags` parameter was unused on
`imb_cache_filename` but it turns out another swath of code was unused
related to that same function. Clean this up now too.

[1] 38573d515e
2022-11-24 12:41:05 -08:00
49129180b2 Merge branch 'blender-v3.4-release' 2022-11-24 17:30:54 -03:00
cdc1c60f5b Fix T102466: push/pull doesn't work if applied to many vertices
The assignment of member`distance` was missing in rB2d4ec9049744.
2022-11-24 17:29:26 -03:00
58c8c4fde3 Animation: Improve performance of Bake Action operator
This dramatically improves baking performance by batch-adding keyframes
instead of adding them individually, reducing unnecessary overhead.

Testing indicates an approximate 4x performance uplift.

Reviewed By: sybren, RiggingDojo

Differential Revision: https://developer.blender.org/D8808
2022-11-24 11:26:17 -08:00
81754a0fc5 Cleanup: remove else after return. 2022-11-24 09:56:05 -08:00
412642865d Cleanup: Resolve a warning for the ambiguity on the parenthesis in oneAPI code
No functional changes.
2022-11-24 18:05:02 +01:00
14a0fb0cc6 Merge branch 'blender-v3.4-release' 2022-11-24 09:02:23 -08:00
959f3cd645 Sculpt: fix T102436: missing null pointer check in automasking code 2022-11-24 08:55:10 -08:00
Sebastian Herholz
008cc625aa Fix T102250: Cycles path guiding issue with equiangular sampling
The wrong guiding distribution was used when direct and indirect light
scattering happened at different locations. Now use a different distribution
for each location.

Recording is not quite correct since OpenPGL does not support spliting the
path like this, instead recording at the start of the volume ray. In practice
this seems to make little difference.

Differential Revision: https://developer.blender.org/D16448
2022-11-24 17:12:38 +01:00
de27925aea Fix (unreported) inconsistent name_map during file reading.
Swapping some ID lists between Mains must invalidate the name_map cache.

Note that in theory, at least WM type could be ignored by name_map
cache, since it is a singleton. However, don't think it's worth adding
extra complication here, for really marginal benefits. The overhead of
rebuilding the name cache here is extremly small.

For some reason, this issue did not show so far in master, only appeared
in some branch work on improving (in)direct status of linked IDs... Go
figure.
2022-11-24 17:08:18 +01:00
38c4f40159 Fix Cycles OSL issue with constant folding after recent fix
Constant folded values from linked nodes should override the OSL initializer.

Ref T102450
2022-11-24 16:59:58 +01:00
d6d5089c65 Metal: Fix a warning and compilation errors
These were oversight when developping without testing on MacOS.
2022-11-24 16:57:46 +01:00
20c1ce3d9b BLI: Make scalar vector constructor more generic
This makes it possible to use any type of scalar to init a vector and
reduce code duplication.
2022-11-24 16:16:42 +01:00
f47daa7ec9 Merge branch 'blender-v3.4-release' 2022-11-24 15:33:25 +01:00
6e37f14489 Windows: Run blender-launcher.exe instead of blender.exe
With this change Blender, delivered via the Microsoft store, will launch without the console window flashing.

Ref T88613

Differential Revision: https://developer.blender.org/D16589
2022-11-24 15:32:22 +01:00
Christoph Lendenfeld
bb665ef8d2 Merge branch 'blender-v3.4-release' 2022-11-24 15:20:30 +01:00
Christoph Lendenfeld
705fe08b61 Fix T99400: "Jump to Keyframe" preserves subframe offset
Previously when using the "Jump To Keyframe" operator
in conjunction with subframes, the decimal part would be kept.
Meaning that it wouldn't jump exactly to the frame.
This fix also makes it so it is possible to jump to keyframes
that are on subframes.

Reviewed by: Sybren
Differential Revision: https://developer.blender.org/D16595
2022-11-24 15:19:48 +01:00
1b7b996e16 Merge branch 'blender-v3.4-release' 2022-11-24 13:36:48 +01:00
17e562311f Draw: Use 32-bit floats for custom color attributes 2022-11-24 13:36:11 +01:00
2a53e0f437 FIX T102076: Add support for int attributes to draw manager.
Add int attributes interpolation support for GPU subdivision.
Ensure cached shaders match their intended defines.
(The defines parameter was ignored when requesting a second time the same shader with different defines)
De-duplicate the extract_attr_init code for subdiv/non-subdiv.

Reviewed By: jbakker, fclem

Maniphest Tasks: T102076

Differential Revision: https://developer.blender.org/D16420
2022-11-24 13:29:53 +01:00
5f626ac331 Cleanup: use more concise function names in function nodes
This is the same naming convention that's used for geometry nodes.
2022-11-24 12:49:17 +01:00
369914e7b1 Liblink: Add test over direct vs indirect link status.
Some checks are currently commented out, since Blender will never 'clear'
the directly linked status of an ID once it has been used by local data.
2022-11-24 10:52:27 +01:00
bbf09eb59c Merge branch 'blender-v3.4-release' 2022-11-24 10:15:36 +01:00
b3daf61ddf Fix T101020: Cycles Add Performance Preset is broken 2022-11-24 10:13:57 +01:00
2dcdfab94c Realtime Compositor: Warn about unsupported MacOS
This patch warns the user that MacOS is not supported for the viewport
compositor in the shading panel.

See T102353.
2022-11-24 09:25:44 +02:00
38573d515e Cleanup: Remove unused IMB tile cache code
This removes the unused code for the IBM tile cache APIs.  These have
been unused for as far back as I could manage to search.

Since TIFF was used for the cached images, this removal will allow for
an easier review when it comes time to move TIFF to OIIO as part of
T101413.

Differential Revision: https://developer.blender.org/D16587
2022-11-23 19:31:10 -08:00
f4e1f62c62 Merge branch 'blender-v3.4-release' 2022-11-23 19:35:39 +01:00
dc1ed9c1aa Cycles: add OSL support for hiding input socket value
When either initializing with a non-constant value, or using the standard
[[ string widget = "null" ]] metadata. This can be used for inputs like
normals and texture coordinates, where you don't want to default to a
constant value.

In previous OSL versions the input value was automatically ignore when it
was left unchanged for such inputs. However that's no longer the case in
the latest version, breaking existing nodes. There is no good entirely
backwards compatible fix, but I believe the new behavior is better and will
keep most existing cases working.

Fix T102450: OSL node with normal input not working
2022-11-23 18:59:52 +01:00
584089879c BLI: Follow up and fix recent span slicing change
a5e7657cee didn't account for slices of zero sizes, and the asserts
were slightly incorrect otherwise. Also, the change didn't apply to
`Span`, only `MutableSpan`, which was a mistake. This also adds "safe"
methods to `IndexMask`, and switches function calls where necessary.
2022-11-23 11:36:06 -06:00
38cf48f62b Fix: Missing caches in curves bounds evaluation 2022-11-23 11:36:06 -06:00
50aad904b3 Merge branch 'blender-v3.4-release' 2022-11-23 14:15:22 -03:00
962e221cd3 Fix T102720: Snapping in 3dViewport affects Graph, Action and NLA editors
These editors have their own "Auto-Snap" activation option.

So ignore the option in the 3D View in these cases.

The generic incremental snap function doesn't seem really useful in these cases.

If an incremental snap needs to be implemented, this should be a new option of `eAnimEdit_AutoSnap`.
2022-11-23 14:06:39 -03:00
f13160d188 Cleanup: quiet deprecation warnings
This fixes these warnings: P3340.
2022-11-23 17:15:33 +01:00
583f19d692 Merge branch 'blender-v3.4-release' 2022-11-23 17:03:17 +01:00
a87d78860b Fix T102693: adding shader node group to geometry nodes crashes
This is not supported currently, so just cancelling the operation
solves it. This might be supported in the future.
2022-11-23 17:01:49 +01:00
c1eeb38f7c Cleanup: Move poly normal calculation to mesh_normals.cc 2022-11-23 09:49:18 -06:00
c3d6f5ecf3 Merge branch 'blender-v3.4-release' 2022-11-23 16:39:09 +01:00
ea57c011de Fix T102579: object mode wireframe overlay not shown on geometry node primitive
After a recent refactor in b247588dc0, object mode would not show wireframe
edges that do not exist in the original mesh. Now only hide such edges while in
edit mode, where they would otherwise look as if they can be selected.

Before the refactor, edit and paint modes would sometimes show wireframes and
sometimes not, depending on the modifier stack in unpredictable ways.
2022-11-23 16:19:00 +01:00
737d363e02 Cleanup: remove unused node type
This wasn't used for backwards compatibility, because Blender does not
read from the `nodetype` anywhere. It also wasn't used for forward
compatibility, because it was not initialized for new node groups.
2022-11-23 16:15:25 +01:00
fe1b8b671a Fix part of T102696: Cycles Python error with macOS version 13.0.1 2022-11-23 16:03:19 +01:00
687272c409 Cleanup: compiler warnings 2022-11-23 16:03:19 +01:00
460f7ec7aa Windows: Run blender-launcher.exe instead of blender.exe
With this change Blender, delivered via the Microsoft store, will launch without the console window flashing.

Ref T88613

Differential Revision: https://developer.blender.org/D16589
2022-11-23 15:14:13 +01:00
Jeroen Bakker
a819523dff Vulkan: Add VK memory allocator 3.0.1 to extern.
Vulkan doesn't have a memory allocator builtin. The application should
provide the memory allocator at runtime. Vulkan Memory Allocator is a
widely used implementation.

Vulkan Memory Allocator is a header only implementation, but the using
application should compile a part in a CPP compile unit. The file
`vk_mem_alloc_impl.cc` and `extern_vulkan_memory_allocator` library
is therefore introduced.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D16572
2022-11-23 14:42:27 +01:00
68a450cbe4 Cleanup: Remove unused parameter in node draw 2022-11-23 15:06:40 +02:00
aa0c2c0f47 Cleanup: move some data from bNodeTree to run-time data
No functional changes are expected.
2022-11-23 14:05:30 +01:00
4f02817367 Nodes: remove bNodeTree->interface_type
This is not used for anything in practice currently. The original intention
was probably to generate different socket subtypes, but that is solved
differently now (e.g. using `NodeSocketFloatDistance`). It's possible
that an addon tried to use this but it's rather unlikely.

Differential Revision: https://developer.blender.org/D13188
2022-11-23 13:49:07 +01:00
247d75d2b1 Realtime Compositor: Warn about unsupported setups
This patch warns the user that the compositor setup is not fully
supported when an unsupported node is used. The warning is displayed as
an engine warning overlay and in the node header itself.

See T102353.

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

Reviewed By: Clement Foucault
2022-11-23 14:35:26 +02:00
6396d29779 Merge branch 'blender-v3.4-release' 2022-11-23 13:25:12 +01:00
ff9606ddc4 Fix use-after-free of asset catalog data in node add menu
(Probably requires ASan for a reliable crash.)

Steps to reproduce were:
* Enter Geometry Nodes Workspace
* Press "New" button in the geometry nodes editor header
* Right-click the data-block selector -> "Mark as Asset"
* Change 3D View to Asset Browser
* Create a catalog
* Drag new Geometry Nodes asset into the catalog
* Save the file
* Press Shift+A in the geometry nodes editor

There was a general issue here with keeping catalog pointers around
during the add menu building. The way it does things, catalogs may be
reloaded in between.
Since the Current File asset library isn't loaded in a separate thread,
the use-after-free would always happen in between. For other libraries
it could still happen, but apparently didn't by chance.
2022-11-23 13:23:21 +01:00
1c00b2ef70 Cleanup: move paint_cursor.c and paint_image_proj.c to C++
This makes it easier to use c++ when improving the internal node api.
2022-11-23 12:56:34 +01:00
106277be43 Merge branch 'blender-v3.4-release' 2022-11-23 12:54:15 +01:00
3250ab31cd Cleanup: Remove debug print
Was introduced in 0e6d893d07.
2022-11-23 12:53:35 +01:00
7d44676b5f Realtime Compositor: Disable on MacOS
This patch disables the realtime compositor on MacOS until Metal is
supported. This is because MacOS doesn't support the necessary GPU
features to make it work.

An engine error overlay is displayed if it is enabled and the option
itself is greyed out.

See T102353.

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

Reviewed By: Clement Foucault
2022-11-23 13:34:31 +02:00
11275b7363 Realtime Compositor: Extend option to enable compositor
This patch turns the checkbox option to enable the viewport compositor
into a 3-option enum that allows:

- Disabled.
- Enabled.
- Enabled only in camera view.

See T102353.

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

Reviewed By: Clement Foucault
2022-11-23 13:27:47 +02:00
80249ce6e4 Asset Browser: Allow changing active catalog from Python
The active catalog ID (UUID) was a read only property. From a studio I
got the request to make this editable, so their pipeline tooling can
make certain assets visible.

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

Reviewed by: Sybren Stüvel
2022-11-23 12:05:16 +01:00
e0c5ff87b7 Realtime Compositor: Implement Track Position node
This patch implements the Track Position node for the realtime
compositor.

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

Reviewed By: Clement Foucault
2022-11-23 12:56:24 +02:00
571f373155 UI: Don't render missing linked material previews, avoids UI freezing
Opening the material selector after reloading files could cause long UI
freezes, because some linked in materials don't have the preview stored
in the source file. So Blender would keep rerendering it after every
file load, which may involve compiling OpenGL shaders, which again
freezes the UI typically. This was reported as quite an issue for the
Heist Production by the Blender Studio.

Don't render these missing material previews from linked data-blocks
anymore.

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

Reviewed by: Brecht Van Lommel, Jeroen Bakker
2022-11-23 11:39:53 +01:00
c464fd724b Fix T102697: Gpencil Subdiv modifier level increased
The old hard limit was 5, but now it's possible set to a max
value of 16. UI limit remains to 5.

This extreme value is only used in some corner case, but it
was a request by some artists.

Warning: Using very high values could produce a long calculation time, especially in strokes with a high density of points.
2022-11-23 11:23:38 +01:00
356373ff7a Cleanup: move some data from bNodeSocket to run-time data
No functional changes are expected.
2022-11-23 10:42:17 +01:00
5938e97a24 Merge branch 'blender-v3.4-release' 2022-11-23 10:36:11 +01:00
0d73d5c1a2 Fix frozen image editor when Cycles compiles kernels
It is possible that the image editor redraw happens prior to the
"Loading render kernels" status is reported from status but after
the display driver is created. This will make the image editor to
wait on the scene mutex to update the display pass in the film.
If it happens to be that the kernels are actually to be compiled
then the Blender interface appears to be completely frozen, without
any information line in the image editor.

This change makes it so the amount of time the scene mutex is held
during the kernel compilation is minimal.

It is a bit unideal to unlock and re-lock the scene mutex in the
middle of update, while nested reset mutex is held, but this is
already what is needed for the OptiX denoiser optimization some
lines below. We can probably reduce the lifetime of some locks,
avoiding such potential out-of-order re-locking. Doing so is
outside of the scope of this patch.

The scene update only happens from the single place in the session,
which makes it easy to ensure the kernels are loaded prior the rest
of the scene update.

Not only this change makes it so that the "Loading render kernels"
status appears in the image editor, but also allows to pan and zoom
in the image editor, potentially allowing artists to re-adjust their
point of interest.

Differential Revision: https://developer.blender.org/D16581
2022-11-23 10:23:05 +01:00
01e479b790 Cleanup: simplify removing asset code
Differential Revision: https://developer.blender.org/D16570
2022-11-23 10:04:24 +01:00
63ae0939ed Merge branch 'blender-v3.4-release' 2022-11-23 10:22:42 +09:00
db28a8b3d1 Fix T102322: Crash on exiting VR session when using DirectX backend
This prevents Blender from crashing with an access violation when
stopping a VR session using the DirectX backend. The issue occurred for
any headset on Windows+Nvidia when using the SteamVR runtime and thus
affected a large number of users.

The workaround presented here is to simply skip unregistering the
shared resources on exit, as either of the calls to
`wglDXUnregisterObjectNV()` or `wglDXCloseDeviceNV()` will result in an
access violation. While not ideal, this avoids the crash and doesn't
present any issues when starting a new VR session.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D16569
2022-11-23 10:21:17 +09:00
cdcbf05ea8 BLI: Make Report Missing Files display message when no files are missing
Before this, if there were no missing files, the operator would run
successfully but there would be no user feedback at all, making the
user wonder if the operator was even run.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16585
2022-11-22 16:48:51 -08:00
2cb6b0b4eb Merge branch 'blender-v3.4-release' 2022-11-22 15:52:33 -06:00
41ae2c6438 Fix T102700: Viewer node missing check for empty geometry component
`GeometrySet::has()` can return an empty component. It's more convenient
if it doesn't, since other code rarely wants to access an empty component.

The alternative would be adding an `is_empty()` check in the lazy function
for the viewer node, that would work fine too, for this case.

Differential Revision: https://developer.blender.org/D16584
2022-11-22 15:40:42 -06:00
0e6d893d07 Fix: Assert, invisible instances with mixed instancing types
When combining the internal geometry component instancing (used when
the original object type doesn't match the evaluated data type) with
the "vertex dupli" instancing could cause the fix from e508de0417
to fail, because the subsequent fix from 864af51d6a popped from the
"instance generator type" stack even when there was nothing added to it
(for geometry instancing).
2022-11-22 15:38:19 -06:00
e3567aad0a Merge branch 'blender-v3.4-release' 2022-11-22 12:49:48 -08:00
af8a449ca5 blender-v3.4-release: fix more merge discrepencies in pbvh.c 2022-11-22 12:48:39 -08:00
0f3b3ee679 Merge branch 'blender-v3.4-release' 2022-11-22 12:48:29 -08:00
f5e99abb60 blender-v3.4-release: Rearrange function order to fix merging
BKE_pbvh_sync_visibility_from_verts was in the wrong spot
relative to master, was leading to very nasty merge errors.
2022-11-22 12:45:09 -08:00
40ac3776db Merge branch 'blender-v3.4-release' 2022-11-22 12:41:54 -08:00
acf8f6220d Sculpt: Fix box face sets not working for multires 2022-11-22 12:30:36 -08:00
df788ecfd9 Sculpt: Standardize face set undo steps, optimize memory usage
Currently the face set of every single face is saved for every sculpt undo step.
When only changing the face sets of a small section of the mesh, this can be quite
wasteful. It also makes face sets a special case compare to all other sculpt undo step
types, which makes the whole system more complex and harder to improve.

Fixes T101203.

Reviewed By: Hans Goudey
Differential Revision: https://developer.blender.org/D16224
Ref D16224
2022-11-22 12:14:14 -08:00
a777c09d5f Sculpt: Standardize face set undo steps, optimize memory usage
Currently the face set of every single face is saved for every sculpt undo step.
When only changing the face sets of a small section of the mesh, this can be quite
wasteful. It also makes face sets a special case compare to all other sculpt undo step
types, which makes the whole system more complex and harder to improve.

Fixes T101203.

Reviewed By: Hans Goudey
Differential Revision: https://developer.blender.org/D16224
Ref D16224
2022-11-22 12:13:33 -08:00
41f58fadae Cleanup: Decrease variable scope, change names in BMesh layer handling 2022-11-22 14:03:39 -06:00
aa1a51ff9f Merge branch 'blender-v3.4-release' 2022-11-22 13:52:30 -06:00
3f294a37f5 Fix: Use after free when removing attribute
We currently check multiple dynamic attribute providers for the
attribute ID, even after it has been removed (which can free the name).
This was used as a simple way to remove multiple attributes with the
same name (dealing with name collisions). However, that doesn't happen
in practice at this point, since so much code has moved to the
attribute API which checks for it.
2022-11-22 13:48:58 -06:00
461cb550cc Fix T102670: Crash after deleting attribute in edit mode
Since we free BMesh attributes by attempting on every domain,
sometimes the attribute wouldn't be found for a CustomData.
We avoid reallocating custom data blocks in that case, so we
need to pass the ownership of the "pool" back to the BMesh.
2022-11-22 13:48:58 -06:00
55db44ca2c Merge branch 'blender-v3.4-release' 2022-11-22 11:17:30 -08:00
fa8a59689b Sculpt: fix const error 2022-11-22 11:14:36 -08:00
c3e919b317 Sculpt: Fix broken multires hidden undo
Wrote a new API method, BKE_pbvh_sync_visibility_from_verts
that flushes vertex hidden flags to edges & faces.

Fixes not being able to sculpt outside a face set after
undoing the fkey hide-all-but-this operator.
2022-11-22 11:11:03 -08:00
a2a72d89b1 Sculpt: Fix broken multires hidden undo
Wrote a new API method, BKE_pbvh_sync_visibility_from_verts
that flushes vertex hidden flags to edges & faces.

Fixes not being able to sculpt outside a face set after
undoing the fkey hide-all-but-this operator.
2022-11-22 10:56:39 -08:00
14d0b57be7 Cleanup: Use array_utils to copy evaluated field array 2022-11-22 12:49:51 -06:00
8e535ee9b4 Cleanup: Remove unused math min max utility
This has a friendlier multithreaded implementation in BLI_bounds.hh now.
2022-11-22 12:31:31 -06:00
772696a1a5 Geometry Nodes: Parallelize bounds compuation in points to volume
On my computer this saves a few milliseconds when there are
over 1 million points.
2022-11-22 12:13:52 -06:00
8990983b07 Cleanup: Use const arguments for custom normals 2022-11-22 11:48:16 -06:00
a5e7657cee BLI: Remove clamping from span slicing
Currently slicing a span clamped the final size so that it would be
within bounds of the input. However, in the vast majority of cases
that is already the case anyway, and we can use asserts to detect
when that assumption fails.

The clamping had a performance cost. On a test interpolating a boolean
attribute from 1 million curves to 4 million points, removing the
clamping saved about 10% of the time. That's an extreme case but
this probably slightly improves performance in other cases too.
Slicing is used a lot in the new curve code.

This commit introduces `slice_safe` which still does the clamping,
and uses it in the few places that needed it or where I wasn't
sure.
2022-11-22 11:29:24 -06:00
822dab9a42 Cleanup: Strict compiler warnings
Mark function as local to the translation unit.
2022-11-22 17:52:44 +01:00
67194fb247 Merge branch 'blender-v3.4-release' 2022-11-22 16:35:26 +01:00
f8d6bbeb63 Fix compilation error.
Regression introduced by 6d7a067a83.
Fixed by adding an import to BKE_node_runtime.hh.
2022-11-22 15:02:08 +01:00
ed82bbfc2c Cleanup: use designated initializers in C 2022-11-22 10:48:16 -03:00
dd5fdb9370 GPU: Add MoltenVK as dependencies to Vulkan SDK.
MoltenVK is part of the vulkan SDK. Blender requires the vulkan SDK
to compile. This patch adds the MoltenVK includes and libraries to
the Vulkan includes and libraries.
2022-11-22 14:07:34 +01:00
51f56e71cb Merge branch 'blender-v3.4-release' 2022-11-22 13:41:07 +01:00
6d7a067a83 Fix T100904: Shader Nodes: Optimize-out inactive mix branches
Ensure inactive mix branches don't modify material flags or generate code.

Reviewed By: fclem

Maniphest Tasks: T100904

Differential Revision: https://developer.blender.org/D16533
2022-11-22 13:39:20 +01:00
02c6136958 Fix compile error with msvc
error C2059: syntax error: '}'
2022-11-22 09:13:16 -03:00
b79e5ae4f2 GHOST: Add missing C_API function to header file.
- GHOST_GetDrawingContext was missing.
2022-11-22 12:45:49 +01:00
7dea18b3aa Tracking: Store lens principal point in normalized space
This avoids need to do special trickery detecting whether the principal
point is to be changed when reloading movie clip. This also allows to
transfer the optical center from high-res footage to possibly its lower
resolution proxy without manual adjustment.

On a user level the difference is that the principal point is exposed in
the normalized coordinates: frame center has coordinate of (0, 0), left
bottom corner of a frame has coordinate of (-1, -1) and the right top
corner has coordinate of (1, 1).

Another user-visible change is that there is no more operator for setting
the principal point to center: use backspace on the center sliders will
reset values to 0 which corresponds to the center.

The code implements versioning in both directions, so it should be
possible to open file in older Blender versions without loosing
configuration.

For the Python API there are two ways to access the property:
- `tracking.camera.principal_point` which is measured in the normalized
  space.
- `tracking.camera.principal_point_pixels` to access the pixel-space
  principal point.

Both properties are not animatable, so there will by no conflict coming.

Differential Revision: https://developer.blender.org/D16573
2022-11-22 11:49:56 +01:00
04dc58df83 Tracking: Mark more deprecated RNA access as such
Also clarify a bit the new way of accessing the data.
2022-11-22 11:49:56 +01:00
294ff0de43 Cleanup: More clear function name
Make it explicit in the name that track index is the one used for
selection (previously it read as if the track index is within its
list).
2022-11-22 11:49:56 +01:00
f383dfabf7 Cleanup: Simplify public tracking API
Remove functions which are a trivial accessor.
2022-11-22 11:49:56 +01:00
d37efe332c Tracking: Mark deprecated active tracks access as such 2022-11-22 11:49:56 +01:00
ceaf4779da Fix active track always assigned for the active object
A missing part from the storage split refactor.
2022-11-22 11:49:56 +01:00
88d9ed3c1c Fix missing update on active motion track change from Python 2022-11-22 11:49:56 +01:00
0b251493c8 Tracking: Raise python exception when assigning wrong active track
Before this an attempt to assign track from another object wos
silently assigning active object to null. Such silencing of
errors is not really a good way.
2022-11-22 11:49:56 +01:00
ea969ccc02 Refactor: Replace marker visibility macro with function
Also optimize sub-optimal request for active object for every
call of the check.

Should be no functional changes.
2022-11-22 11:49:56 +01:00
b864397201 Refactor: Clip editor tracking selection operator
De-duplicate selection logic and threshold between various
operators (selection and sliding).

The user measurable difference is that regular selection
threshold now matches sliding threshold: it is more strict
now. The possible downside of this is that it might be more
tricky to select tracks, but this is what needs to happen
for tools support. Also, this matches object selection in
viewport.
2022-11-22 11:49:56 +01:00
4d1a116cdf Refactor: Simplify tracking active element accessor API
Use active object accessor, and then access data from the
object. There is no need to have an API call for shortcut
of all object fields.

Should be no functional change.
2022-11-22 11:49:56 +01:00
1300da6d39 Cleanup: More clear function name in tracking module
Make it more obvious in the name that an operation is not
cheap, and that the function operates on a tracks from
object and does not need a global tracking structure.
2022-11-22 11:49:56 +01:00
016f9c2cf5 Cleanup: Variable naming in tracking files
Make it obvious that the object is the motion tracking one, and
not the ID_OB type.
2022-11-22 11:49:56 +01:00
953f719e58 Cleanup: Variable scope in tracking files 2022-11-22 11:49:56 +01:00
1168665653 Refactor: Remove trivial accessor functions from tracking 2022-11-22 11:49:56 +01:00
fe38715600 Refactor: Unify storage for motion tracking camera and objects
Historically tracks and reconstruction for motion tracking camera
object were stored in the motion tracking structure. This is because
the data structures pre-dates object tracking support, and it was
never changed to preserve compatibility.

Now the compatibility code supports more tricks and allows to change
the ownership without breaking any compatibility. This is what this
change does: it moves tracks from motion tracking structure to the
motion tracking camera object, and does it in a way that no
compatibility is broken.

One of the side-effects of this change is that the active track is
now stored on motion tracking object level, which allows to change
active motion tracking object without loosing active track. Other
than that there are no expected user-level changes.
2022-11-22 11:49:56 +01:00
4d497721ec Refactor: Streamline tracking data copying a bit
Prepare the code to more easily support pointers remapping
for tracking objects.

Should be no functional changes.
2022-11-22 11:49:56 +01:00
3c479b9823 Movie clip: Remove special selection synchronization function
The function is already doing a lot of memory indirections and
sub-optimal lookups, so for the simplicity and robustness of the
system might as well just do copy-on-write update.
2022-11-22 11:49:56 +01:00
7411fa4e0d Cleanup: Better const-correctness in tracking code 2022-11-22 11:49:56 +01:00
44d7ec7e80 Clip Editor: Migrate orientation file to C++
Should be no functional changes.

Some of the code is suboptimal from C++ syntax point of view.
It will be worked on as a further development.
2022-11-22 11:49:56 +01:00
Jeroen Bakker
6dac345a64 GHOST: Vulkan Backend.
This adds a vulkan backend to GHOST. The code was extracted from the
tmp-vulkan branch. The main difference with the original code is that
GHOST isn't responsible for fallback. For Metal backend there is already
an idea that the GPU module is responsible for the fallback, not the system.

For Blender we target Vulkan 1.2 at the time of this patch.
MoltenVK (needed to convert Vulkan calls to Metal) has been added as
a separate package.

This patch isn't useful for end-users, currently when starting blender with
`--gpu-backend vulkan` it would crash as the `VBBackend` doesn't initialize
the expected global structs in the GPU module.

Validated to be working on Windows and Apple. Linux still needs to be tested.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D13155
2022-11-22 11:29:09 +01:00
efa87ad5eb Merge branch 'blender-v3.4-release' 2022-11-22 10:48:55 +01:00
8c82d4cbf6 Fix T102684: GPencil Crash when trying to sculpt with Dot Dash
The problem was the original pointer was not set.

There is a technical limitation with dots of 1 point
because it cannot assign orig pointer.
2022-11-22 10:47:58 +01:00
89349067b6 Merge branch 'blender-v3.4-release' 2022-11-21 18:01:29 -06:00
b53c4fa8da Fix T102522: Geometry nodes boolean doesent respect material index
The refactor in f1c0249f34 incorrectly placed the material index
remapping before the transfer of generic attributes. Now that the
material index is a generic attribute, it was overwritten.
2022-11-21 15:49:18 -06:00
25ddb576ff Cleanup: add ATTR_FALLTHROGUH 2022-11-21 10:43:12 -08:00
02e045ffbe Merge branch 'blender-v3.4-release' 2022-11-21 19:19:58 +01:00
Nathan Vegdahl
03b5be4e3c Cycles: use more PMJ patterns and make their size adaptive.
This resolves some issues with correlation artifacts at higher sample counts.

Fix T101356, correlation issues in new PMJ pattern.

Differential Revision: https://developer.blender.org/D16561
2022-11-21 18:49:13 +01:00
be1745425c Nodes: Remove "level" building pass on update
The node level was an indication of how deep the node was in the tree.
It was only used for detecting link cycles. Now that the node topology
cache from 25e307d725 exists, this calculation can be removed
completely.

The level calculation was quadratic and very slow on larger node trees.
In the mouse house file with a few thousand nodes, it took 23ms on
every single update. Another benefit is storing slightly less runtime
data, though this was only 2 bytes per node.

Differential Revision: https://developer.blender.org/D16566
2022-11-21 11:34:22 -06:00
b391037424 Nodes: Use topology cache for node exec node list
Instead of generating a dependency sorted node list whenever evaluating
texture or EEVEE/viewport shader nodes, use the existing sorted array
from the topology cache. This may be more efficient because the
algorithm isn't quadratic. It's also the second-to-last place to
use `node.runtime->level`, which can be removed soon.

Differential Revision: https://developer.blender.org/D16565
2022-11-21 11:30:49 -06:00
41a3de878f Fix part of T102450: Cycles OSL render issues for with normals in shader nodes
Commit c8dd33f5a37b6a6db0b6950d24f9a7cff5ceb799 in OSL changed behavior of
parameters that reference each other and are also overwritten with an
instance value. This is causing the "NormalIn" parameter of a few OSL nodes
in Cycles to be set to zero somehow, which should instead have received the
value from a "node_geometry" node Cycles generates and connects automatically.

I am not entirely sure why that is happening, but these parameters are
superfluous anyway, since OSL already provides the necessary data in the
global variable "N". So this patch simply removes those parameters (which
mimics SVM, where these parameters do not exist either), which also fixes
the rendering artifacts that occured with recent OSL.

While this fixes built-in shader nodes, custom OSL scripts can still have
this problem.

Ref T101222

Differential Revision: https://developer.blender.org/D16470
2022-11-21 18:15:35 +01:00
b0e38f4d04 Cleanup: Strict compiler warnings
Remove `private:` from the PBVHFaceIter. This is not really a C++
class, and the C++ code generates a lot of warnings about unused
fields.

Also mark function static and run clang-format.
2022-11-21 16:57:46 +01:00
Iliya Katueshenock
2f69266c64 Cleanup: use topology cache for frame timings overlay
Differential Revision: https://developer.blender.org/D16571
2022-11-21 16:10:05 +01:00
5d08396970 Merge branch 'blender-v3.4-release' 2022-11-21 15:53:42 +01:00
Jarrett Johnson
8fe423a7a9 DRW: Fix pointcloud selection
Fixes point cloud selection by using new draw call.

Reviewed By: fclem

Maniphest Tasks: T102659

Differential Revision: https://developer.blender.org/D16501
2022-11-21 15:51:29 +01:00
Jarrett Johnson
1c0f5e79fa DRW: Fix pointcloud selection
Fixes point cloud selection by using new draw call.

Reviewed By: fclem

Maniphest Tasks: T102659

Differential Revision: https://developer.blender.org/D16501
2022-11-21 15:50:32 +01:00
2910be8f19 Cleanup: Correct semantics for .blend listing in file/asset browser
When attempting to load contents of a .blend, the code would just assume
if the number of added items is 0, that means it's not a .blend (but a
directory, although the previous commit fixed that part already).
However there may be situations where a .blend file simply doesn't
contain anything of interest to be added (e.g. when listing assets
only), so have a proper "none" value for this.
2022-11-21 12:29:18 +01:00
c58e7da43e Asset Browser: Avoid non-existent directory prints
When loading asset libraries, there would be a bunch of "non-existent
directory" prints because we were calling a function to list directory
contents on .blend file paths. Make sure the path actually points to a
directory.
2022-11-21 12:29:18 +01:00
9f83ef2149 BLI: make different pointer types compatible in hash tables
For example, this allows doing a lookup using a raw pointer in a
hash table that uses `std::unique_ptr` as key.
2022-11-21 12:02:10 +01:00
85990c877c Merge branch 'blender-v3.4-release' 2022-11-21 11:45:12 +01:00
b75946bcb6 Fix T102620: Display dynamic socket label in uiTemplateNodeView
Some nodes, like Combine Color or the math nodes, label sockets
differently depending on the mode to be more descriptive.
`uiTemplateNodeView` now also uses this dynamic label rather than the
socket's name for labeling in the UI so the shown labels always match
the ones on the node itself.

Reviewed By: Hans Goudey

Differential Revision: http://developer.blender.org/D16563
2022-11-21 11:43:30 +01:00
71efb7805b Merge branch 'blender-v3.4-release' 2022-11-21 11:23:18 +01:00
3648fd9917 Fix: node frame boundaries incorrect when opening files
Make sure that frame dimensions are updated in the correct order.
2022-11-21 11:22:44 +01:00
7a6cdeb242 Merge remote-tracking branch 'origin/blender-v3.4-release' 2022-11-20 18:31:53 -07:00
24bd2d0bea Fix T98726: Include blender version number in windows shortcuts
You can install several versions of blender side by side and all
of them will try to create a "Blender" shortcut, which if already
exists the msi installer throws a warning about.

This change adds the blender version number to the desktop and start
menu shortcuts, side steps the problem and it's easier to tell the
various blender versions apart.
2022-11-20 18:31:00 -07:00
Wannes Malfait
e83f46ea76 Geometry Nodes: Use Mesh instead of BMesh in split edges node
Rewrite the edge split code to operate directly on Mesh instead
of BMesh. This allows for the use of multi-threading and makes
the node around 2 times faster. Around 15% of the time is spent
just on the creation of the topology maps, so these being cached
on the mesh could cause an even greater speedup. The new node
gave identical results compared to the BMesh version on all the
meshes I tested it on (up to permutation of the indices).

Here are some of the results on a few simple test cases:
(Intel i7-7700HQ (8 cores) @ 2.800GHz , with 50% of edges selected)
|       | 370x370 UV Sphere | 400x400 Grid | Suzanne 4 subdiv levels |
| ----- | ----------------- | -------------- | --------------------- |
| Mesh  | 89ms              | 111ms          | 76ms                  |
| BMesh | 200ms             | 276ms          | 208ms                 |

Differential Revision: https://developer.blender.org/D16399
2022-11-20 15:42:10 -06:00
97e0cc41ca Nodes: Simplify view panning when selecting node
The "Activate Same Type Next/Prev" and "Find Node" operators pan
the view to the newly selected node if it's outside of the view. This
simplifies that check and improves it in the case where the node
is only partially visible-- now it pans in while it didn't before.
2022-11-20 14:45:58 -06:00
984edb2c4e Nodes: Replace implementation of select next/prev type operator
The previous code was quadratic; it looped over every link for every
node. For one large node tree I tested the operator took 20ms. On the
same node tree it now takes less than 1ms.

The change replaces the current building of the "dependency list"
on every call with a use of the topology cache from 25e307d725.
2022-11-20 14:45:58 -06:00
012895e8a1 Cleanup: Remove unused node operator property 2022-11-20 14:45:58 -06:00
47c92bf8de Cleanup: Remove unused boolean in node select function 2022-11-20 14:45:58 -06:00
afb7da5538 Sculpt: Add comment explaining PaintMaskFloodMode 2022-11-20 09:53:29 -08:00
b041678028 Merge branch 'blender-v3.4-release' 2022-11-20 09:44:53 -08:00
03b7982301 Sculpt: Fix T102349: improperly aliased enum
PaintMaskFloodMode is supposed to be an alias
of eSelectOp.  paint_intern.h now includes
ED_select_utils.h and simply assigns the
relevent members of eSelectOp to PaintMaskFloodMode's
members.
2022-11-20 09:41:53 -08:00
42c30f3b9c Sculpt: Fix missing const in recent commit 2022-11-20 08:17:02 -08:00
6b3cee2538 Sculpt: Face iterator API
This patch adds basic face iterators to the sculpt API.  The interface is similar to the existing vertex iterators.  It's not C++ (though it does mark private fields in PBVHFaceIter as private if compiling under C++).

Example:

```
PBVHFaceIter fd;

BKE_pbvh_face_iter_begin(pbvh, node, fd) {

  /* Face reference and face index */
  PBVHFaceRef face = fd->face;
  int face_index = fd->index;

  /* Can read and modify hide flag if it exist (it may not) */
  if (fd->hide) {
    *fd->hide ^= true; /* toggle hide */
  }

  /* Can read and modify face set if it exists */
  if (fd->face_set) {
    *fd->face_set = something;
  }

  /*Can read vertices*/
  for (int i=0; i<fd.verts_num; i++) {
    float *co = SCULPT_vertex_co_get(ss, fd.verts[i]);
  }
}
BKE_pbvh_face_iter_end(fd);
```

Reviewed By: Brecht Von Lommen and Hans Goudey
Differential Revision: https://developer.blender.org/D16225
Ref D16225
2022-11-20 08:08:26 -08:00
5097105b3c Sculpt: Fix T102567: multires crash with high subdivision levels
Previous fix did not work for ngons.
The pbvh leaf limit minimum is now set
to the maximum ngon's vertex count.
2022-11-20 07:32:21 -08:00
7193e5aa10 Sculpt: Fix T102567: multires crash with high subdivision levels
Previous fix did not work for ngons.
The pbvh leaf limit minimum is now set
to the maximum ngon's vertex count.
2022-11-20 07:30:14 -08:00
41d29a1603 Merge branch 'blender-v3.4-release' 2022-11-20 07:18:45 -08:00
567ae90374 Sculpt: fix T102584: Boundary propegation for automasking not working 2022-11-20 07:18:04 -08:00
d24c0011cf GPencil: Make Ignore Transparent option more consistent
The code was doing the oposite of the UI option.

Related to T102625
2022-11-20 11:22:20 +01:00
0fd94a1f5e Tests: enable element-wise multiplication for mathutils API tests 2022-11-20 10:42:17 +11:00
9100cc0f39 Merge branch 'blender-v3.4-release' 2022-11-20 10:41:19 +11:00
4cac8025f0 Cleanup: use int32_t type, update comments
Reference WIP patches for warping on the spot, follow up to T102346.
2022-11-20 10:39:43 +11:00
4d17301ba4 Merge branch 'blender-v3.4-release' 2022-11-19 20:47:16 +01:00
63c4ec89e1 Fix T102514: wrong scene reported for missing compositing camera
If compositing uses renderlayers, and a camera was missing in the
associated scenes, the error message also referred to the scene the comp
tree was in (not the scene of the renderlayer -- which can potentionally
be different).

This was confusing and is now rectified.

Maniphest Tasks: T102514

Differential Revision: https://developer.blender.org/D16542
2022-11-19 20:43:52 +01:00
dfb157f9c4 Merge branch 'blender-v3.4-release' 2022-11-19 19:09:49 +01:00
331e8007ed Fix T102520: Positioning of nodes added via search
Always position the nodes added with the node search at the point where
the search operator was invoked by ensuring the operator context is the
main node editor region.

This was an unintended change of rBbdb57541475f, caused by the operator
now getting the cursor position in region space. So when the operator
was called from the menu, it would get the cursor position in the
region space of the menu, which lead to an offset when adding the node
since it expected the coordinates to be in the space of the node editor.

Setting the correct operator context also fixes inconsistent transform
sensitivity depending on zoom when adding nodes via the search in the
menu which has been an issue since as far back as Blender 2.79.

Also includes a small fix for the vertical offset of nodes added by the
search which varied depending on the UI scale. Same fix as in
rB998ffcbf096e.

Reviewed By: Hans Goudey

Differential Revision: http://developer.blender.org/D16555
2022-11-19 19:03:38 +01:00
2654c523c1 Cleanup: use nullptr in C++ 2022-11-19 11:51:42 +01:00
7ca9fb9865 Merge branch 'blender-v3.4-release' 2022-11-19 21:15:28 +11:00
9fd6dae793 Fix T102346: Mouse escapes window during walk navigation
Regression in [0] which exposed a problem with GHOST_kGrabHide on Win32
and to some extent X11.

Prior to [0], walk mode used it's own warping logic (hiding the cursor
& recording the motion between events). Using GHOST's grabbing makes
sense in this case as it's not very convenient for operators to
implement their own cursor warping, however doing so exposed a problem
where the mouse cursor could leave the window.
This would happen because the cursor needed to be within 2px of the
screen edge before warping.

Resolve by warping within a small region in the middle of the window.

Note that warping to the window center on each motion would be ideal
but is more involved as the logic for Win32 & X11 doesn't work properly
when every motion warps, so this needs further investigation to support.

This problem doesn't apply to GHOST/Cocoa which warps every motion event
on the spot and GHOST/Wayland doesn't set the mouse position at all to
implement this functionality.

[0]: 4c4e8cc926
2022-11-19 20:57:59 +11:00
Aaron Carlisle
bfb3d78902 Cleanup: Remove disabled edge slide keymap feature
This feature has been disabled since 2.80 but the feature description was still visible in the UI.

Addresses part of T101429

Breaking changes:

- Removes `EDGESLIDE_EDGE_NEXT`
- Removes `EDGESLIDE_PREV_NEXT`

Reviewed By: mano-wii

Maniphest Tasks: T101429

Differential Revision: https://developer.blender.org/D16430
2022-11-18 21:13:33 -05:00
511ac66dab Mesh: Use shared cache for derived triangulation
Use the shared cache system introduced in e8f4010611 for the
"looptris" triangulation cache. This avoids recalculation when meshes
are copied but the positions or topology don't change. The most obvious
improvement is for cases like a large meshes being adjusted slightly
with a simple geometry nodes modifier. In a basic test with a transform
node with a 1 million point grid I observed an improvement of 13%, from
9.75 to 11 FPS, which shows that we avoid spending 6ms recalculating
the triangulation of every update.

This also makes the thread safety for the triangulation data use a
more standard double-checked lock pattern, which is nice because we
can avoid holding a lock whenever the cached data is retrieved.

Split from https://developer.blender.org/D16530
2022-11-18 17:29:24 -06:00
12d7994a48 Cleanup: Improve comment about copying mesh shared caches 2022-11-18 17:02:30 -06:00
c83e33b661 Cleanup: Sort includes in mesh header 2022-11-18 17:01:38 -06:00
05f93b58d3 Fix: Crash when writing mesh after previous commit
Runtime data was accessed after it was explicitly set to null.
2022-11-18 16:24:15 -06:00
1ea169d90e Mesh: Move loose edge flag to a separate cache
As part of T95966, this patch moves loose edge information out of the
flag on each edge and into a new lazily calculated cache in mesh
runtime data. The number of loose edges is also cached, so further
processing can be skipped completely when there are no loose edges.

Previously the `ME_LOOSEEDGE` flag was updated on a "best effort"
basis. In order to be sure that it was correct, you had to be sure
to call `BKE_mesh_calc_edges_loose` first. Now the loose edge tag
is always correct. It also doesn't have to be calculated eagerly
in various places like the screw modifier where the complexity
wasn't worth the theoretical performance benefit.

The patch also adds a function to eagerly set the number of loose
edges to zero to avoid building the cache. This is used by various
primitive nodes, with the goal of improving drawing performance.
This results in a few ms shaved off extracting draw data for some
large meshes in my tests.

In the Python API, `MeshEdge.is_loose` is no longer editable.
No built-in addons set the value anyway. The upside is that
addons can be sure the data is correct based on the mesh.

**Tests**
There is one test failure in the Python OBJ exporter: `export_obj_cube`
that happens because of existing incorrect versioning. Opening the
file in master, all the edges were set to "loose", which is fixed
by this patch.

Differential Revision: https://developer.blender.org/D16504
2022-11-18 16:05:06 -06:00
c0f33814c1 Fix T102611: Unable to change file output node sockets from python
Similar to 84c66fe9db
2022-11-18 14:01:40 -06:00
ab819517fc Fix: Crash when deleting node
Caused by b4c3ea2644 not removing the
dangling pointers to the freed internal links from the vector.
2022-11-18 13:58:36 -06:00
21adf2ec89 Cleanup: Split UV sample geometry node into two functions
This separates the UV reverse sampling and the barycentric mixing of
the mesh attribute into separate multi-functions. This separates
concerns and allows for future de-duplication of the UV sampling
function if that is implemented as an optimization pass. That would
be helpful since it's the much more expensive operation.

This was simplified by returning the triangle index in the reverse
UV sampler rather than a pointer to the triangle, which required
passing a span of triangles separately in a few places.
2022-11-18 13:38:55 -06:00
8fa69dafdd Cleanup: Remove unnecessary using keyword and namespace 2022-11-18 13:38:55 -06:00
b3b00be34e UI: Simplify description for geometry node socket
Simplify wording of "Output true" to a noun.
2022-11-18 13:38:55 -06:00
1c0cd50472 Curves: Add descriptions for normal mode RNA enum
This is only exposed in the "Set Normal Node" now but will be used in
more places in the future.
2022-11-18 13:38:55 -06:00
f5128f219f Cleanup: Use simpler check for Bezier curves 2022-11-18 13:38:55 -06:00
c6e4953719 Fix use-after-free of asset catalog data in node add menu
(Probably requires ASan for a reliable crash.)

Steps to reproduce were:
* Enter Geometry Nodes Workspace
* Press "New" button in the geometry nodes editor header
* Right-click the data-block selector -> "Mark as Asset"
* Change 3D View to Asset Browser
* Create a catalog
* Drag new Geometry Nodes asset into the catalog
* Save the file
* Press Shift+A in the geometry nodes editor

There was a general issue here with keeping catalog pointers around
during the add menu building. The way it does things, catalogs may be
reloaded in between.
Since the Current File asset library isn't loaded in a separate thread,
the use-after-free would always happen in between. For other libraries
it could still happen, but apparently didn't by chance.
2022-11-18 17:52:59 +01:00
b211266226 Merge branch 'blender-v3.4-release' 2022-11-18 16:05:10 +01:00
6c0a5461f7 Fix build error when not using unity build 2022-11-18 16:04:56 +01:00
3d41d0b1b5 Fix T100537: gaps in Cycles depth pass with transparency
For some pixels with transparent surfaces, no depth value would be written
when sampling chooses a reflection/refraction BSDF instead of transparent
BSDF. Now ensure we always write at some some depth value to the pass.

This is still not ideal as the resulting depth values are noisy same as they
are for depth of field and motion blur, but at least there should be no gaps.
2022-11-18 15:52:34 +01:00
0151d846e8 Fix MSVC warnings from recent asset system changes
* Mismatching class vs struct forward declaration (one forward
  declaration wasn't needed anymore)
* Unused member warning (`on_load_callback_store_`)
2022-11-18 15:20:16 +01:00
4e38771d5c Merge branch 'blender-v3.4-release' 2022-11-18 13:56:43 +01:00
Sayak Biswas
c94583cd64 Cycles: enable AMD RDNA3 GPUs and upgrade HIP compiler
* Enable AMD RDNA3 GPUs
* Fix T100891: performance regression with RDNA2 cards
* Workaround new compiler issue with Vega, by using -O1

Differential Revision: https://developer.blender.org/D16507
2022-11-18 13:54:21 +01:00
b4c3ea2644 Cleanup: move internal links of nodes to runtime data
No functional changes are expected.
2022-11-18 13:46:35 +01:00
40b63bbf5b Merge branch 'blender-v3.4-release' 2022-11-18 12:50:21 +01:00
7b82d8f029 Nodes: move most runtime data out of bNode
* This patch just moves runtime data to the runtime struct to cleanup
  the dna struct. Arguably, some of this data should not even be there
  because it's very use case specific. This can be cleaned up separately.
* `miniwidth` was removed completely, because it was not used anywhere.
  The corresponding rna property `width_hidden` is kept to avoid
  script breakage, but does not do anything (e.g. node wrangler sets it).
* Since rna is in C, some helper functions where added to access the
  C++ runtime data from rna.
* This size of `bNode` decreases from 432 to 368 bytes.
2022-11-18 12:47:02 +01:00
754f674977 Cleanup: Missing trailing underscore in private asset system member vars
See style guide:
https://wiki.blender.org/wiki/Style_Guide/C_Cpp#Class_data_member_names
2022-11-18 12:45:56 +01:00
d5c8d3e661 Cleanup: Avoid unnecessary/annoying type alias in asset system
A `using FooPtr = std::unique_ptr<Foo>` isn't that useful usually, just
saves a few character stokes. It obfuscates the underlying type, which
is usually relevant information. Plus, `Ptr` for a unique pointer is
misleading (should be `UPtr` or similar).
2022-11-18 12:45:56 +01:00
61d0f77810 Cleanup: Better follow class layout style guide in asset headers
Move "using" declarations and member variables to the top of the class.
See https://wiki.blender.org/wiki/Style_Guide/C_Cpp#Class_Layout.

Changes access specifiers of some variables from public/protected to
private, there was no point in not having them private.
2022-11-18 12:45:56 +01:00
e31f282917 Cleanup: Minor cleanups in asset system headers
- Move main comment on class to header comment where it's more visible.
- Improve comment.
- Move stdlib includes first, like we do it usually
- Separate includes my code module
- Remove unnecessary forward declarations
2022-11-18 12:45:56 +01:00
7c0cecfd00 Asset system: Move catalog tree code to own files
The catalog code is already quite complex, I rather keep the tree stuff
separate in a more focused unit.
2022-11-18 12:45:56 +01:00
3e81d177ea Fix Grease Pencil materials added by Python missing
These materials were missing from the "Change Active Material" menu.

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.

Similar to rB182edd4c35c2.

Fixes T102566.

Maniphest Tasks: T102566

Differential Revision: https://developer.blender.org/D16541
2022-11-18 12:34:16 +01:00
Iliya Katueshenock
6239e089cf Nodes: cache children of frame nodes
This allows for optimizations because one does not have to iterate
over all nodes anymore to find all nodes within a frame.

Differential Revision: https://developer.blender.org/D16106
2022-11-18 11:20:13 +01:00
dec459e424 Cleanup: move some files that use nodes to C++ 2022-11-18 11:08:52 +01:00
bc886bc8d7 Cleanup: Use int64_t for size methods.
- BKE_pbvh_pixels.hh
2022-11-18 10:45:06 +01:00
Pablo Vazquez
2c096f17a6 UI: Refactor Node Context Menu
The Node Context Menu contains options that are not always available for
the selected nodes, and misses important entries for accesibility.

This patch covers the following:
* Add operators to join and remove nodes from frames.
* Sort and group entries more logically and follow Blender conventions.
* Add `Insert into Group`
* Show group actions only on nodes that support it.
* Move all toggles to a sub-menu called `Show/Hide`.
* When nothing is selected, show Add menu, links actions, and paste.

Inspired by RightClickSelect proposals and community feedback.

See D16216 for images.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D16216
2022-11-17 23:27:12 +01:00
8d77973dd7 Fix T99125: Curve mapping widget removes all vector points
Add a new flag value `CUMA_REMOVE` to explicitly tag duplicate points
for removal. This prevents a bug where all curve points with vector
handles were deleted, when removing duplicate curve points while
updating the widget. This happened, because the flag value used to tag
points for removal was the same as the value of `CUMA_HANDLE_VECTOR`
used to store the handle type of the curve point.

Reviewed By: Hans Goudey

Differential Revision: http://developer.blender.org/D16463
2022-11-17 22:00:17 +01:00
9de35e396b Fix T99125: Curve mapping widget removes all vector points
Add a new flag value `CUMA_REMOVE` to explicitly tag duplicate points
for removal. This prevents a bug where all curve points with vector
handles were deleted, when removing duplicate curve points while
updating the widget. This happened, because the flag value used to tag
points for removal was the same as the value of `CUMA_HANDLE_VECTOR`
used to store the handle type of the curve point.

Reviewed By: Hans Goudey

Differential Revision: http://developer.blender.org/D16463
2022-11-17 21:54:30 +01:00
609a681fb5 Merge branch 'blender-v3.4-release' 2022-11-17 17:51:23 +01:00
52c3214776 Fix distortion regression test after recent commit
The 1a1341c387 made it so that when ID's path changes the ID is
tagged for the source re-evaluation. Another factor here is that
there is a code in the read file which replaces alternative path
slash with the native one.

Typically it is not a problem since IDs are re-evaluated on load,
but the movie clip has the special handling on load to calculate
the image sequence length and initialize principal point.

This change makes it so that the principal point is only reset
when the clip resolution changes. This is something which is
also useful for cases when a non-centered primncipal point is
used and someone accidentally clicks on the clip reload button.
It is not really ideal but covers most of the common cases.
Ideally the principal point will be stored in relative or
normalized space.

The remaining part is that there is now extra image sequence
length calculation after file load. This needs more careful
look.
2022-11-17 17:50:13 +01:00
ca253df623 Cleanup: move transform_snap to C++ 2022-11-17 17:13:49 +01:00
f74234895a Merge branch 'blender-v3.4-release' 2022-11-17 17:05:03 +01:00
1c27cc5529 Fix T92416: First render with unknown image colorspace looks different
The issue here was that the Barbershop benchmark scene was saved with a
custom OCIO config, which leads to some textures having a unknown
colorspace when loading with a default installation.

This is automatically fixed by Blender during image loading, but since
Cycles queried the colorspace before actually loading the image, it
didn't get the updated value in the first render.

To fix this, just re-query the colorspace after the image is loaded.

Note that non-packed images still get treated as raw data if the
colorspace is unknown, but this is at least consistent and doesn't
magically change when you press F12 a second time.

Differential Revision: https://developer.blender.org/D16427
2022-11-17 16:52:04 +01:00
011c2a37eb Cycles: Sort properties in Path Guiding panel
* Sort Training Samples first, since it affects both Surface and Volume guiding.
* Remove "Guiding" from Surface and Volume entries (UI only, the property
  still has Guiding in the name)

Change reviewed in the render-cycles module channel.
2022-11-17 16:18:28 +01:00
780b29109c Merge branch 'blender-v3.4-release' 2022-11-17 16:05:01 +01:00
617cf2f291 Cycles: remove cubin compiler build option
This was previously needed due to poor compatibility between Visual Studio and
NVCC. But it has not been used for a while now as compatibility seems to have
improved.
2022-11-17 16:04:07 +01:00
6bf13d0734 Fix crash when loading different file with asset browser open
Steps to reproduce were:
- Open an asset browser
- Open an asset library with assets in it
- Load a different file (e.g. File -> New -> General)

Didn't see a nice way to fix this with the current pre file load handler
callback we use for freeing asset libraries. Using this is cleaner, but
for now, the relationship between UI and asset system is too close
still, so better do explicit freeing at the right point in time.
2022-11-17 15:50:08 +01:00
c7bd508766 Cleanup outliner instancing collection code.
Remove needless call to `id_lib_extern`, this is already part of
`id_ud_plus` code.
2022-11-17 15:46:31 +01:00
53f401ea63 Merge remote-tracking branch 'origin/blender-v3.4-release' 2022-11-17 07:29:58 -07:00
58795c6047 win-launcher: linger when launched from steam
The launcher is designed to exit as soon as possible
so there's no useless processes idling. Now when steam
launches blender with the launcher, this breaks the
time tracking steam has as the thing it just started
exits within milliseconds.

There already is some code in the launcher that makes
the launcher linger to support background mode. This
patch extends this a bit to also wait if the parent
process is steam.exe

Reviewed by: brecht lichtwerk dingto
Differential Revision: https://developer.blender.org/D16527
2022-11-17 07:29:09 -07:00
27f277d948 Fix T102577: make update issues with python x86_64 running on macOS Arm
Still default to arm64 libraries in that case.
2022-11-17 14:06:52 +01:00
576d99e59a Cleanup: move texture nodes to C++
No functional changes are expected. The goal here is to make
further refactorings to the nodes system easier.
2022-11-17 13:04:45 +01:00
dad8f4ac09 Merge branch 'blender-v3.4-release' 2022-11-17 12:21:10 +01:00
a67b33acd0 libOverride: RNA API: Add option to make all overrides editable in override_hierarchy_create.
Request from Paul Golter (@paulgolter).
2022-11-17 12:20:51 +01:00
59f8061a34 Assets: Refactor asset representation storage
- Move code to manage storage to own class in own file, separates
  concerns and different levels of abstraction better.
- Store local ID assets separately in the storage class for more
  efficient lookups (e.g. for ID remapping).
- Make API function names and comments more complete.
2022-11-17 11:55:38 +01:00
67869432f2 Asset system: Remap local asset ID pointers as part of UI remapping
After checking with @mont29, this is much prefered over calling this in
BKE directly.
2022-11-17 11:55:38 +01:00
dd260d2f03 Fix T102554: Crash when Use Nodes is enabled
Blender crashes when enabling Use Nodes after the viewport compositor is
already enabled.

This happens because the active viewer key is not yet initialized for the
node tree at this point, which eventually leads to a nullptr.

This patch fixes that by returning the root context in case the active
viewer key is not yet initialized.
2022-11-17 11:12:41 +02:00
9a09adb7af Fix: Missing bounding box dirty tag when clearing mesh geometry
Similar to 801451c459.
2022-11-16 18:30:04 -06:00
bf0180d206 Sculpt: Remove some normal calculation with deformed sculpting
Remove unnecessary (and No-op) normal calculation when sculpting on top
of deformed coordinates. Examples are shape keys and deform modifiers.
On a 1 million face mesh, this saved 100ms per stroke update.
This function actually did nothing since cfa53e0fbe,
so that large improvement comes for free.

Conceptually this is correct because when sculpting on deformed
coordinates, we don't change the positions of the base mesh directly.
In the future it might be better to allocate a separate array for
normals when using deformed coordinates, but it's not clear that's
necessary yet.
2022-11-16 18:22:09 -06:00
c481549870 Cleanup: Remove unused node clipboard type handling 2022-11-16 18:01:34 -06:00
845a3573f5 Cleanup: Improve curves comments 2022-11-16 17:54:51 -06:00
Yann Doersam
b7a4f79748 Nodes: Allow pasting common nodes between editor types
Ignore difference between source and target tree type. When copying
nodes from clipboard to target tree compatibility is checked. After
pasting nodes only the links between nodes that are existing in the
node tree are added.

See Task T95033.

Differential Revision: https://developer.blender.org/D16349
2022-11-16 17:36:30 -06:00
0d3a33e45e Geometry Nodes: Add "Exists" output to Named Attribute input node
As described in T100004, add an output socket that returns true if the
attribute accessed by the node was already present in that context.

Initial patch by Edward (@edward88).

Differential Revision: https://developer.blender.org/D16316
2022-11-16 17:27:28 -06:00
145839aa42 Fix T102365: Wireframe skips edges after recent cleanup
10131a6f62 replaced use of the `ME_EDGERENDER` flag with
`ME_EDGEDRAW`. However, left over from previous refactors, code
for leaving edit mode set that flag based on the edge angle. Edge angle
wireframe hiding is currently supposed to be adjustable with the
wireframe overlay settings. This patch restores the previous behavior
from before the cleanup commit.

Differential Revision: https://developer.blender.org/D16451
2022-11-16 16:49:02 -06:00
cacfaaa9a5 Fix T92416: First render with unknown image colorspace looks different
The issue here was that the Barbershop benchmark scene was saved with a
custom OCIO config, which leads to some textures having a unknown
colorspace when loading with a default installation.

This is automatically fixed by Blender during image loading, but since
Cycles queried the colorspace before actually loading the image, it
didn't get the updated value in the first render.

To fix this, just re-query the colorspace after the image is loaded.

Note that non-packed images still get treated as raw data if the
colorspace is unknown, but this is at least consistent and doesn't
magically change when you press F12 a second time.

Differential Revision: https://developer.blender.org/D16427
2022-11-16 23:42:23 +01:00
1677ddb7ee Sculpt: Avoid retrieving vertices attribute when flushing positions
Currently the positions are retrieved again for every vertex. This is
slow, and will get slower when positions are stored as a named
attribute. Saves around 0.5ms per stroke update when a modifier
is active in my test with a 1 million face mesh.
2022-11-16 14:54:20 -06:00
87ace7207d Revert "Sculpt/Paint: Use cached triangulation when building PBVH"
This reverts commit 676137f043.

This change worked locally with a specific test file and local changes,
but didn't work in general, since we don't reliably retrieve the new
looptris after setting them the first time. This can be improved again
in the future, but probably along with a more general look about ownership
is handled with PBVH.
2022-11-16 14:29:12 -06:00
676137f043 Sculpt/Paint: Use cached triangulation when building PBVH
This avoids recalculation of looptri derived triangulation whenever
switching to sculpt mode or whenever the PBVH is rebuilt, which can
happen after strokes in some situations. In my tests actually building
the PBVH is much more expensive (300ms), but this saves 6ms when
switching to sculpt mode and in other situations.

The cost is the possibility of higher memory usage because the cache
will live in the original main database mesh. However, the impact of
that will be smaller when the shared cache concept from D16204 is
applied to this data too.
2022-11-16 13:35:27 -06:00
25b3515324 Cleanup: Remove unnecessary mesh normals debugging function
This assertion function came from when derived normal data was stored
as custom data layers, which made it harder to keep track of whether
it was allocated and propagated. Nowadays it's all relatively easy to
predict, so there's no point in keeping this function around-- it only
makes code longer and more complex looking.
2022-11-16 13:07:49 -06:00
6cf4999e50 Cleanup: Slightly improve mesh normals and runtime comments
Also resolved an unused variable warning caused by an earlier cleanup.
2022-11-16 12:54:48 -06:00
89ca298210 Cleanup: Don't set mesh normals directly for metaballs
At the cost of a memory copy, this allows using a C++ type to store
normals in mesh runtime data in upcoming patches.
2022-11-16 12:37:35 -06:00
99c970a94d UI: Allow Joining of Tiny Screen Areas
Allow joining of areas that are below our minimum sizes.

See D16522 for more details.

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

Reviewed by Campbell Barton
2022-11-16 09:53:06 -08:00
Rateeb Riyasat
cce4271b31 Add regression test for triangulate faces
Basic test for `quads_convert_to_tris`

As the operator name in blender is different from the bpy name, the operator
name in blender was opted in terms of the blend file collection name as well
as the test name. This was done so that new developers in the future can
easier understand which operator this corresponds to. Although it might be
better to change this to the bpy name so as to be consistent with the rest
of the codebase.

Updated blend file `lib/tests/modeling/operators.blend` has been
committed as rBL63101.

Reviewed By: zazizizou, mont29

Differential Revision: https://developer.blender.org/D16072
2022-11-16 18:34:11 +01:00
801451c459 Fix: Missing clearing of mesh triangulation data
Missed in e412fe1798
2022-11-16 11:25:54 -06:00
a81abbbb8f Fix T100772: Joins with Interfering Tiny Areas
Detect unlikely situation of an area (that is smaller than our allowed
minimums) sharing an edge that will be moved during a join.

See D16519 for more details.

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

Reviewed by Campbell Barton
2022-11-16 09:08:15 -08:00
841460afce Build: add back WITH_JACK option on macOS, but disabled by default
Jack has not been installed on the buildbot builders for a long time and so
should not be enabled by default to pass strict build options added in D16104.

However for those doing custom builds the option should remain available.
2022-11-16 18:06:33 +01:00
6077fe7fae Merge branch 'blender-v3.4-release' 2022-11-16 18:00:48 +01:00
1a1341c387 Fix T101326: Missing updates when updating ID file paths.
This code mainly tags IDs with `ID_RECALC_SOURCE` when one of their file
paths is modified by `BKE_bpath_foreach_path_id`.

In addition, a check is added to `BKE_sound_evaluate` to call similar
code as when `ID_RECALC_AUDIO` is used.

Finally, Sergey added some changes to relations buildings between
components for Sound IDs in the depsgraph, linking `PARAMETER` to
`AUDIO`.

Maniphest Tasks: T101326

Differential Revision: https://developer.blender.org/D16528
2022-11-16 17:58:24 +01:00
f7ca0ecfff Cleanup: Cognitive complexity in mask animation filtering
No functional changes expected.
2022-11-16 15:29:14 +01:00
4f2ce8d8d3 DrawManager: Remove experimental draw lock.
The draw locking was implemented for project Heist and moved behind an experimental
feature after it became clear there were issues with it. Nowadays it isn't used,
and the idea is to replace it with a different solution after all draw engines have
been ported to the new draw manager API. {T102180}

This patch will remove the experimental feature as it isn't used, or useful.
2022-11-16 15:18:39 +01:00
5a05fa8f74 Merge branch 'blender-v3.4-release' 2022-11-16 11:01:29 -03:00
1a4a96a9d1 Fix allocated array size for MeshExtract_EdgeFac_Data
The array size is actually 1/4 of the currently allocated size.

Also, cleanup, use `uint8_t` instead of `uchar`.

No functional changes.
2022-11-16 10:57:15 -03:00
59641042a7 Fix T101836: Blender crashes upon render finish when clearing unused data during a render.
Imgaes which are render results and the like should not be considered as
unused, even if they do not have actual users.

NOTE: this does not apply to 'regular' images, which should be purged by
the recursive purge code, even if they are currently shown in an Image
Editor (this is not actual data usage).
2022-11-16 14:56:58 +01:00
3b35d9d667 Fix T100905: Official releases have the wrong branch in buildinfo
This is really old decision which should have been revisited as soon
as an overlapped release cycle was introduced.

The initial reasoning for such branch name override was to make it so
corrective releases have the same branch as the initial release when
we followed fully linear release cycle.

Nowadays such branch override is confusing and could even be misleading.

There are no add-ons using this property so it is very unlikely that
this is a breaking change.
2022-11-16 14:55:25 +01:00
44ec911633 Fix T99044: Dopesheet crash when accessing Key menu in Mask mode
The `animdata_filter_mask()` was not respecting the filter flag of
`ANIMFILTER_FCURVESONLY` which lead to cases when animation system
element is effectively cast from `MaskLayer*` to `FCurve*`.

The proposed solution more closely follows the GreasePencil filtering
makes it so when `ANIMFILTER_FCURVESONLY` flag is uses no mask layer
channels will be added.

Differential Revision: https://developer.blender.org/D16498
2022-11-16 14:55:25 +01:00
e4871b2835 EEVEE/Viewport: Make info text when compiling shaders more clear
The N in `Compiling Shaders N` in Text Info, is the number of how many
shaders are left in the queue. It's a countdown, but this wasn't mentioned
and led to confusion.

Ideally this text would be like Cycles' "Samples 50/100", but in EEVEE it's
not easy to guess how many shaders are left (this number could even go
up mid-compilation).

In the past there used to be a progress bar but it's also confusing because
it could be 90/100 shaders done, but the remaining 10 are slow to compile.

Change the text to "Compiling Shaders (N remaining)" so it's easier to
understand what is going on. Similar to how some game engines do.
2022-11-16 14:28:21 +01:00
0ebb7ab41f Geometry Nodes: disable unreachable nodes in evaluator
Nodes that were not connected to any output could still impact performance.
While they were never executed, sometimes their inputs could keep references
to geometries that other nodes want to modify. That caused unnecessary geometry
copies, because a geometry can only be modified if it is not shared.

Now, inputs that will never be used are tagged accordingly and they will never
have references to geometries that others might want to modify.
2022-11-16 14:26:11 +01:00
c2a68c066b Fix T95335 Bevel operator Loop Slide overshoot.
If the edge you are going to slide along is very close to in line
with the adjacent beveled edge, then there will be sharp overshoots.
There is an epsilon comparison to just abandon loop slide if this
situation is happening. That epsilon used to be 0.25 radians, but
bug T86768 complained that that value was too high, so it was changed
to .0001 radians (5 millidegrees). Now this current bug shows that
that was too aggressively small, so this change ups it by a factor
of 10, to .001 radians (5 centidegrees). All previous bug reports
remained fixed.
2022-11-16 08:23:29 -05:00
edcce2c073 Cleanup: correct inverted variable name 2022-11-16 13:19:23 +01:00
1e88fc251f Cleanup: remove unused data member 2022-11-16 13:19:23 +01:00
71ce178b3e Merge branch 'blender-v3.4-release' 2022-11-16 12:55:44 +01:00
51914d4a4a Fix T100530: Drawing arifacts Volume/AMD.
Missing initialization of global shader variable.
Most drivers initialize these by them selves, but not all of them.
2022-11-16 12:55:21 +01:00
06e9d40c33 Merge branch 'blender-v3.4-release' 2022-11-16 12:32:51 +01:00
Damien Picard
9d732445b9 I18n: make a few messages translatable.
I18n: make a few messages translatable

    * Missing Paths * in the Presets menu when no preset exists yet.
    The White Noise entry in the Add Node menu is the only one lacking a "Texture" suffix, which doesn't seem justified since the node itself is already called "White Noise Texture". Rename the entry its name can be extracted and used for the node--and for consistency.
    New object material node names (Principled BSDF, Material Output) come from a preset node tree. The nodes' names need to be translated after creation.
    Extract the "Fallback Tool" pie menu title.
    Translate grease pencil options in the viewport overlay menu.

Ref T102030.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D16345
2022-11-16 12:27:20 +01:00
Damien Picard
f415051a57 I18n: fix printf-style format translation in release/scripts/startup
Many reports and a few labels used string formatting without
explicitly calling tip_() or iface_(), so the untranslated message
was used instead of the translated one, even when it was extracted.

Differential Revision: https://developer.blender.org/D16405
2022-11-16 12:08:53 +01:00
Damien Picard
2683b74cb3 I18n: make screen capture image name translatable
The default name when saving a screen capture in an unsaved .blend
file is "screen.<ext>". This can be translated.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D16486
2022-11-16 12:05:03 +01:00
ec9acdeac2 Merge branch 'blender-v3.4-release' 2022-11-16 21:37:01 +11:00
91d3cc51c3 Merge branch 'blender-v3.4-release' 2022-11-16 21:36:55 +11:00
33fa053fe8 GHOST/Wayland: add missing lock in setWindowCursorShape
Also add some comments for locking.
2022-11-16 21:35:56 +11:00
02fa3a8128 Cleanup: remove unused window_manger reference in GHOST_WindowWayland 2022-11-16 21:04:30 +11:00
1aa851e939 Mesh: Don't tag normals and triangluation dirty when translating
This only applies to procedural operations rather than edit mode
operations, but it might save some recalculations of these caches
for the transform geometry node in some cases.
2022-11-15 23:58:34 -06:00
c8c14d1681 Cleanup: Remove unnecessary clearing of mesh runtime data
The calls in the remesh operator were unnecessary because the mesh is
about to be replaced anyway, and nothing invalidates the caches, and
the call in BMesh -> Mesh conversion was unnecessary because the caches
are cleared at the top of the function already.
2022-11-15 23:43:22 -06:00
90fb1cc4e6 Cleanup: Remove unnecessary dirty normal tags
These were redundant for one of a few reasons:
- A call to `BKE_mesh_tag_coords_changed` was correct instead
- A mesh has dirty normals when created from scratch anyway
- The call was redundant with `BKE_mesh_runtime_clear_geometry`
2022-11-15 20:28:39 -06:00
192cd76b7c Fix: Build error on MSVC with mismatched struct/class keywords 2022-11-15 20:26:33 -06:00
e412fe1798 Cleanup: Simplify freeing and clearing mesh runtime data
Separate freeing and clearing mesh runtime data in a more obvious way.
This makes it easier to see what data is meant to be cleared on certain
changes, rather than conflating it with freeing all of the runtime
caches.

Also comment and reduce the surface area of the "mesh runtime" API.
The redundancy in some functions made it confusing which one should
be used, resulting in subtle bugs or unnecessary boilerplate code.

Also, now bke::MeshRuntime is able to free all the data it owns by
itself, which makes this area easier to reason about. That required
changing the interface of a few functions to avoid passing Mesh when
they really just dealt with some runtime struct.

With more RAII semantics in the future, more of this manual freeing
will become unnecessary.
2022-11-15 20:26:33 -06:00
550c51b08b Merge branch 'blender-v3.4-release' 2022-11-16 12:33:59 +11:00
71067a58ec Merge branch 'blender-v3.4-release' 2022-11-16 12:33:55 +11:00
6940c4b602 Merge branch 'blender-v3.4-release' 2022-11-16 12:33:53 +11:00
0ac19425d4 Merge branch 'blender-v3.4-release' 2022-11-16 12:33:49 +11:00
e3ddfedbb6 Merge branch 'blender-v3.4-release' 2022-11-16 12:33:46 +11:00
5e203c4f4b Merge branch 'blender-v3.4-release' 2022-11-16 12:33:43 +11:00
25630ab2a1 Merge branch 'blender-v3.4-release' 2022-11-16 12:33:38 +11:00
88c9f1266d GHOST/Wayland: add additional locks for correctness
Some of these functions should use locks although they didn't show up
as needing locks at runtime (using valgrind's helgrind), as some aren't
called often or aren't used at all. Add locks for correctness & to
prevent errors in the future.

- GHOST_SystemWayland::disposeContext
- GHOST_SystemWayland::getAllDisplayDimensions
- GHOST_SystemWayland::getButtons
- GHOST_SystemWayland::getMainDisplayDimensions
- GHOST_SystemWayland::getNumDisplays
- GHOST_WindowWayland::setWindowCustomCursorShape
2022-11-16 12:32:13 +11:00
1f5e1b59a3 GHOST/Wayland: quiet key modifier warning under gnome-shell
This was already suppressed in `getModifierKeys`,
but `keyboard_depressed_state_key_event` was still warning.
2022-11-16 12:31:30 +11:00
c2c41fb14c Fix missing title-bar redrawing with Wayland & libdecor
Regression in [0], changing active/inactive missed redrawing the
title-bar,

[0]: 37b256e26f
2022-11-16 12:31:30 +11:00
64a114d11c GHOST/Wayland: add build option to set the XDG app-id
Add WITH_GHOST_WAYLAND_APP_ID so people making custom builds may
differentiate the blender instance by version/branch etc.
2022-11-16 12:31:30 +11:00
d1a5f24e73 Cleanup: move GHOST_WindowWayland::swapBuffers behind ifdef
The callback is only used for an assertion.
2022-11-16 12:31:30 +11:00
aee5fcc120 GHOST/Wayland: improve workaround for libdecor setting the window state
libdecor has a workaround where creating the window would loop until
the windows configure callback ran.

Simplify this workaround by setting the initial state on the underlying
xdg_toplevel struct.

Also correct mixup between bool / GHOST_TSuccess types.
2022-11-16 12:31:29 +11:00
9f0e9f36be GHOST/Wayland: extend on comments regarding locking 2022-11-16 12:31:29 +11:00
87ba0dcaca Merge branch 'blender-v3.4-release' 2022-11-15 18:55:18 -06:00
f7e0317b96 Fix T102537: Curve subdivide mishandles single point curves
Also, single point cyclic Catmull Rom curves aren't evaluated properly.
Cyclic is meant to make no difference in that case. Now they correctly
evaluate to a single point.
2022-11-15 18:52:19 -06:00
60523ea523 Cleanup: format 2022-11-16 12:59:47 +13:00
9f2f9dbca6 Merge branch 'blender-v3.4-release' 2022-11-16 11:28:57 +13:00
4401c93e45 Fix T100926: Show UV outline in texture paint mode
After rB716ea1547989 the UV overlay is no longer displayed in
the UV Editor. It only appears for the Image Editor.

So restore the previous behavior, displaying the "UV shadow"
overlay in the UV editor as well.

Reviewed By: Jeroen Bakker, Germano Cavalcante

Maniphest Tasks: T92614, T100926

Differential Revision: https://developer.blender.org/D16490
2022-11-16 11:18:55 +13:00
da82d46a5a Cleanup: simplify asserts in uv unwrapper 2022-11-16 10:36:09 +13:00
65944e7e84 Merge branch 'blender-v3.4-release' 2022-11-15 22:13:08 +01:00
Martijn Versteegh
c0df88f3b5 Fix: Link drag search crash with incorrect socket name in switch node
When dragging out a boolean noodle, releasing and choosing
'switch > Switch' from the search popup, the code would mistakenly
search for 'Start' instead of 'Switch'.

Also the function called was not exactly the right one, leading to the
node being marked as invalid.

Reviewed By: Jacques Lucke

Differential Revision: https://developer.blender.org/D16512
2022-11-15 22:12:25 +01:00
e8f4010611 Geometry: Cache bounds min and max, share between data-blocks
Bounding box calculation can be a large in some situations, especially
instancing. This patch caches the min and max of the bounding box in
runtime data of meshes, point clouds, and curves, implementing part of
T96968.

Bounds are now calculated lazily-- only after they are tagged dirty.
Also, cached bounds are also shared when copying geometry data-blocks
that have equivalent data. When bounds are calculated on an evaluated
data-block, they are also accessible on the original, and the next
evaluated ID will also share them. A geometry will stop sharing bounds
as soon as its positions (or radii) are changed.

Just caching the bounds gave a 2-3x speedup with thousands of mesh
geometry instances in the viewport. Sharing the bounds can eliminate
recalculations entirely in cases like copying meshes in geometry nodes
or the selection paint brush in curves sculpt mode, which causes a
reevaluation but doesn't change the positions.

**Implementation**
The sharing is achieved with a `shared_ptr` that points to a cache mutex
(from D16419) and the cached bounds data. When geometries are copied,
the bounds are shared by default, and only "un-shared" when the bounds
are tagged dirty.

Point clouds have a new runtime struct to store this data. Functions
for tagging the data dirty are improved for added for point clouds
and improved for curves. A missing tag has also been fixed for mesh
sculpt mode.

**Future**
There are further improvements which can be worked on next
- Apply changes to volume objects and other types where it makes sense
- Continue cleanup changes described in T96968
- Apply shared cache design to more expensive data like triangulation
  or normals

Differential Revision: https://developer.blender.org/D16204
2022-11-15 13:48:00 -06:00
b2d9716b4a Cleanup: Remove DerivedMesh use in UV unwrapping
Previously the UV unwrapping handling for subsurf modifiers used
`DerivedMesh`to implement the subdivision. Since we're trying to remove
`DerivedMesh` in general, and since this just made use of the `Mesh`
data anyway, it's relatively simple to remove it here. Combined with
D15939, this makes it possible to remove more `DerivedMesh` code.

Differential Revision: https://developer.blender.org/D16487
2022-11-15 13:48:00 -06:00
d775995dc3 DRW: Manager: Add possibility to bind UBO and VBO as SSBO through commands
This exposes `GPU_uniformbuf_bind_as_ssbo` and `GPU_vertbuf_bind_as_ssbo`
through the `draw::Pass` API.
2022-11-15 20:16:25 +01:00
a9a5f7ce17 GPU: UniformBuf: Add GPU_uniformbuf_clear_to_zero
This allows clearing the entire buffer directly on GPU.
2022-11-15 20:16:25 +01:00
b8fd474bb1 Merge branch 'blender-v3.4-release' 2022-11-15 18:41:24 +01:00
8831c6f056 Fix T101965: Shadow bounds ignore the light Volume Factor
Take invsqrdist_volume into account for computing shadow bounds.

Reviewed By: fclem

Maniphest Tasks: T101965

Differential Revision: https://developer.blender.org/D16513
2022-11-15 18:40:58 +01:00
50b257715f Assets: Avoid quadratic complexity when freeing asset libraries
Using a vector to store assets means we have to lookup the position of
the asset to be able to remove/free it. Use a `blender::Set` instead for
(nearly?) constant time removal.
2022-11-15 17:44:47 +01:00
2f442234e7 Merge branch 'blender-v3.4-release' 2022-11-15 08:42:55 -08:00
6a97668c9b Sculpt: Port cavity_from_mask propery naming changes to 3.4 branch 2022-11-15 08:41:42 -08:00
2d251478bb Sculpt: Fix mask from cavity settings issues
Mask from cavity can now pull settings from three
places: the operator properties, scene tool settings
or the brush.  This is needed to make the "create mask"
button work as expected.
2022-11-15 08:39:06 -08:00
e460f188f0 Sculpt: Fix mask from cavity settings issues
Mask from cavity can now pull settings from three
places: the operator properties, scene tool settings
or the brush.  This is needed to make the "create mask"
button work as expected.
2022-11-15 08:34:45 -08:00
277b2fcbfa GPU: Update Vulkan backend with latest API changes.
UniformBuf::bind_as_ssbo has been introduced.
2022-11-15 16:24:30 +01:00
4fb02d7f8e Fix T102482: Crash loading geometry nodes assets after file load
Asset library data is destructed on file load. Asset lists (weak and
hopefully temporary design) contain pointers into it that would dangle
then. Make sure the asset lists are destructed before the asset library
data.
2022-11-15 16:21:06 +01:00
cff78860ac Merge branch 'blender-v3.4-release' 2022-11-15 12:08:05 -03:00
be40c67b56 Fix T102512: Snapping Option Face Nearest is not working
Caused by misuse of the `GS` macro.

Error in rB8f4e52b7e0dd
2022-11-15 12:07:32 -03:00
23d0b5dcd2 Merge branch 'blender-v3.4-release' 2022-11-15 16:04:35 +01:00
Philipp Oeser
2459a3c9b1 Report messages from override ID template to the UI.
Previously these were only written to the console with no UI feedback
whatsoever. Just a bit nicer to give the user some info that something
went wrong.

See also T102495.

Differential Revision: https://developer.blender.org/D15732
2022-11-15 15:58:56 +01:00
bcb20e9a29 Fix WM_report not printing into console.
Also make it print warnings, not only errors.

Related to D15732.
2022-11-15 15:50:27 +01:00
a859837cde Cleanup: Move OptiX denoiser code from device into denoiser class
Cycles already treats denoising fairly separate in its code, with a
dedicated `Denoiser` base class used to describe denoising
behavior. That class has been fully implemented for OIDN
(`denoiser_oidn.cpp`), but for OptiX was mostly empty
(`denoiser_optix.cpp`) and denoising was instead implemented in
the OptiX device. That meant denoising code was split over various
files and directories, making it a bit awkward to work with. This
patch moves the OptiX denoising implementation into the existing
`OptiXDenoiser` class, so that everything is in one place. There are
no functional changes, code has been mostly moved as-is. To
retain support for potential other denoiser implementations based
on a GPU device in the future, the `DeviceDenoiser` base class was
kept and slightly extended (and its file renamed to
`denoiser_gpu.cpp` to follow similar naming rules as
`path_trace_work_*.cpp`).

Differential Revision: https://developer.blender.org/D16502
2022-11-15 15:50:01 +01:00
4d1a88e374 Fix T102495: Fix UI-invisible warning and failing liboverride creation in IDTemplate in some cases.
Replace `RNA_warning` uage by `WM_report`.

And allow creating liboverrides of linked obdata used by purely local
objects.
2022-11-15 15:48:30 +01:00
a94c3aafe5 Merge branch 'blender-v3.4-release' 2022-11-15 14:53:37 +01:00
0ecf6f2abb Fix (unreported) broken args handling in install_deps.
Issue likely introduced when openpgl lib was added a few months ago.
2022-11-15 14:53:17 +01:00
ff40b90f99 GPU: UniformBuffer: Add possibility to bind as SSBO
This way UBOs can be modified directly in shader just like VBOs and IBOs.
2022-11-15 14:41:38 +01:00
5db84d0ef1 GPU: State: Add GPU_BARRIER_UNIFORM
This allows to synchronise uniform buffer writes from compute shader
when an UBO is bound as SSBO.
2022-11-15 14:41:38 +01:00
f0ce95b7b9 GPU: Enabled Metal test cases.
This commit enabled the metal gpu backend test cases. These test cases
will currently fail, but are by default disabled.
2022-11-15 13:14:05 +01:00
d2728868c0 GPU: Improve Codegen variable names
Include the node name and parameter index in the variable name for easier debugging.
(Enabled for debug builds only)

Reviewed By: fclem, jbakker

Differential Revision: https://developer.blender.org/D16496
2022-11-15 13:06:58 +01:00
191a3bf2ad Merge branch 'blender-v3.4-release' 2022-11-15 13:05:49 +01:00
21eeedfc60 Fix T101562: GPU: Update fmod to match Cycles/OSL behavior
Implementation from:
https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/blob/main/src/include/OSL/dual.h#L1283
https://github.com/OpenImageIO/oiio/blob/master/src/include/OpenImageIO/fmath.h#L1605

Reviewed By: fclem

Maniphest Tasks: T101562

Differential Revision: https://developer.blender.org/D16497
2022-11-15 13:04:47 +01:00
66939d47b1 Merge branch 'blender-v3.4-release' 2022-11-15 12:44:39 +01:00
a968f1b9b3 install_deps: Update openpgl to 0.4.1.
Ref. T101403.
2022-11-15 12:44:21 +01:00
ffa14008ac Cleanup: fix compile error in leak detection utility 2022-11-15 12:41:55 +01:00
84dce9c1fa Merge branch 'blender-v3.4-release' 2022-11-15 12:11:12 +01:00
5c42e54f6e Fix T101536: missing node tree updates after remapping id
The main problem is that the node tree was not properly updated
after a property in the tree changed. More specifically, the collection
pointer in the Collection Info node was cleared, but the node tree
was not updated after that (usually this is handled by rna updates).

Differential Revision: https://developer.blender.org/D16289
2022-11-15 12:10:09 +01:00
1b5ceb9a75 Merge branch 'blender-v3.4-release' 2022-11-15 12:05:11 +01:00
Damien Picard
337dbb1ab0 I18n: fix UI layout operator context extraction
Some operator layout buttons with custom text did not get the proper
context: they'd get * instead of Operator.

This was probably never noticed because the only operator that
actually had this issue was Import Images as Planes in the Add menu.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15993
2022-11-15 12:03:18 +01:00
d95216b94c Merge branch 'blender-v3.4-release' 2022-11-15 11:35:29 +01:00
Damien Picard
9795f2645c I18n: fix description_from_data_path() for property assignment
The property assignment operators' tooltips were never actually
translated when they were constructed dynamically from the description
in the prop's RNA.

This was visible when using such operators in menus (example I found
was the Marker Settings, Shift + E in the Movie Clip Editor).

"%s: %s" is already extracted elsewhere, might as well use it.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D16439
2022-11-15 11:29:07 +01:00
Damien Picard
83c21e01dd I18n: improve keymap translations
- The label for modal keymaps was extracted but did not use the proper
  context on translation.
- Same goes for modal keymap items.
- Extract the UI messages from rna_keymap_ui.py
- Translate global keymap names.
- Use the proper context in the status bar for the tool prompt operator

Ref T102071

Maniphest Tasks: T102071

Differential Revision: https://developer.blender.org/D16348
2022-11-15 11:08:26 +01:00
d46317cf3c Fix T101775: grease pencil keyframe not filtered in dopesheet summary
Grease pencil data keyframes were listed twice in the summary.

First by the generic object data listing,
which did not handle properly grease pencil objects,
and did not account for the grease pencil filter.
Second by the specific grease pencil function.

Now only the second call is made,
and the filter hides keyframes in summary as well.

Reviewed By : Jeroen Bakker, Falk David

Differential Revision: https://developer.blender.org/D16369
2022-11-15 09:49:39 +01:00
7f80b5e675 Animation: rearrange grease pencil channels in the main dopesheet
Operations to rearrange channels in the main dopesheet
did not cover grease pencil layer channels.
Now grease pencil layer channels can be moved up and down
in the main dopesheet just like other channels.

Reviewed By: Sybren A. Stüvel

Differential Revision: https://developer.blender.org/D15542
2022-11-15 09:09:48 +01:00
91215ace72 Merge branch 'blender-v3.4-release' 2022-11-15 08:08:17 +01:00
5be3a68f58 Fix hair/curve drawing artifacts when workarounds are enabled.
Regression introduced by {rB601995c3b86986cf8f8e5b6e5a65bcfa7f8f2e32}.
Noticed by Heist project as they render final frames with workarounds enabled.

The mentioned patch introduces attaching VBO as textures. This used to be
done by the caller. The mechanism used a different order hence the VBO
could still be unbound when using. This cannot be solved inside the new
mechanism clearly so this patch will just bind when the buffer isn't bound
just before the drawing command is sent to the GPU driver.
2022-11-15 08:07:01 +01:00
2a41cd46ba Cleanup: format 2022-11-15 16:43:18 +11:00
f0f97e18c1 Cleanup: quiet unused variable warning 2022-11-15 16:41:50 +11:00
f396ab236a Merge branch 'blender-v3.4-release' 2022-11-15 16:37:56 +11:00
3ff7d0796d GHOST/Wayland: limit the size of the events_pending vector
Avoid keeping allocated overly large events_pending vector in case of
long delays between processing events.

While in practice this isn't likely to cause problems, it's better to
avoid keeping unnecessarily large allocations.

Also remove invalid comment.
2022-11-15 16:36:57 +11:00
be024ee7b7 Merge branch 'blender-v3.4-release' 2022-11-15 15:32:52 +11:00
435c824a5f Merge branch 'blender-v3.4-release' 2022-11-15 15:32:47 +11:00
2205e5f63f Merge branch 'blender-v3.4-release' 2022-11-15 15:32:34 +11:00
37b256e26f Fix T100855: Input while Blender is unresponsive exits under Wayland
Consume events in a thread to prevent Wayland's event buffer from
overflowing Waylands internal buffer and closing the connection.
From a users perspective this seemed like a crash.

Details:

- This is a workaround for a known bug in Wayland [0].
  Threaded event handling has been if-defed so it can be removed when
  it's no longer needed.

- GTK & QT use threaded event handling to avoid this problem
  (SDL on the other hand doesn't).

- The complexity and number of locks needed to handle events in a
  separate thread is a significant down-side, but as far as I can see
  this is necessary.

- Re-connecting to the Wayland server is possible but not practical as
  the OpenGL context is lost and as far as I can tell it's not possible
  to keep it active (see: D16492).

[0]: https://gitlab.freedesktop.org/wayland/wayland/-/issues/159
2022-11-15 15:26:31 +11:00
f1646a4d5e GHOST/Wayland: share logic for xdg/libdecor window configuration
Split frame & frame_pending structs, making window actions simpler
to reason about.
2022-11-15 14:49:44 +11:00
56f783d883 GHOST/Wayland: only use a single swapBuffers for libdecor redrawing
Using a single draw works in my tests and I couldn't reproduce the
issue noted in the comment.

Also apply minor cleanup, assigning a variable before calling methods to
reduce diff-noise in planned changes.
2022-11-15 12:30:54 +11:00
Iliya Katueshenock
efcd587bc2 Geometry Nodes: Image Info Node
This commit adds a new "Image Info" node to retrieve various
information from an image like its width, height, and whether
it has an alpha channel. It is also possible to retrieve the FPS
and frame count of video files.

Differential Revision: https://developer.blender.org/D15042
2022-11-14 18:55:51 -06:00
b64042b482 Merge branch 'blender-v3.4-release' 2022-11-14 18:21:35 -06:00
Mattias Fredriksson
b28348f9e9 Partial Fix T102428: Invertible Bezier curve trim within one segment
Adjusts behavior for trimming Bezier curves, specifically the outer
Bezier handles for the endpoints which do not influence the actual
curve. Handles are only adjusted if they lie within the same segment
with at most one endpoint being a control point (unless they are the
same in which handles are set to the point itself). The result yields
a curve in which the trim result can be inverted by re-setting the
cyclic property for the curve using 'Set Spline Cyclic' node
(iff both trim endpoints lie within a segment).

Differential Revision: https://developer.blender.org/D16488
2022-11-14 18:20:32 -06:00
Laurynas Duburas
18af9da572 Fix: Versioning problem with cyclic bezier NURBS
Patch fixes versioning issue with NURBS files saved with Blender
version from commit 45d038181a to 0602852860 and opened with
Blender version from commit 0602852860. Cyclic Bezier NURBS
saved and then opened with Blender versions mentioned above
changed their shape.

Bug was reported in comments of T101160, circle problem.

Differential Revision: https://developer.blender.org/D16503
2022-11-14 18:04:42 -06:00
d158db475b Merge branch 'blender-v3.4-release' 2022-11-14 17:53:25 -06:00
db94d030bc Fix T102502: Collada import sets incorrect material indices
The weird code dealing with `MeshPrimitive` didn't increment the
material indices pointer for geometry types besides triangle fans.
Also use a proper accessor to avoid adding a duplicate material
indices attribute, just in case this code is used on existing meshes.
2022-11-14 17:53:02 -06:00
e3ee913932 Cleanup: Resolve unused variable warning in draw module 2022-11-14 14:50:10 -06:00
103fe4d1d1 Merge branch 'blender-v3.4-release' 2022-11-14 20:09:02 +01:00
970be7e65a Fix T100491: Mouse selection is inaccurate in NLA Editor
Selection range is +/-7 pixels to actual clicked position, but strip selection
was biased towards rightmost strip.

To make selection more intuitive, select closest strip to clicked position, and
stop iterating when strip intersects clicked pixel.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D15728
2022-11-14 19:57:42 +01:00
6873aabf93 Cleanup: BVH utils: Remove print, use spans instead of pointers 2022-11-14 11:59:40 -06:00
edae67c036 Cycles: Enable MetalRT pointclouds & other fixes
Cherrypicking D16499 into blender-v3.4-release
2022-11-14 16:51:48 +00:00
b0e2e45496 Cycles: Enable MetalRT pointclouds & other fixes
Code authored by Marco Giordano.

This fixes pointcloud rendering on MetalRT and some other subtle MetalRT bugs:
- Incorrect kernel hashing
- Missing specialisation constants
- Incorrect visibility filtering
- Missing null pointer check

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16499
2022-11-14 16:39:18 +00:00
377da3f949 Python API: add Image.save() optional parameters quality and filepath
To override the default quality and filepath. After changes to unify the image
operator and this method, the quality changed from 75 to 90 to make both
consistent. However there was no way to lower the quality to match the previous
behavior, this adds support for that.

Ref T102421
2022-11-14 17:14:11 +01:00
5f4afecbf3 Fix T102421: Image.save() not respecting set image.file_format
The default file type for new ImBuf is already PNG, no need to override it
again in the save method.
2022-11-14 17:14:11 +01:00
85bbcb32eb Merge branch 'blender-v3.4-release' 2022-11-14 16:46:01 +01:00
99d00a7489 Usual minor fixes to UI messages & i18m utils module. 2022-11-14 16:44:10 +01:00
276d7f7c19 Mesh: Avoid calculating normals when building BVH tree
Though they are sometimes used by users of the BVH tree, mostly
vertex normals when building the BVH tree is unnecessary. Skip it
instead and avoid storing the vertex normals in the BVH tree cache.
They are just calculated in the few places they are actually needed.
This should save at least a few percent of the runtime in some cases
where the normals weren't needed otherwise.
2022-11-14 07:56:53 -06:00
cc12d2a5a0 Cleanup: Reduce indentation and variable scope in BVH utils 2022-11-14 07:56:53 -06:00
1aaf4ce0a4 Cleanup: Use C++ BitVector instead of BLI_bitmap for BVH utils
This gives a friendlier interface, an inline buffer, RAII, etc.
Also switch some BMesh functions that were only used by the snap
system's use of BVH utils.
2022-11-14 07:56:53 -06:00
6192695a94 Cleanup: Allow using C++ features in BMesh header functions
Generally the `extern "C" {` brackets shouldn't be added around other
headers since it causes problems when using C++ features in them.
Follow that convention for the "bmesh.h" header.
2022-11-14 07:56:53 -06:00
28dc3b0b84 Cleanup: Move bmesh_iterators.c to C++ 2022-11-14 07:56:53 -06:00
37f50ffdbc Cleanup: Braces around initialization warning
There is no need to initialize the bounding box as it is fully
initialized by the BKE_boundbox_init_from_minmax().
2022-11-14 14:43:41 +01:00
Ejner Fergo
b557e4317d Gizmo toggle for Movie Clip Editor
This patch adds a "Show Gizmo" toggle to the Movie Clip Editor header, for consistency with other editors.

{F13892765}

Differential Revision: https://developer.blender.org/D16437
2022-11-14 14:35:32 +01:00
Mikhail Matrosov
857bb1b5ec Cycles: improve adaptive sampling for overexposed scenes
Render time is reduced for overexposed scenes, by taking into account absolute
light intensity for adaptive sampling.

This can negatively affect some scenes where compositing or color management
are used to make the scene much darker or lighter. For best results adjust the
Film > Exposure setting to bring the intensity into a good range, and then do
further compositing and color management on top of that. Note that this setting
is different than color management exposure.

Previously Cycles' adaptive sampling used sqrt(I) to normalize noise level to
conform to a viewer's eye sensitivity. It is great for darker regions of the
image, but also requests too much samples in bright regions, sometimes several
times more than needed. Highlights can tolerate more noise because in most
examples it is still less noticeable then the noise in darker areas in the same
render.

Differential Revision: https://developer.blender.org/D16392
2022-11-14 14:14:31 +01:00
d7f1430f11 Merge branch 'blender-v3.4-release' 2022-11-14 14:04:13 +01:00
Colin Basnett
4dd19a1ad6 UI: disable curve map & profile zoom buttons at max/min zoom level
Disable the zoom in and out buttons on the when they would have no effect.

This also removes an incorrect comment that indicates the maximum zoom level
was 20x when in fact it was 25x.

Differential Revision: https://developer.blender.org/D16252
2022-11-14 14:03:50 +01:00
4f5f8622f9 Fix image datablock losing movie metadata on undo
The anims data is a runtime cache similar to the image buffer or GPU texture
and needs to be preserved through undo in the same way.

Found as part of D15042 development.
2022-11-14 14:03:06 +01:00
187bce103b DRW: Fix compilation issues in inline functions 2022-11-14 14:01:23 +01:00
0fe21fe7b9 Merge branch 'blender-v3.4-release' 2022-11-14 13:20:21 +01:00
Iliya Katueshenock
8447ab606e Fix: incorrect field dependencies in the raycast node
This does not change the result when evaluating the node.

Differential Revision: https://developer.blender.org/D16325
2022-11-14 13:18:17 +01:00
ea2dda306c Asset system: New asset system code module (with files from BKE)
Adds a new `source/blender/asset_system` directory and moves asset
related files from BKE to it. More asset related code can follow
(e.g. asset indexing, ED_assetlist stuff) but needs further work to
untangle it. I also kept `BKE_asset.h` and `asset.cc` as is, since they
deal with asset DNA data mostly, thus make sense in BKE.

Motivation:
- Makes the asset system design more present (term wasn't even used in
  code before).
- An `asset_system` directory is quite descriptive (trivial to identify
  core asset system features) and makes it easy to find asset code.
- Asset system is mostly runtime data, with little relation to other
  `Main`/BKE/DNA types.
- There's a lot of stuff in BKE already. It shouldn't be just a dump for
  all stuff that seems core enough.
- Being its own directly helps us be more mindful about encapsulating
  the module well, and avoiding dependencies on other modules.
- We can be more free with splitting files here than in BKE.
- In future there might be an asset system BPY module, which would then
  map quite nicely to the `asset_system` directory.

Checked with some other core devs, consensus seems that this makes
sense.
2022-11-14 12:46:34 +01:00
6a96edce2e Merge branch 'blender-v3.4-release' 2022-11-14 12:24:45 +01:00
a84c92fc73 Fix T98989: Performance regression when using multiple bump nodes
Ensure each graph material_function only evaluates the input links that are connected to it.

Differential Revision: https://developer.blender.org/D16425
2022-11-14 12:21:37 +01:00
bfb6ea898b DRW: View: Add base for multi-view support
This implements the base needed for supporting multiple view concurently
inside the same drawcall.

The view used by common macros and view related functions is indexed using
a global variable `drw_view_id` which can be set arbitrarly or read
from the `drw_ResourceID`.

This is needed for EEVEE-Next shadow but can be used for other purpose
in the future.

Note that a shader specialization is needed for it to work. `DRW_VIEW_LEN`
needs to be defined to the amount of view the shader will access.

The number of views contained in a `draw::View` is set at construction
time.

Note that the maximum number of object correctly drawn by the shaders
using multiple views will be lower than thoses who don't.
2022-11-14 11:17:38 +01:00
ab3fcd62cc Cleanup: DRW: Remove two clang-tidy warnings 2022-11-14 11:17:38 +01:00
5fe146e505 Cleanup: Move mesh_remap.c to C++
To facilitate further mesh data structure refactoring.
2022-11-13 20:27:37 -06:00
0190b104c8 GHOST/Wayland: fix building when GHOST_OPENGL_ALPHA is defined 2022-11-14 12:01:26 +11:00
909f47e0e1 UV: fix crash with uv copy on empty selection
Introduced in 721fc9c1c9
2022-11-14 13:37:12 +13:00
e0cb3e0a39 Merge branch 'blender-v3.4-release' 2022-11-14 10:38:01 +11:00
b8d1022dff Merge branch 'blender-v3.4-release' 2022-11-14 10:37:57 +11:00
d7971972fa GHOST/Wayland: call exit() when Wayland has a fatal error
Without this, a fatal error simply floods the stderr with the same
message without exiting.

Also add note on why reconnecting to the display server isn't practical.
2022-11-14 10:37:08 +11:00
fe6114aaf5 GHOST/Wayland: remove display listener (was warning on startup)
This already has a default listener which uses waylands logging.
2022-11-14 10:12:34 +11:00
dc513a0af8 Cleanup: Disable mesh normal debug time printing
Left enabled mistakenly by d63ada602d.
2022-11-13 14:19:20 -06:00
3eb2bc2c3f Cleanup: Move lineart_cpu.c to C++
To enable further mesh data structure refactoring-- access to loose
edges in particular.
2022-11-13 14:16:24 -06:00
fba7461e1a UV: fix compile on windows
Remove VLAs for compiling on windows.
Regression from 721fc9c1c9
2022-11-14 08:22:36 +13:00
d17f5bcd8f Fix T95335 Bevel operator Loop Slide overshoot.
If the edge you are going to slide along is very close to in line
with the adjacent beveled edge, then there will be sharp overshoots.
There is an epsilon comparison to just abandon loop slide if this
situation is happening. That epsilon used to be 0.25 radians, but
bug T86768 complained that that value was too high, so it was changed
to .0001 radians (5 millidegrees). Now this current bug shows that
that was too aggressively small, so this change ups it by a factor
of 10, to .001 radians (5 centidegrees). All previous bug reports
remained fixed.
2022-11-13 14:09:27 -05:00
7419e291e8 Merge branch 'blender-v3.4-release' 2022-11-13 22:54:38 +05:30
b927cc9ba6 Fix T102187: Add knife tool in mesh panel
Add knife tool option in mesh panel

Reviewer: campbellbarton, JulienKaspar

Differential Revision: https://developer.blender.org/D16395
2022-11-13 22:48:24 +05:30
ce9fcb15a3 DRW: Manager: Fix ClearMulti breaking compilation on Mac
The error was:
`draw_pass.hh:1055:16: error: call to implicitly-deleted default constructor of 'blender::draw::command::Undetermined [3]'
2022-11-13 18:02:17 +01:00
bd622aef3c BLI: Fix ListBaseWrapper::get wrong return type 2022-11-13 16:48:30 +01:00
c255be2d02 DRW: Manager: Add bind_texture command for vertex buffer
This allows the same behavior as with `DRW_shgroup_buffer_texture`.
2022-11-13 16:47:43 +01:00
cd64615425 DRW: Manager: Add ClearMulti command
Allows to record `GPU_framebuffer_multi_clear` inside `draw::Pass`.
2022-11-13 16:23:22 +01:00
930d14cc62 DRW: Manager: Finish / change implementation of framebuffer_set command
Use reference instead of direct pointer. This is because framebuffers
often use temp textures and are configured later just before submission.
2022-11-13 16:16:26 +01:00
f1466ce9a8 DRW: Wrappers: Allow taking reference of the framebuffer object
This is in order to make it work with the new `framebuffer_set` command
which requires a `GPUFrameBuffer **`.
2022-11-13 16:02:57 +01:00
0e4bdd428c DRW: Wrappers: Allow trivial types inside draw::SwapChain
This allows to use pointers and such other trivial types which cannot
implement the `swap` mehod.
2022-11-13 16:00:58 +01:00
67dfb61700 DRW: Wrappers: Avoid default vector length of 0 if sizeof(T) is large
This increases the default size to some reasonable value (>512bytes) and
allocate at least 1 element.
2022-11-13 15:59:23 +01:00
d0f05ba915 Cleanup: fix compiler error/warnings 2022-11-13 11:29:04 +01:00
721fc9c1c9 UV: implement copy and paste for uv
Implement a new topology-based copy and paste solution for UVs.

Usage notes:

* Open the UV Editor

* Use the selection tools to select a Quad joined to a Triangle joined to another Quad.
* From the menu, choose UV > UV Copy
 * The UV co-ordinates for your quad<=>tri<=>quad are now stored internally

* Use the selection tools to select a different Quad joined to a Triangle joined to a Quad.
* (Optional) From the menu, choose UV > Split > Selection

* From the menu, choose UV > UV Paste
 * The UV co-ordinates for the new selection will be moved to match the stored UVs.

Repeat selection / UV Paste steps as many times as desired.
For performance considerations, see https://en.wikipedia.org/wiki/Graph_isomorphism_problem

In theory, UV Copy and Paste should work with all UV selection modes.
Please report any problems.

A copy has been made of the Graph Isomorphism code from https://github.com/stefanoquer/graphISO
Copyright (c) 2019 Stefano Quer stefano.quer@polito.it GPL v3 or later.

Additional integration code Copyright (c) 2022 by Blender Foundation, GPL v2 or later.

Maniphest Tasks: T77911
Differential Revision: https://developer.blender.org/D16278
2022-11-13 12:48:17 +13:00
533c396898 Merge remote-tracking branch 'origin/blender-v3.4-release' 2022-11-12 13:32:26 -07:00
1b34da5da6 Fix: OpenSubdiv reporting version 0.0.0 in system_info.txt
OSD Lists as 0, 0, 0 this is due to opensubdiv_capi.cc not actually including
the OSD version header, so it's not getting the version define, and the code
in openSubdiv_getVersionHex is really well prepared to deal with any or no
version at all of OSD, catches the problem and returns 0, 0, 0

Given this file is only build when OSD is enabled we can just blindly include
opensubdiv/version.h here

Reviewed by: brecht
Differential Revision: https://developer.blender.org/D16398
2022-11-12 13:31:55 -07:00
115cf5ef98 Cleanup: Move cloth.c to C++
To support further mesh data structure refactoring.
2022-11-12 12:14:09 -06:00
a6c822733a BLI: improve CPPType system
* Support bidirectional type lookups. E.g. finding the base type of a
  field was supported, but not the other way around. This also removes
  the todo in `get_vector_type`. To achieve this, types have to be
  registered up-front.
* Separate `CPPType` from other "type traits". For example, previously
  `ValueOrFieldCPPType` adds additional behavior on top of `CPPType`.
  Previously, it was a subclass, now it just contains a reference to the
  `CPPType` it corresponds to. This follows the composition-over-inheritance
  idea. This makes it easier to have self-contained "type traits" without
  having to put everything into `CPPType`.

Differential Revision: https://developer.blender.org/D16479
2022-11-12 18:33:31 +01:00
a145b96396 Merge branch 'blender-v3.4-release' 2022-11-12 16:51:53 +01:00
ed852c8401 Fix: Curves sculptmode: deduplicate checks for being in mode
rBa8f7d41d3898 added a "duplicate" check for being in curves sculptmode
unnecessarily afaict (`in_sculpt_curve_mode` in addition to the
previously existing `in_curves_sculpt_mode`).
Over time, the later evolved to also take into account the output of a
viewer node, see rBc55d38f00b8c (the previously existing
`in_curves_sculpt_mode` did not receive this).

This all results in the fact that selection is not drawn with a viewer
node (can be useful though, and there are separate opacity controls for
both selection and the viewer attribute, so these can be used/blended to
everyones liking).

So now deduplicate the check.

Differential Revision: https://developer.blender.org/D16467
2022-11-12 16:50:23 +01:00
Iliya Katueshenock
99fe17f52d BLI: use templates for disjoint set data structure
Differential Revision: https://developer.blender.org/D16472
2022-11-12 14:26:47 +01:00
db25e64f6a Merge branch 'blender-v3.4-release' 2022-11-12 14:23:32 +01:00
Iliya Katueshenock
f8d968a13c Fix: missing tooltip for color sockets
Differential Revision: https://developer.blender.org/D16401
2022-11-12 14:22:36 +01:00
Iliya Katueshenock
b5e82ff93d Cleanup: remove unused variable
Differential Revision: https://developer.blender.org/D16350
2022-11-12 14:20:19 +01:00
5a37724455 Merge branch 'blender-v3.4-release' 2022-11-12 14:19:32 +01:00
Iliya Katueshenock
fc544bc974 Fix: geometry nodes viewer shows black with dangling reroute input
Differential Revision: https://developer.blender.org/D16322
2022-11-12 14:18:29 +01:00
Iliya Katueshenock
3534c2b4ad Cleanup: make GArray declarations more explicit
Differential Revision: https://developer.blender.org/D16064
2022-11-12 14:14:42 +01:00
0fc27536fb Merge branch 'blender-v3.4-release' 2022-11-12 19:52:11 +11:00
a582abd923 Cleanup: add a system reference to the wayland window
Avoid relying on GHOST_ISystem::getSystem(), store the system instead.
2022-11-12 17:35:17 +11:00
4737f9cff2 Merge branch 'blender-v3.4-release' 2022-11-12 17:10:42 +11:00
935d6a965a Merge branch 'blender-v3.4-release' 2022-11-12 17:10:39 +11:00
b973e27327 Merge branch 'blender-v3.4-release' 2022-11-12 17:10:36 +11:00
cd659f7bbf Merge branch 'blender-v3.4-release' 2022-11-12 17:10:32 +11:00
41137eb7a5 Merge branch 'blender-v3.4-release' 2022-11-12 17:10:29 +11:00
e87b99d7f3 Merge branch 'blender-v3.4-release' 2022-11-12 17:10:25 +11:00
fcfa9ac219 Merge branch 'blender-v3.4-release' 2022-11-12 17:10:21 +11:00
436e6dca24 Fix window title not redrawing with Wayland/libdecor 2022-11-12 17:06:58 +11:00
bc3f5c7e14 GHOST/Wayland: skip resizing the EGL surface unnecessarily
wl_egl_window_resize ran when the window became active/inactive for e.g.
2022-11-12 16:38:51 +11:00
1a8516163f Cleanup: Simplify handling of loop to poly map in normal calculation
A Loop to poly map was passed as an optional output to the loop normal
calculation. That meant it was often recalculated more than necessary.
Instead, treat it as an optional argument. This also helps relieve
unnecessary responsibilities from the already-complicated loop normal
calculation code.
2022-11-11 23:27:36 -06:00
d63ada602d Cleanup: Use simpler timers for mesh normals debug timing 2022-11-11 23:26:56 -06:00
787ae01dad Cleanup: move title into GWL_Window
Nearly all Wayland window data is stored in this struct,
follow this convention so GWL_Window functions can be self contained.
2022-11-12 16:26:53 +11:00
19ba229391 Cleanup: move Wayland window state utilities into lower level functions
Add low level gwl_window_* functions.
2022-11-12 16:26:51 +11:00
2a17fd40a5 Fix non-interactive window borders after changes to event handling
Regression in [0] causes LIBDECOR interactions not to be detected.

[0]: deb8ae6bd1
2022-11-12 16:26:50 +11:00
7c519aa5d8 Cleanup: Make loop normal calculation function static 2022-11-11 23:26:49 -06:00
7931ae0df3 Cleanup: use snake-case for WAYLAND utility functions
It wasn't so obvious which functions were part of the GHOST API
and which system functions were utilities.

This convention was already in place but not always followed.
2022-11-12 15:25:51 +11:00
deb8ae6bd1 GHOST/Wayland: replace roundtrip with dispatch_pending
Add a non-blocking version wrapper for wl_display_dispatch_pending.
This uses roughly the same logic as Wayland_PumpEvents in SDL.
Noticed this when investigating T100855.

Note that performing a round-trip doesn't seem necessary from looking
into QT/GTK & SDL event handling loops.
2022-11-12 15:11:43 +11:00
78bfb74743 Cleanup: Decrease variable scope in mesh loop normal calculation 2022-11-11 21:56:17 -06:00
d9e5a3e6ad Cleanup: Use spans for loop normal calculation input data 2022-11-11 21:49:43 -06:00
d0522d4ef1 Cleanup: Remove unnecessary struct keywords 2022-11-11 19:05:22 -06:00
03ccf37162 Cleanup: Rename curves sculpt selection variable
It's a bit simpler to skip the "indices" in the name, that can be
assumed from the type.
2022-11-11 15:32:51 -06:00
5465aa63d5 Merge branch 'blender-v3.4-release' 2022-11-11 13:49:55 -07:00
c5b36aa940 tests: Disable lattice_deform_performance test
This test is disabled for the following reasons:

This test is one of the longer ones in this suite (2979 out of 3559ms total)
and nothing is currently monitoring the performance, if this test were to be
20% slower one day, no-one would actually notice.

there are no asserts, the test actually cannot fail.

it's good to have some benchmark code, so like some of the other mesh
benchmark code, exclude it using an `#ifdef` guard so i can be easily
re-enabled when needed.

reviewed by: jbakker
Differential Revision: https://developer.blender.org/D16314
2022-11-11 13:49:12 -07:00
9d827a1834 Fix OSL object matrix with Cycles on the GPU
The OSL GPU services implementation of "osl_get_matrix" and
"osl_get_inverse_matrix" was missing support for the "common",
"shader" and "object" matrices and thus any matrix operations in OSL
shaders using these would not work. This patch adds the proper
implementation copied from the OSL CPU services.

Maniphest Tasks: T101222
2022-11-11 20:21:08 +01:00
1fdaf748bf Add poll messages for marker operators
A number of operators were missing poll messages when disabled.

These are the following new error messages:

1. "No markers are selected"
2. "Markers are locked"

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D16403
2022-11-11 11:13:24 -08:00
5671e7a92c Cleanup: Fixing anti-patterns in fcurve.c
This is a clean-up pass that eliminates a few problematic patterns:

* Eliminating redundant parentheses around simple expressions.
* Combing declaration and assignment of variables where appropriate.
* Moving variable declarations closer to their first use.
* Many variables and arguments have been marked as `const`.
* Using `LISTBASE_FOREACH_*` variants where applicable instead of
  manually managing loop control flow.

There are no functional changes.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D16459
2022-11-11 11:07:30 -08:00
abbbf9f002 Merge branch 'blender-v3.4-release' 2022-11-11 12:41:04 -06:00
864af51d6a Fix: Failing instance visibility test after recent commit
The "visibility_instances.blend" cycles test was failing..
The stack of dupli generator types added in e508de0417
wasn't "popped" correctly after recursive duplis were generated.
2022-11-11 12:32:18 -06:00
Michael Jones
2c596319a4 Cycles: Cache only up to 5 kernels of each type on Metal
This patch adapts D14754 for the Metal backend. Kernels of the same type are already organised into subdirectories which simplifies type matching.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16469
2022-11-11 18:10:29 +00:00
6f6a0185f2 Merge branch 'blender-v3.4-release' 2022-11-11 19:05:44 +01:00
ba2072524b Fix CMake error when pkg-config is not installed
Don't assume xxx_FOUND variables are defined.
2022-11-11 18:22:51 +01:00
Hallam Roberts
8799ab201d Fix T96481: make color picker RGB display consistent
Show RGB value "1.000" instead of "1", jus like HSV mode. Also uses full labels
"Red", "Green" and "Blue" rather than the shortened labels "R", "G" and "B",
for both RGB and HSV.

Differential Revision: https://developer.blender.org/D14387
2022-11-11 18:22:51 +01:00
097a13f5be Fix broken Cycles rendering with recent OSL versions
Commit c8dd33f5a37b6a6db0b6950d24f9a7cff5ceb799 in OSL
changed behavior of shader parameters that reference each other
and are also overwritten with an instance value.
This is causing the "NormalIn" parameter of a few OSL nodes in
Cycles to be set to zero somehow, which should instead have
received the value from a "node_geometry" node Cycles generates
and connects automatically. I am not entirely sure why that is
happening, but these parameters are superfluous anyway, since
OSL already provides the necessary data in the global variable "N".
So this patch simply removes those parameters (which mimics
SVM, where these parameters do not exist either), which also
fixes the rendering artifacts that occured with recent OSL.

Maniphest Tasks: T101222

Differential Revision: https://developer.blender.org/D16470
2022-11-11 17:10:30 +01:00
dc8a1d38b7 Merge branch 'blender-v3.4-release' 2022-11-11 09:09:28 -06:00
ff7645c5ed Fix T102404: Behavior change in CustomData API
Previously the `CustomData_add_layer` function always returned
the existing layer data when used for types that can only have one
layer. This made it work like an "ensure layer exists" function for those
types. That was used in various places to make code more concise.

0a7308a0f1 changed that to always "recreate" the layer even
when it existed. Maybe this is more logical for an "add layer" function,
but that's not clear, and it breaks a bunch of existing code that relied
on the current behavior. Rather than spending a bunch of time going
through uses of the CustomData API, this patch resets the behavior
to what it was before, but adds an assert and a comment to help
avoid memory leaks and other issues. We should focus on moving
to the attribute API instead.

Differential Revision: https://developer.blender.org/D16458
2022-11-11 09:07:54 -06:00
e508de0417 Fix T100706: Object instances with different geometry type invisible
Code in `deg_object_hide_original` uses the dupli object type to decide
whether to hide the original object. The geometry component system
changed the dupli object generator types, which made this not work.
To maintain existing behavior, maintain a stack of non-geometry-nodes
generator types while building the dupli list, and assign that to the
dupli object instead.

I think this code is on its last legs. It can't handle too many more
hacky fixes like this, and should be replaced soon. Hopefully that is
possible by using a `bke::Instances` type instead. However, this
bug is bad enough that it's worth fixing like this.

Differential Revisions: https://developer.blender.org/D16460
2022-11-11 09:06:50 -06:00
a304dfdb69 Cleanup: Improve curves sculpt code section names 2022-11-11 08:50:28 -06:00
111974234c Addons submodule version bump
(Previous attempt was accidentally 4 days outdated)
2022-11-11 15:10:30 +01:00
80f5a5a8aa Fix T101270: Object Info > Random not unique for nested instances and curves
This random number is intended to be unique for every instance, however for
some cases with more than one level of nesting this was failing. This also
affected curves after they were refactored to use geometry sets.

For simple cases the random number is the same as before, however for more
complex nesting it will be different than before, changing the render result.
2022-11-11 14:45:01 +01:00
fe2be36510 Merge branch 'blender-v3.4-release' 2022-11-11 13:27:27 +01:00
38430c384a Fix: Curves sculptmode: paintcurve stroke points cannot be transformed
As part of rB3f91540cef7e, we already made `OB_MODE_SCULPT_CURVES` to be
allowed in `paint_curve_poll` (alongside `OB_MODE_ALL_PAINT`).
Now, to get the paintcurves transform systems to work with curves
sculptmode as well, we introduce this "additional case" in the
appropriate place in the transform system as well.

NOTE: as a next step, considering `OB_MODE_SCULPT_CURVES` to be
generally part of `OB_MODE_ALL_PAINT` is to be done (this might fix
another couple of bugs, but also has to be carefully checked in many
places, so this patch is just fixing this very specific case)

Fixes T102204.

Maniphest Tasks: T102204

Differential Revision: https://developer.blender.org/D16466
2022-11-11 13:24:52 +01:00
5f35e7f12a Addons submodule version bump 2022-11-11 12:48:14 +01:00
a3877d8fe4 Merge branch 'blender-v3.4-release' 2022-11-11 11:49:54 +01:00
57dd1b7799 Fix T102386: crash when trying to link sockets from different node trees
This was caused by rBc39eb09ae587e1d9. The optimization broke the case
when the socket is not in the provided node tree. Now there are two separate
functions, one that always does the slow check to see of the socket is really
in the node tree and a potentially much faster version when we are sure
that the socket is in the tree.
2022-11-11 11:48:56 +01:00
824d5984aa Merge branch 'blender-v3.4-release' 2022-11-11 10:10:15 +01:00
84c66fe9db Fix T102406: OSL script node no longer updates its in and outputs
This special case was missing in rB52bd198153ede3c7131df.
2022-11-11 10:08:49 +01:00
6f1b5e1081 Merge branch 'blender-v3.4-release' 2022-11-11 08:48:43 +01:00
88c956c13b Fix T100969: Memory leak GPU subdivision during rendering.
The viewport cleans up old subdivision buffers right after drawing.
During rendering this was not done and when rendering many frames
this lead to memory issues.

This patch will also clear up the GPU Subdivision buffers after any
offscreen render or final render. There is already a mutex so this
is safe to be done from a non main thread.

Thanks to @kevindietrich to finding the root cause.
2022-11-11 08:47:58 +01:00
c967aab4ef Cleanup: Remove unused navigation widget struct members
The `region_size[2]` was set to -1 but was never accessed.
2022-11-10 22:38:38 -05:00
ca1642cd0c Cleanup: Use string argument for attribute API function
Instead of CustomDataLayer, which exposes the internal implementation
more than necessary, and requires that the layer is always available,
which isn't always true.
2022-11-10 15:29:21 -06:00
34f4646786 Cleanup: Clarify and deduplicate attribute convert implementation
The ED level function is used for more code paths now, and it has been
cleaned up. Handling of the active attribute is slightly improved too.
2022-11-10 15:29:21 -06:00
Ramil Roosileht
9800312590 Mesh: Convert color attribute operator
Implements an operator to convert color attributes in
available domains and types, as described in T97106.

Differential Revision: https://developer.blender.org/D15596
2022-11-10 15:29:21 -06:00
f613c504c4 Merge branch 'blender-v3.4-release' 2022-11-10 11:52:04 -08:00
b2000412f2 Sculpt: Fix T102209: Multiresolution levels greater than 6 crashes
pbvh->leaf_limit needs to be at least 4 to split nodes
original face boundaries properly.
2022-11-10 11:49:39 -08:00
3c089c0a88 Sculpt: Fix T102209: Multiresolution levels greater than 6 crashes
pbvh->leaf_limit needs to be at least 4 to split nodes
original face boundaries properly.
2022-11-10 11:30:04 -08:00
Edward
59618c7646 Sculpt: Fix T101914: Wpaint gradient tool doesn't work with vertex mask
Reviewed by: Julian Kaspar & Joseph Eagar
Differential Revision: https://developer.blender.org/D16293
Ref D16293
2022-11-10 11:03:59 -08:00
366796bbbe Merge branch 'blender-v3.4-release' 2022-11-10 19:59:47 +01:00
cad11f3098 GPencil: Add warning to Outline modifer when no Camera
The modifier needs a scene camera to work. Now
if the camera is not defined, there is a warning.

The optimal solution would be to use the `isDisabled` callback
but the callback function hasn't the scene parameter and to pass
this parameter is necessary to change a lot of things and now
we are focus in the next version of GPencil 3.0 and this change 
not worth the work now.

The optimal solution will be implemented in the 3.0 refactor.

Related to T102375

Reviewed by: Pablo Vazquez, Matias Mendiola
2022-11-10 19:59:23 +01:00
969aa7bbfc Sculpt: Change symmetrize merge threshold and expose in workspace panel
The sculpt symmetrize operator's merge threshold now defaults
to 0.0005 instead of 0.001, which tends to be a bit too big for
metric scale.

Also changed its step and precision a bit to be more usable.
2022-11-10 10:55:09 -08:00
Julien Kaspar
659de90a32 Sculpt: Rename Show/Hide operators for consistency
This is a minor naming update to make the box hide and show operators in sculpt mode follow current naming conventions.

Reviewed by: Joseph Eagar
Differential Revision: https://developer.blender.org/D16413
Ref D16413
2022-11-10 10:47:08 -08:00
cc2b5959bb Sculpt: Fix inconsistent naming for cavity_from_mask operator
With db40b62252 there have been various UI adjustments and improved renaming.
The Mask From Cavity menu operator didn't follow this new naming yet.

Reviewed By: Joseph Eagar
Differential Revision: https://developer.blender.org/D16409
Ref D16409
2022-11-10 10:40:54 -08:00
6a8ce5ec1c Fix abort when rendering with OSL and OptiX in Cycles
LLVM could kill the process during OSL PTX code generation, due
to generated symbols contained invalid characters in their name.
Those names are generated by Cycles and were not properly filtered:

- If the locale was set to something other than the minimal locale
  (when Blender was built with WITH_INTERNATIONAL), pointers
  may be printed with grouping characters, like commas or dots,
  added to them.
- Material names from Blender may contain the full range of UTF8
  characters.

This fixes those cases by forcing the locale used in the symbol name
generation to the minimal locale and using the material name hash
instead of the actual material name string.
2022-11-10 19:31:59 +01:00
2688d7200a Sculpt: Fix T102379: Crash in dyntopo 2022-11-10 10:28:10 -08:00
a5b2a3041f Fix const-correctness for a number of F-Curve functions
Reviewed By: sybren

Differential Revision: https://developer.blender.org/D16445
2022-11-10 10:22:03 -08:00
df9ab1c922 Merge branch 'blender-v3.4-release' 2022-11-10 18:07:34 +01:00
d3121fe4ec Fix T100654: Distortion node freezes on empty input
Perform an early output when the input is empty, avoiding division by
zero and attempt to run LM solver on an inf values.
2022-11-10 18:01:04 +01:00
acaa736037 Fix: GPU: Set the last enum in ENUM_OPERATORS 2022-11-10 17:43:53 +01:00
04eab3fd39 Merge branch 'blender-v3.4-release' 2022-11-10 16:18:16 +01:00
02c23e1613 Cleanup: Fix strict compiler warning 2022-11-10 16:17:58 +01:00
e7a3454f5f Cleanup: Fix strict compiler warning 2022-11-10 16:11:02 +01:00
b85fe57887 Merge branch 'blender-v3.4-release' 2022-11-10 15:54:16 +01:00
6295bdfd38 Fix T102340: crash when adding image file in node group
The crash happened because the geometry nodes modifier is evaluated
before the node tree has been preprocessed. While there was a transitive
but non-flushing relation between these two depsgraph nodes.

However the relation between the modifier and the `ntree_output` depsgraph
node was ignored, because it had `DEPSOP_FLAG_NEEDS_UPDATE` *not* set
(which is actually correct, because not all node tree changes change its output).
Because this relation is ignored (e.g. in `calculate_pending_parents_for_node`)
the transitive relation is ignored as well.

The solution in this patch is to explicitly add this transitive non-flushing relation
to make sure the modifier only runs after the node tree has been preprocessed,
even when the node tree output has not changed. An alternative fix could be
to handle all links always but skip the execution of depsgraph nodes that are not
needed. This way all links are always taken into account. This solution would
require some deeper changes though and would be much more risky.

Also fixes T102402.
2022-11-10 15:50:46 +01:00
598bb9065c Cleanup: Move sculpt.c to C++ 2022-11-10 07:40:41 -06:00
55e86f94a0 EEVEE Next: Fix wrong DoF when a non-camera object is the active camera
Related to T101533.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D16412
2022-11-10 13:01:06 +01:00
bc672e76eb Merge branch 'blender-v3.4-release' 2022-11-10 12:41:57 +01:00
6e2437d82b Fix missing wl_display_get_error in the Wayland dynamic loader
Some of the previous commits in Wayland related code added use
of this function, but did not update the dynamic loader. This
broke compilation of configurations which use dynamic loader
for Wayland (which is the official way oh how Blender is built).
2022-11-10 12:40:23 +01:00
a4668ecf17 Merge branch 'blender-v3.4-release' 2022-11-10 12:39:01 +01:00
e4f484330a Fix strict compiler warnings 2022-11-10 12:34:46 +01:00
Jason Schleifer
0b4bd3ddc0 NLA: Update context menu to include meta strip operators
The meta strip operator is available in the Add menu, but not in the
context menu.

This patch adds these two operators to the context menu:
* nla.meta_add
* nla.meta_remove

Reviewed By: sybren, RiggingDojo

Differential Revision: https://developer.blender.org/D16353
2022-11-10 12:07:29 +01:00
8ef092d2d8 Fix T102151: Output nodes don't work inside node groups
Using output nodes inside node groups in compositor node trees doesn't
work for the realtime compositor.

Currently, the realtime compositor only considers top level output
nodes. That means if a user edits a node group and adds an output node
in the group, the output node outside of the node group will still be
used, which breaks the temporary viewers workflow where users debug
results inside a node group.

This patch fixes that by first considering the output nodes in the
active context, then consider the root context as a fallback. This is
mostly consistent with the CPU compositor, but the realtime compositor
allow viewing node group output nodes even if no output nodes exist at
the top level context.

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

Reviewed By: Clement Foucault
2022-11-10 13:02:15 +02:00
ec1ab6310a Merge branch 'blender-v3.4-release' 2022-11-10 11:05:32 +01:00
3153bd0f5d SVG: Add more sophisticated test suit
This test suit tests SVG on a big files, as opposite of testing one
specific aspect of the standard by atomic files.
2022-11-10 11:04:30 +01:00
2a6a492a82 GHOST/Wayland: report a message when there is a fatal error
Help troubleshooting T100855.
2022-11-10 16:51:44 +11:00
4b6d58fd6d Cleanup: minor naming changes, make listener struct const 2022-11-10 16:47:55 +11:00
baabac5909 Merge branch 'blender-v3.4-release' 2022-11-10 11:34:43 +11:00
8140f7f574 Cleanup: spelling in comments 2022-11-10 11:34:10 +11:00
7d606ad3b8 Merge branch 'blender-v3.4-release' 2022-11-10 11:22:08 +11:00
1bf3069912 Merge branch 'blender-v3.4-release' 2022-11-10 11:22:02 +11:00
9b646cfae5 Merge branch 'blender-v3.4-release' 2022-11-10 11:21:18 +11:00
2630fdb787 Cleanup: format 2022-11-10 11:17:16 +11:00
7e4e8cca7d GHOST/Wayland: add wl_display_listener for debugging
Currently only used for logging to help with debugging.
2022-11-10 11:12:52 +11:00
79dae1a43f Cleanup: compiler warnings (unused-parameter & missing-declarations) 2022-11-10 11:10:01 +11:00
81ca6308d1 Cleanup: format 2022-11-10 11:08:55 +11:00
d49dec896a Attempt to fix build error on Windows
Was failing since 1efc94bb2f, probably because some include uses
`std::min()`/`std::max()` which messes with the windows min/max defines.
2022-11-09 23:09:56 +01:00
32757b2429 Fix uninitialized variable use in asset metadata test
Wasn't an issue until 1efc94bb2f added a destructor, which would
attempt to destruct variables at uninitialized memory.
2022-11-09 23:04:24 +01:00
95077549c1 Fix failure in recently added asset library tests
Mistake in 1efc94bb2f.
2022-11-09 22:51:32 +01:00
1cdc6381cf Merge branch 'blender-v3.4-release' 2022-11-09 14:40:34 -07:00
7c1ab77fa6 audaspace: Fix build error with MSVC 17.4+
`DeviceManager.h` uses `std::string` without explicitly including
the `<string>` header. While older MSVC implicitly included this
header somewhere, the headers for 17.4+ do not leading to a build
error.
2022-11-09 14:39:15 -07:00
c932fd79ac Merge branch 'blender-v3.4-release' 2022-11-09 22:38:25 +01:00
b8fc7ed994 Fix incorrect forward declarations, causing warnings on Windows 2022-11-09 22:37:49 +01:00
c8cec11353 Fix T102385: Set frame node active after joining nodes
Set the created frame node to be the active node when joining nodes
with the `NODE_OT_join` operator.

This behavior was unintentonaly changed in rB545fb528d5e1 when the
operator's execute function was simplified by utilizing the node tree
topology cache.

Reviewed By: Hans Goudey

Differential Revision: http://developer.blender.org/D16440
2022-11-09 22:26:16 +01:00
4cd9e9991c Merge branch 'blender-v3.4-release' 2022-11-09 22:03:56 +01:00
cebea62b47 Fix T102256: Gamma Cross blend mode causes stripes
Function `do_gammacross_effect_float` processed one color channel per
loop iteration instead of whole pixel.
2022-11-09 21:59:33 +01:00
7a2827ee99 Merge branch 'blender-v3.4-release' 2022-11-09 13:55:08 -06:00
bfc7653490 Fix T101972: Crash converting 1 or 2 point NURBS curve to Bezier
The conversion is only able to handle NURBS curves with at least three
points. This commit just avoids the crash for shorter curves. If this
ends up confusing users, an error message could be added in the future.
2022-11-09 13:52:31 -06:00
501036faae Merge branch 'blender-v3.4-release' 2022-11-09 20:42:19 +01:00
7f6521f8dc Fix T100883: crash with particle instancing and clumping
Properly initialize clump curve mapping tables for duplis and other cases
where this was missed by making a generic init/free function instead of
duplicating the same logic in multiple places. Also fold lattice deform
init into this.
2022-11-09 20:37:55 +01:00
5f169fdfdc Merge branch 'blender-v3.4-release' 2022-11-09 19:45:19 +01:00
ad227e73f3 Cleanup: Link to documentation page for asset representation type 2022-11-09 19:37:05 +01:00
8232cf5287 Fix T101669: Cycles artifacts in bump map baking
After barycentric convention changes, the differentials used for bump mapping
were wrong leading to artifacts with long thin triangles.
2022-11-09 19:36:30 +01:00
5291e4c358 Cleanup: Remove unused class variable, added in previous commit 2022-11-09 19:35:47 +01:00
1efc94bb2f Asset System: New core type to represent assets (AssetRepresenation)
Introduces a new `AssetRepresentation` type, as a runtime only container
to hold asset information. It is supposed to become _the_ main way to
represent and refer to assets in the asset system, see T87235. It can
store things like the asset name, asset traits, preview and other asset
metadata.

Technical documentation:
https://wiki.blender.org/wiki/Source/Architecture/Asset_System/Back_End#Asset_Representation.

By introducing a proper asset representation type, we do an important
step away from the previous, non-optimal representation of assets as
files in the file browser backend, and towards the asset system as
backend. It should replace the temporary & hacky `AssetHandle` design in
the near future. Note that the loading of asset data still happens
through the file browser backend, check the linked to Wiki page for more
information on that.

As a side-effect, asset metadata isn't stored in file browser file
entries when browsing with link/append anymore. Don't think this was
ever used, but scripts may have accessed this. Can be brought back if
there's a need for it.
2022-11-09 19:30:47 +01:00
7395062480 Cleanup: Miscellaneous cleanups to trim curves node
- Fix braces initialization warning
- Fixed missing static specifier
- Removed two unused functions
2022-11-09 12:13:59 -06:00
1fbb1d8cf6 Fix T102214: inconsistenty between bake and render with invalid material index
When the materal slot index on mesh faces exceeds the number of slots, rendering
would use the last material slot while other operations like baking would fall
back to the default material.

Now consistently use the last material slot in such cases, since preserving
backwards compatibility for rendering seems most important. And if there is
one material slot, it's more useful to use that one rather than falling back
to the default material.
2022-11-09 18:13:03 +01:00
eea3913348 Merge branch 'blender-v3.4-release' 2022-11-09 10:56:28 -06:00
Mattias Fredriksson
11f6c65e61 Geometry Nodes: Trim curve node selection input and corrections
Correct trim for cyclical curves mentioned in T101379, splitting the
curves if the start/endpoint is at the 'loop point'.

Correct implementation based on comments in D14481, request was made to
use 'foreach_curve_by_type' to computing the point lookups.

Included corrections from D16066 as it may not be a adopted solution.

Exposed selection input by adding it as input to the node.
Note: This is disabled for 3.4 to avoid making UI changes in Bcon3.

Differential Revision: https://developer.blender.org/D16161
2022-11-09 10:54:19 -06:00
a43053a00a Improved Korean Font Sample
Small change to the text sample used for Korean font previews

See D16428 for details.

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

Reviewed by Brecht Van Lommel
2022-11-09 08:51:00 -08:00
ce68367969 Fix T102140: Replacement of Noto Sans CJK Font
Replace our Noto Sans CJK with a version that has Simplified Chinese
set as the default script.

See D16426 for details and examples

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

Reviewed by Brecht Van Lommel
2022-11-09 08:22:38 -08:00
d01187c963 Fix T102140: Replacement of Noto Sans CJK Font
Replace our Noto Sans CJK with a version that has Simplified Chinese
set as the default script.

See D16426 for details and examples

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

Reviewed by Brecht Van Lommel
2022-11-09 08:17:52 -08:00
Germano Cavalcante
77bc95bbd5 Fix T102257: Crash when making an Object as Effector set to Guide and trying to scrub the timeline
rB67e23b4b2967 revealed the bug. But the bug already existed before,
it just wasn't triggered.

Apparently the problem happens because the python code generated in
`initGuiding()` cannot be executed twice.

The second time the `initGuiding()` code is executed, the local python
variables are removed to make way for the others, but the reference to
one of the grids in a `Solver` object (name='solver_guiding2') is still
being used somewhere. So an error is raised and a crash is forced.

The solution is to prevent the python code in `initGuiding()` from being
executed twice.

When `FLUID_DOMAIN_ACTIVE_GUIDE` is in `fds->active_fields` this
indicates that the pointer in `mPhiGuideIn` has been set and the guiding
is already computed (does not need to be computed again).

Maniphest Tasks: T102257

Differential Revision: https://developer.blender.org/D16416
2022-11-09 12:13:51 -03:00
Germano Cavalcante
edc00429e8 Fix T102257: Crash when making an Object as Effector set to Guide and trying to scrub the timeline
rB67e23b4b2967 revealed the bug. But the bug already existed before,
it just wasn't triggered.

Apparently the problem happens because the python code generated in
`initGuiding()` cannot be executed twice.

The second time the `initGuiding()` code is executed, the local python
variables are removed to make way for the others, but the reference to
one of the grids in a `Solver` object (name='solver_guiding2') is still
being used somewhere. So an error is raised and a crash is forced.

The solution is to prevent the python code in `initGuiding()` from being
executed twice.

When `FLUID_DOMAIN_ACTIVE_GUIDE` is in `fds->active_fields` this
indicates that the pointer in `mPhiGuideIn` has been set and the guiding
is already computed (does not need to be computed again).

Maniphest Tasks: T102257

Differential Revision: https://developer.blender.org/D16416
2022-11-09 12:11:20 -03:00
e6b38deb9d Cycles: Add basic support for using OSL with OptiX
This patch  generalizes the OSL support in Cycles to include GPU
device types and adds an implementation for that in the OptiX
device. There are some caveats still, including simplified texturing
due to lack of OIIO on the GPU and a few missing OSL intrinsics.

Note that this is incomplete and missing an update to the OSL
library before being enabled! The implementation is already
committed now to simplify further development.

Maniphest Tasks: T101222

Differential Revision: https://developer.blender.org/D15902
2022-11-09 15:30:21 +01:00
efe073f57c Merge branch 'blender-v3.4-release' 2022-11-09 14:43:05 +01:00
c26d49e854 Fix T101906: Modifier apply not working if target object is in excluded collection
The issue was introduced by the optimization of hidden objects and modifiers
in the f12f7800c2.

The solution here detects that either an object is hidden or the modifier is
disabled and does special tricks to ensure the dependencies are evaluated.
This is done by constructing a separate minimal dependency graph needed for
the object on which the modifier is being applied on. This minimal dependency
graph will not perform visibility optimization, making it so modifier
dependencies are ensured to be evaluated.

The downside of such approach is that some dependencies which are not needed
for the modifier are still evaluated. There is no currently an easy way to
avoid this. At least not without introducing possible race conditions with
other dependency graphs.

If the performance of applying modifiers in such cases becomes a problem the
possible solution would be to create a temporary object with a single modifier
so that only minimal set of dependencies is pulled in the minimal dependency
graph.

Differential Revision: https://developer.blender.org/D16421
2022-11-09 14:20:26 +01:00
477faffd78 Cleanup: unused argument warning 2022-11-09 21:08:31 +11:00
683b945917 Cleanup: format 2022-11-09 21:07:09 +11:00
024bec85f6 Depsgraph: simplify scheduling in depsgraph evaluator
No functional or performance changes are expected.

Differential Revision: https://developer.blender.org/D16423
2022-11-09 09:58:05 +01:00
59e69fc2bd Fix strict compiler warnings
Functions which are local to a translation unit should either be
marked as static, or be in an anonymous namespace.
2022-11-09 09:47:24 +01:00
aba0d01b78 Fix T102278: Compositor transforms apply locally
When using two transformed compositor results, the transformation of one
of them is apparently in the local space of the other, while it should
be applied in the global space instead.

In order to realize a compositor result on a certain operation domain,
the domain of the result is projected on the operation domain and later
realized. This is done by multiplying by the inverse of the operation
domain. However, the order of multiplication was inverted, so the
transformation was applied in the local space of the operation domain.

This patch fixes that by inverting the order of multiplication in domain
realization.
2022-11-09 10:35:41 +02:00
3836b6ff8c Cancel Equalize Handles & Snap Keys when no control points are selected
The Equalize Handles and Snap Keys operators would allow the user to
invoke them successfully even when they would have no effect due to
there not being any selected control points.

This patch makes it so that an error is displayed when these operators
are invoked with no control points are selected.

The reason this is in the `invoke` function is because it would be too
expensive to run this check in the `poll` function since it requires a
linear search through all the keys of all the visible F-Curves.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D16390
2022-11-08 21:04:47 -08:00
800b025518 Merge branch 'blender-v3.4-release' 2022-11-09 14:34:08 +11:00
fb52a09840 Fix T102287: Unhandled Numpad Separator on QWERTZ under Wayland 2022-11-09 14:33:39 +11:00
baee7ce4a5 Fix T102306: buildtime shader compilation option fails under Wayland
libdecor (for window decorations) was crashing on exit with the shader
builder, avoid the crash by calling the "background" system creation
function which doesn't initialize window management under Wayland.
2022-11-09 14:01:14 +11:00
76c308e45d Merge branch 'blender-v3.4-release' 2022-11-09 13:57:27 +11:00
801db0d429 Revert "Fix T102306: buildtime shader compilation option fails under Wayland"
This reverts commit 6fa05e2c29.
2022-11-09 13:54:19 +11:00
6fa05e2c29 Fix T102306: buildtime shader compilation option fails under Wayland
libdecor (for window decorations) was crashing on exit with the shader
builder, avoid the crash by calling the "background" system creation
function which doesn't initialize window management under Wayland.
2022-11-09 13:32:53 +11:00
756538b4a1 BLI_math: remove normalize from mat3_normalized_to_quat_fast
The quaternion calculated are unit length unless the the input matrix is
degenerate. Detect degenerate cases and remove the normalize_qt call.
2022-11-09 13:25:11 +11:00
c6612da1e6 Merge branch 'blender-v3.4-release' 2022-11-09 13:06:05 +11:00
2d9d08677e Cleanup: fix types from f04f9cc3d0 2022-11-09 14:54:37 +13:00
3fa6aacb91 Cleanup: add function attributes to BLI_sprintf
Quiet warning, suggesting to use attributes with GCC.
2022-11-09 12:32:08 +11:00
494385a5bc Fix T101848: Zeroed matrix converted to a quaternion results in rotation
Re-order checks to ensure a zeroed matrix results in a quaternion
without rotation. Also avoid some redundant calculation where the
'trace' was calculated but not used, flip the scaling value early
on instead of negating the quaternion after calculating it.
2022-11-09 12:23:01 +11:00
335082dcd3 Merge branch 'blender-v3.4-release' 2022-11-08 15:31:33 -08:00
ee5b6f7150 Hide ratio when using error margin mode in decimate keyframes operator
This fixes a bug in the function that determines what properties to show
on the Decimate Keyframes operator.

Before the fix, the "Remove" (i.e., `factor`) slider was visible no
matter what "Mode" was being used. This meant that the slider was
visible and modifiable when it had no effect, creating confusion.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D16318
2022-11-08 15:29:57 -08:00
f0b5f94cb5 Cleanup: format 2022-11-09 11:59:51 +13:00
f04f9cc3d0 Cleanup: add unique_index_table to UvElementMap
In anticipation of UV Copy+Paste, we need fast access to indices
of unique UvElements. Can also be used to improve performance and
simplify code for UV Sculpt tools and UV Stitch.

No user visible changes expected.

Maniphest Tasks: T77911

See also: D16278
2022-11-09 11:47:16 +13:00
75265f27da Merge branch 'blender-v3.4-release' 2022-11-08 21:21:02 +01:00
62e32e7c2e Fix VSE: Effect strip flickers when moving left handle
The issue was caused by refactoring, see 7afcfe111a. Function
`SEQ_transform_fix_single_image_seq_offsets` modified offsets after
handle was moved, but this was not done correctly.

Remove function mentioned above and move strip start when moving left
handle of strips that have only single frame of content by design
(image, text, color, ...).
2022-11-08 21:19:17 +01:00
Lukas Stockner
1eca437197 Color Management: Parallelize ImBuf conversion to float
Motivated by long loading times in T101969, reduces render preparation time from 14sec to 6sec.

Another possible improvement would be to use C++ and template based on OCIO vs. sRGB,
but moving the file to C++ seems nontrivial (and opens up the question whether ocio_capi
makes any sense then or we should just use OCIO directly) so I left it at a direct 1:1
parallelization of the existing code for now.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16317
2022-11-08 20:59:41 +01:00
c6aacd718a Cleanup: Improve precision during UV packing.
Simplify API and improve accuracy of uv packing placement
by using pre-translation and double precision internally.

Will protect against future precision problems with UDIM.

No user visible changes expected.

Maniphest Tasks: T68889
Differential Revision: https://developer.blender.org/D16362
2022-11-09 08:50:53 +13:00
96d8e5e66b Merge branch 'blender-v3.4-release' 2022-11-08 13:39:45 -06:00
d80d7b8f70 Geometry Nodes: Add preferred domain to many field inputs
The preferred domain is used to decide which domain the viewer node
should use when set to "Auto" domain. This commit adds it to some curve
input nodes and the curve and mesh topology nodes. This makes debugging
node setups with these nodes a bit faster and less frustrating.
2022-11-08 13:34:11 -06:00
da41f11a29 Fix T102358: Sample curve node all curves factor mode incorrect
The "all curve" sampling is implemented as two functions internally.
The first finds which curve each "global" sample should be on. Then
the second is the regular evaluation and sampling in that curve.
The first operations creates lengths, but they were processed as
factors when passed to the second function.
2022-11-08 13:34:11 -06:00
4b57bc4e5d Cleanup: format 2022-11-09 08:30:18 +13:00
b539d425f0 Merge branch 'blender-v3.4-release' 2022-11-08 19:47:55 +01:00
Gon Solo
c306ccb67f Fix Cycles error with runtime compilation when there is no path to OptiX SDK
If no OPTIX_ROOT is set, nvcc fails to compile because there is a stray "-I"
in the arguments. Detect if the include path is empty and act accordingly.

Differential Revision: https://developer.blender.org/D16308
2022-11-08 19:40:57 +01:00
35eb37c60d Merge branch 'blender-v3.4-release' 2022-11-08 19:36:06 +01:00
5925b1821a Fix T102328: Incorrect strip state after copying
Effect strip start position was translated twice. This is caused by
recent refactoring, see 7afcfe111a.

Don't change `seq->start` of attached effect strips during translation
and only rely on `seq_time_update_effects_strip_range` function.
2022-11-08 19:35:02 +01:00
ad5814a2a7 Merge branch 'blender-v3.4-release' 2022-11-08 12:33:31 -06:00
66dda2b902 Fix T102003: Spline parameter length wrong for NURBS
The node has always be a bit confusing for the NURBS case, since it
uses the distance between control points since the evaluated/control
point mapping isn't obvious, but it also went above 1, which wasn't
correct.

Instead, retrieve the total length from the point lengths calculated
in the previous step. The results should be the same for other curve
types.
2022-11-08 12:32:10 -06:00
8eab23bc66 Geometry Nodes: Fix alignment of exposed properties in the modifier
The spacing and alignment of the properties in the geometry nodes
modifier could vary depending on the type of the socket or
whether the input can accept attributes.
Wrapping each property in its own `row` layout allows us to make
the spacing and alignment between them consistent.

Reviewed By: Hans Goudey

Differential Revision: http://developer.blender.org/D16417
2022-11-08 19:14:29 +01:00
fd35216025 Geometry Nodes: Fix alignment of exposed properties in the modifier
The spacing and alignment of the properties in the geometry nodes
modifier could vary depending on the type of the socket or
whether the input can accept attributes.
Wrapping each property in its own `row` layout allows us to make
the spacing and alignment between them consistent.

Reviewed By: Hans Goudey

Differential Revision: http://developer.blender.org/D16417
2022-11-08 19:09:28 +01:00
95d36a31b6 Merge branch 'blender-v3.4-release' 2022-11-08 18:23:49 +01:00
871c4380c4 Fix T102318: crash smoothing vertex weights in editmode
Not quite sure why {rBd37d17019c52} forcefully set the Mesh to NULL if
in editmode, but this caused the attribute lookup to fail/crash.

Now only use the attribute if we have the mesh (reducing the scope where
it is used), bmesh editmode case does not rely on it.

Maniphest Tasks: T102318

Differential Revision: https://developer.blender.org/D16406
2022-11-08 18:11:37 +01:00
4c182aef7c GPencil: Make Sculpt Auto-masking Global and not by Brush
The auto-masking was working by Brush and this was very
inconvenient because it was necessary set the options by
Brush, now the options are global and can be set at once.

Also, the automa-masking now works with `and` logic
and not with `or` as before. That means that a stroke
must meet all the conditions of the masking.

Added new Layer and Material options to masking the 
strokes using the same Layer/Material of the selected stroke.
Before, only Active Layer and Active Material could be masked.

The options of masking has been moved to the top-bar using
the same design of Mesh Sculpt masking.

As result of the changes above, the following props changed:

Removed:

`brush.gpencil_settings.use_automasking_strokes`
`brush.gpencil_settings.use_automasking_layer`
`brush.gpencil_settings.use_automasking_material`

Added:

`tool_settings.gpencil_sculpt.use_automasking_stroke`
`tool_settings.gpencil_sculpt.use_automasking_layer_stroke`
`tool_settings.gpencil_sculpt.use_automasking_material_stroke`
`tool_settings.gpencil_sculpt.use_automasking_layer_active`
`tool_settings.gpencil_sculpt.use_automasking_material_active`


Reviewed by: Julien Kaspar, Matias Mendiola, Daniel Martinez Lara
2022-11-08 16:55:59 +01:00
bbb1d3e5e7 Merge branch 'blender-v3.4-release' 2022-11-08 16:28:11 +01:00
0a7308a0f1 Fix: improve CD_ASSIGN handling when adding custom data layer
Previously, the code would incorrectly free the passed in custom data
layer even when `CD_ASSIGN` was not used. Now the function actually
supports assigning the data to the layer. This only fixes the case for
custom data layer types that only support a single layer like `CD_MEDGE`.

Informally reviewed by Hans Goudey.
2022-11-08 16:26:42 +01:00
6a14ca18d0 Merge branch 'blender-v3.4-release' 2022-11-08 16:26:09 +01:00
c3391d537b Fix T101894: only do FCurve-select if no keys have been touched previously
Change the behaviour of circle select on FCurves:
- Before any key is touched, the behaviour is as it was (key included in
  circle-select area → select it; otherwise → select entire curve)
- If any key has been touched, an internal option
  (`use_curve_selection`) is  flipped and selecting the entire curve is
  disallowed.

This ensures that once a key changes selection state, it's no longer
possible to select the entire curve. This allows dragging over keys and
subsequently drag over a keyless part of the curve.

Reviewed By: RiggingDojo, troopy28

Maniphest Tasks: T101894

Differential Revision: https://developer.blender.org/D16307
2022-11-08 16:12:38 +01:00
c73ae711bf BLI: new basic CacheMutex
This patch introduces a new `CacheMutex` which makes it easy to implement
lazily computed caches in e.g. `Curves`. For more details see `BLI_cache_mutex.hh`.

Differential Revision: https://developer.blender.org/D16419
2022-11-08 15:50:49 +01:00
32f58c0a92 Cleanup: fix compiler warning with openjpeg 2.5 2022-11-08 14:33:24 +01:00
Edward
1d71f82033 Texture Paint: sync adding a new texture slot to the Image Editor
When changing the texture paint slot index or activating a Texture Node, the texture displayed in the Image Editor changes accordingly.
This patch syncs the Image Editor when a new texture paint slot was added, which currently is not the case.

Also deduplicates some code.
2022-11-08 14:28:44 +01:00
77c4d3154b Merge branch 'blender-v3.4-release' 2022-11-08 13:47:43 +01:00
09faf8a449 Fix T102312: anchored brush texture overlay draws in wrong place
Rotation and scale was done around the wrong center (always around mouse
position) in paint_draw_tex_overlay [on the other hand,
paint_draw_cursor_overlay already got the center right].

Now make the center dependent on UnifiedPaintSettings "draw_anchored".

Maniphest Tasks: T102312

Differential Revision: https://developer.blender.org/D16418
2022-11-08 13:40:14 +01:00
Brecht Van Lommel
e1b3d91127 Refactor: replace Cycles sse/avx types by vectorized float4/int4/float8/int8
The distinction existed for legacy reasons, to easily port of Embree
intersection code without affecting the main vector types. However we are now
using SIMD for these types as well, so no good reason to keep the distinction.

Also more consistently pass these vector types by value in inline functions.
Previously it was partially changed for functions used by Metal to avoid having
to add address space qualifiers, simple to do it everywhere.

Also removes function declarations for vector math headers, serves no real
purpose.

Differential Revision: https://developer.blender.org/D16146
2022-11-08 12:28:40 +01:00
32ec0521c5 Merge branch 'blender-v3.4-release' 2022-11-08 12:18:12 +01:00
82ba205646 Fix T85870: ColorRamp Keyframes crash Blender
The color-band needs to do some special, rather awkward updating of the
UI state when certain values are changed. As @lichtwerk noted in the
report, this was done to the wrong buttons. Now lookup the proper
buttons, and don't assume that `uiItemR()` only adds a single button
(which often isn't the case).
2022-11-08 12:17:56 +01:00
c047042adf Merge branch 'blender-v3.4-release' 2022-11-08 12:03:07 +01:00
0d945fe20e Fix deprecation warnings about printf() on macOS
The new Xcode 14.1 brings the new Apple Clang compiler which
considers sprintf unsafe and geenrates deprecation warnings
suggesting to sue snprintf instead. This only happens for C++
code by default, and C code can still use sprintf without any
warning.

This changes does the following:

- Whenever is trivial replace sprintf() with BLI_snprintf.
- For all other cases use the newly introduced BLI_sprintf
  which is a wrapper around sprintf() but without warning.

There is a discouragement note in the BLI_sprintf comment to
suggest use of BLI_snprintf when the size is known.

Differential Revision: https://developer.blender.org/D16410
2022-11-08 12:01:01 +01:00
dc609d9f1f Fix T100988: flickering when using sculpt brush in drag dot mode
Differential Revision: https://developer.blender.org/D16305
2022-11-08 11:46:44 +01:00
f12236d1e3 Merge branch 'blender-v3.4-release' 2022-11-08 11:34:38 +01:00
1f3be45f1f Fix T102242: Underline shortcut keys not working/appearing in sub-menu
Upon closer inspection, looks like `UI_BLOCK_NUMSELECT` was previously
set for all code paths and 99e5024e97 removed it from one.
2022-11-08 11:34:12 +01:00
871375f222 PyAPI: add invalid objects check for RNA struct keys()/values()/items() 2022-11-08 17:17:30 +11:00
8b151982fe Merge branch 'blender-v3.4-release' 2022-11-08 17:00:46 +11:00
642ff82f74 Cleanup: format, remove commented code & unused variable 2022-11-08 16:58:37 +11:00
3c1fb9aea1 Workaround crash generating Python API documentation
Avoid accessing freed memory from dynamically allocated EnumPropertyItem
arrays. Rely on the memory being held by the iterator which isn't the
case when it was converted to a tuple.
2022-11-08 16:52:30 +11:00
fddcdcc20c Merge branch 'blender-v3.4-release' 2022-11-08 12:18:52 +11:00
9d1380e0a9 Merge branch 'blender-v3.4-release' 2022-11-08 12:18:48 +11:00
452865c80d Merge branch 'blender-v3.4-release' 2022-11-08 12:18:44 +11:00
8f439bdc2d Fix invalid function signatures for PySequenceMethods callbacks
Function casts hid casting between potentially incompatible type
signatures (using int instead of Py_ssize_t). As it happens this seems
not to have caused any bugs on supported platforms so this change is
mainly for correctness and to avoid problems in the future.
2022-11-08 12:16:28 +11:00
2257a9bfb1 Cleanup: correct type of RNA struct methods
Some BPy_StructRNA methods used BPy_PropertyRNA in their function
signatures, while this didn't case any bugs, it could lead to issues
in the future.
2022-11-08 11:26:33 +11:00
4eb9322eda Cleanup: PyMethodDef formatting
Missed these changes in [0].

Also replace designated initializers in some C code, as it's not used
often and would need to be removed when converting to C++.

[0] e555ede626
2022-11-08 11:13:58 +11:00
3e71220efc Fix support for building with ffmpeg < 5.0
Seems like the new audio channel api was not as backwards compatible as we thought.
Therefore we need to reintroduce the usage of the old api to make older ffmpeg version be able to compile Blender.

This change is only intended to stick around for two releases or so. After that we hope that most Linux distros ship
ffmpeg >=5.0 so we can switch to it.

Reviewed By: Sergey

Differential Revision: http://developer.blender.org/D16408
2022-11-07 17:46:13 +01:00
1140e001a0 Fix T102329: assert when cutting node tree link 2022-11-07 16:12:07 +01:00
c842a5a187 Fix T101526: assert due to wrong node tree owner id 2022-11-07 15:48:48 +01:00
95631c94c4 Merge branch 'blender-v3.4-release' 2022-11-07 15:30:49 +01:00
84d8698488 Fix T101533: Wrong DoF when a non-camera object is the active camera
Make sure non-camera data is not casted to a Camera pointer.

Solution suggested by Damien Picard (@pioverfour).
2022-11-07 15:30:15 +01:00
52bd198153 Fix T100872: restrict Python API on built-in nodes
Differential Revision: https://developer.blender.org/D16304
2022-11-07 14:43:24 +01:00
8ff71acd84 Fix T102324: reverse curve node breaks crazy space editing 2022-11-07 14:40:35 +01:00
8473b5a592 Fix strict compiler warnings 2022-11-07 14:20:50 +01:00
79d8610d04 Fix T102311: crash when opening node add menu with assets 2022-11-07 14:15:33 +01:00
403fc9a3f1 Merge branch 'blender-v3.4-release' 2022-11-07 08:46:15 -03:00
8f4e52b7e0 Fix T102053: snap fails with instances of geometry nodes
As instances are often generated geometries, we cannot rely on the data
provided by `DupliObject::ob`.

Use `DupliObject::ob_data` when possible.

This required a major refactor in the code as the output variables are
now gathered in context and easier to access.
2022-11-07 08:44:35 -03:00
9ea82ce653 Fix potentially uninitialized memory usage
`nearest_world_tree_co` allows null parameter, so the `index` variable
isn't really needed and doesn't even need to be initialized.
2022-11-07 08:43:15 -03:00
7b845fb984 Transform: remove SnapData cache for meshes
All cache needed is already stored in `Mesh.runtime`.
2022-11-07 08:43:02 -03:00
e555ede626 Cleanup: unify struct declaration style for Python types, update names
Use struct identifiers in comments before the value.
This has some advantages:

- The struct identifiers didn't mix well with other code-comments,
  where other comments were wrapped onto the next line.
- Minor changes could re-align all other comments in the struct.
- PyVarObject_HEAD_INIT & tp_name are no longer placed on the same line.

Remove overly verbose comments copied from PyTypeObject (Python v2.x),
these aren't especially helpful and get outdated.

Also corrected some outdated names:

- PyTypeObject.tp_print -> tp_vectorcall_offset
- PyTypeObject.tp_reserved -> tp_as_async
2022-11-07 22:38:32 +11:00
719332d120 Cleanup: remove unused variable 2022-11-07 22:38:32 +11:00
688b408bbb Fix 'ED_transform_snap_object_project_ray_all' not return 'hit_list'
Missed in rBff4f14b21a42.
2022-11-07 08:38:09 -03:00
888fb0b395 Merge branch 'blender-v3.4-release' 2022-11-07 12:32:36 +01:00
ff4f14b21a Fix T102053: snap fails with instances of geometry nodes
As instances are often generated geometries, we cannot rely on the data
provided by `DupliObject::ob`.

Use `DupliObject::ob_data` when possible.

This required a major refactor in the code as the output variables are
now gathered in context and easier to access.
2022-11-07 08:27:54 -03:00
b2db324f60 Fix potentially uninitialized memory usage
`nearest_world_tree_co` allows null parameter, so the `index` variable
isn't really needed and doesn't even need to be initialized.
2022-11-07 08:27:54 -03:00
cad897de16 Transform: remove SnapData cache for meshes
All cache needed is already stored in `Mesh.runtime`.
2022-11-07 08:27:54 -03:00
ffc0db1994 Fix Curves Smooth modifier appears to be able to act on control points
This is not the case though, the modifier act explicitly on mesh edges,
if no tesselated mesh is provided, it would simpy early out and do
nothing.

Now always disable the "Apply on Spline" option with a tip that this
modifier can only smooth the tesselated curve (not the underlying curve
control points). Similar to rB1a6b51e17502.

Fixes T102060.

Maniphest Tasks: T102060

Differential Revision: https://developer.blender.org/D16386
2022-11-07 12:25:20 +01:00
94930da29b Fix File Browser Move Bookmark malfunction if no item is selected
The operator was acting on non selected items (wasnt checking SpaceFile
bookmarknr for being -1) which could end up removing items even.

Now sanatize this by introducing proper poll (which returns false if
nothing is selected).

Fixes T102014.

Maniphest Tasks: T102014

Differential Revision: https://developer.blender.org/D16385
2022-11-07 12:24:54 +01:00
e031a45d60 Fix T102238: double free when storing attribute on empty geometry 2022-11-07 11:42:26 +01:00
129197f20d Merge branch 'blender-v3.4-release' 2022-11-07 21:33:24 +11:00
186f16e84c Fix T102316: blank color-space menu drop-downs
Regression in [0] needs further investigation
(building docs may crash again).

This effectively reverts [0], however de-duplicating the color-space
enum can be kept.

[0]: 037b771e1a
2022-11-07 21:30:34 +11:00
74140d41b1 Cycles: Apple GPU threadgroup tuning
This patch tunes maximum threads-per-threadgroup and threads-per-block for faster renders on Apple GPUs. Appropriate tuning is selected based on the GPU architecture (M1 or M2). We see a benchmark uplift of around 5-10% on M1 family chips. Similar uplift is expected on M2 with upcoming OS changes. (Ref T101931)

Reviewed By: brecht

Maniphest Tasks: T101931

Differential Revision: https://developer.blender.org/D16299
2022-11-07 10:00:46 +00:00
671c3e1fa4 Fix File Browser Move Bookmark malfunction if no item is selected
The operator was acting on non selected items (wasnt checking SpaceFile
bookmarknr for being -1) which could end up removing items even.

Now sanatize this by introducing proper poll (which returns false if
nothing is selected).

Fixes T102014.

Maniphest Tasks: T102014

Differential Revision: https://developer.blender.org/D16385
2022-11-07 10:28:37 +01:00
37ca6e4fd1 Merge branch 'blender-v3.4-release' 2022-11-06 15:45:45 +01:00
25c6444bad Fix T102153: crash when muting node group with active viewer 2022-11-06 15:39:57 +01:00
0697631929 Fix T102144: missing validation of spline resolution 2022-11-06 15:36:53 +01:00
c29c61f840 Fix T102292: deadlock in geometry nodes evaluation with task isolation
As described in the comment on `BLI_task_isolate`, deadlocks can happen
when isolation is used with threading primitives that separate spawning tasks
from executing them. All threads are waiting the tasks to complete but no
thread is able to continue working due to task isolation.

The fix is to not pass lazy-threading hints through task isolations. This way
isolated regions can't create new tasks in a scheduler further up the call stack.
This may lead to minor slowdowns because less threading may be used.
It's generally possible to get rid of the slowdown again by sending the
lazy-threading hint before entering the isolated region.
2022-11-06 15:07:32 +01:00
f4e97bd67d Geometry Nodes: fix missing curve cache 2022-11-06 12:20:26 +01:00
a8865f3402 Fix: Missing initialization curves bounds in set origin operator
It could be changed, but currently curves.bounds_min_max
relies on the initial value of its arguments. Split from D16331.
2022-11-06 10:23:14 +01:00
3852094b35 Cleanup: Nodes: Use const arguments, avoid recursive iteration
Use the node topology cache and avoid modifying the node tree
in a non-threadsafe way to improve the predictability of using
the helper function. Replaces the implementation from
e0d4047136.
2022-11-06 10:23:14 +01:00
Pablo Vazquez
28e952dacd UI: Sort items in Weight Locks menu
Reorder the items in the `Locks` menu:
* Split into three groups: Lock, Unlock, Invert.
* Use icon only in the first item of each group, following the HIG.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D16383
2022-11-06 02:28:48 +01:00
6ef6778215 Fix: Broken debug build after recent cleanup commit
5060f26f50
2022-11-05 21:37:37 +01:00
8b29d6cd75 Cleanup: Remove unused node function 2022-11-05 21:37:37 +01:00
c6725dc507 Cleanup: Use Vector in group input/output node update functions
Also reduce the scope of variables and use ListBase macros
2022-11-05 21:37:37 +01:00
db3bf36770 Sculpt: Fix T102253: Missing call to SCULPT_automasking_node_update 2022-11-05 11:57:39 -07:00
5060f26f50 Cleanup: Move function to legacy mesh conversion file 2022-11-05 18:14:26 +01:00
455d195d55 OBJ Export: Remove edge recalculation
The removed function call removes all attributes from mesh edges
and rebuilds the mesh edge topology. This isn't necessary because
meshes always have edges in the first place.

Exporting a 4 million face grid, this saved 1.5 seconds out of 4
seconds total for the whole export.

Tests files have to be updated, since the edge calculation could
potentially change the order of elements. This is also a fix, since
previously the exporter would delete all attributes on the evaluated
mesh edges.

Differential Revision: https://developer.blender.org/D16391
2022-11-05 16:28:13 +01:00
4ec5a8cbc2 Cleanup: Remove unnecessary node type registraction functions
These functions provided little benefit compared to simply setting
the function pointers directly.
2022-11-05 16:10:27 +01:00
e673f3ba24 Cleanup: Remove redundant assignment of loose edge flag
This is assigned by `BKE_mesh_calc_edges_loose` a few lines below.
2022-11-05 13:26:52 +01:00
38086dcfdc Merge branch 'blender-v3.4-release' 2022-11-05 20:03:46 +11:00
037b771e1a Fix crash building Python API docs
Color space conversion item-function missed checking the context was
NULL to return a static array. This caused freed memory access when
building docs.
2022-11-05 19:57:02 +11:00
412e7d3771 Merge branch 'blender-v3.4-release' 2022-11-05 17:10:23 +11:00
60043a6158 Cleanup: quiet unused argument warning 2022-11-05 17:08:53 +11:00
b3e1540c50 Cleanup: use bools and typed enums for WM_job type & flag
Also use typed enum for the event handler flag.
2022-11-05 14:14:39 +11:00
ae3073323e Cleanup: use bool instead of short for job stop & do_update arguments
Since these values are only ever 0/1, use bool type.
2022-11-05 13:47:01 +11:00
4a313b8252 Cleanup: Move legacy mesh conversions to proper file 2022-11-04 23:28:10 +01:00
23dafa4ad6 Cleanup: OBJ: Simplify access to loose edges
Implementing this with a separate function just added extra code,
there wasn't much benefit to it.
2022-11-04 21:58:15 +01:00
59af0fba9d Merge branch 'blender-v3.4-release' 2022-11-04 21:06:39 +01:00
bba6d28942 Fix T99641: Assert hit when splitting video sequencer area horizontally
Don't draw channels region when height is 0.
2022-11-04 21:01:11 +01:00
4b200b491c Cleanup: Use mesh API functions 2022-11-04 20:37:17 +01:00
10131a6f62 Cleanup: Mesh: Remove redundant edge render flag
Currently there are both "EDGERENDER" and "EDGEDRAW" flags, which are
almost always used together. Both are runtime data and not exposed to
RNA, used to skip drawing some edges after the subdivision surface
modifier. The render flag is a relic of the Blender internal renderer.
This commit removes the render flag and replaces its uses with the
draw flag.
2022-11-04 20:19:52 +01:00
85ce488298 Realtime Compositor: Implement static cache manager
This patch introduces the concept of a Cached Resource that can be
cached across compositor evaluations as well as used by multiple
operations in the same evaluation. Additionally, this patch implements a
new structure for the realtime compositor, the Static Cache Manager,
that manages all the cached resources and deletes them when they are no
longer needed.

This improves responsiveness while adjusting compositor node trees and
also conserves memory usage.

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

Reviewed By: Clement Foucault
2022-11-04 16:14:22 +02:00
943d574185 Merge branch 'blender-v3.4-release' 2022-11-04 21:59:38 +11:00
bb86007018 Fix T102232: bridge edge loop crash
Many connected edge loops could result in two edge loops sharing
vertices. This is more of a workaround, the reason for two edge loops
sharing vertices could be prevented some other way.
Add this check since it's a straightforward solution,
furthered investigation noted as a TODO.
2022-11-04 21:52:01 +11:00
4b2458b457 Merge branch 'blender-v3.4-release' 2022-11-04 19:19:23 +11:00
Evan Wilson
72505da862 Fix T102216: Change min_ff to max_ff in the return of BlendType max
BlendType max incorrectly returns the minimum in BLI_color_mix.hh
This differential fixes it to return the maximum.

Maniphest Tasks: T102216

Ref D16364
2022-11-04 19:18:54 +11:00
d4f0ccb6b4 Cleanup: pass const view_area in sequencer functions 2022-11-04 18:50:31 +11:00
7a7055c186 Cleanup: use bool for render types ok/result_ok 2022-11-04 18:50:31 +11:00
d6b2f4ad8e Merge branch 'blender-v3.4-release' 2022-11-04 00:03:47 -07:00
Colin Basnett
11a705c2d0 Fix T102218: Baked f-curves display incorrectly when normalized
This fixes T102218, where baked f-curves would display incorrectly when normalized.

This bug was a result of the code making no effort to determine the y-range of baked f-curves, so it fell back to a default that looked horrible.

I've added specific handling for finding the y-range of each f-curve (I extracted this functionality out to a new function, `fcurve_scene_coord_range_get`, for organization purposes). In addition, a minor optimization was made to eliminate redundant range-checks when in preview range mode.

{F13838304}

Reviewed By: sybren

Maniphest Tasks: T102218

Differential Revision: https://developer.blender.org/D16363
2022-11-03 23:56:50 -07:00
624c11d69f BLI_path: remove use of BLI_path_normalize in BLI_path_parent_dir
Normalize is no longer necessary as BLI_path_name_at_index skips
redundant path components such as "//" and "/./".

This has the advantage that the path length isn't limited to FILE_MAX.
2022-11-04 17:22:11 +11:00
3d34b8c901 Merge branch 'blender-v3.4-release' 2022-11-04 16:51:18 +11:00
a4ea684bc8 Fix missing call to AttributeWriter::finish with paint vertex selection 2022-11-04 16:49:47 +11:00
ecda9483f1 Merge branch 'blender-v3.4-release' 2022-11-03 23:41:11 -04:00
eb8155ebcd PyDoc: Make rst files more readable
This commit reduces the amount of white space generated and keeps parameter documentation of a single line.

This makes the resulting rst files easier to read in the case of debugging.

This was useful while looking into T97464
2022-11-03 23:36:12 -04:00
e36db7018d Merge branch 'blender-v3.4-release' 2022-11-04 14:00:14 +11:00
c5dde1c345 Cleanup: quiet unused argument warning 2022-11-04 13:59:03 +11:00
3d72c37f7a Fix T101686: WPaint + Pose select fails with GPU depth-picking disabled
Regression in [0], however the primary purpose of that code was to
cycle away from the active object (behavior which was intentionally
removed, see: T96752).

This broke weight-paint + pose-selection (Ctrl-LMB)
when the GPU depth picking preference was disabled.
Causing selection to pick the mesh object instead of the pose bones.
This de-selected the armature, making the pose bones unselectable
instead of selecting the pose bone as intended.

Adding the old code back (restricting it to weight-paint mode)
fixes the bug but reintroduces fairly involved logic unnecessarily.

Instead, prioritize bone selecting when in weight-paint & pose mode
(previously this was only done in pose-mode).

[0]: b1908f2e0b
2022-11-04 13:58:57 +11:00
9dfc134c9d DRW: Fix incorrect logic in state redundancy check
Error introduced by rB3c39a3affee7.
2022-11-03 19:41:36 +01:00
c2a99cb0b6 Merge branch 'blender-v3.4-release' 2022-11-03 19:38:36 +01:00
1452b44352 DRW: PointCloud: Fix memset writting non-trivial type std::mutex
This issue might have produced crashes in some cases similar to
rBafd30e5e3a77.
2022-11-03 19:34:58 +01:00
5081de736a Cleanup: DRW: Fix unused parameters warning 2022-11-03 19:34:58 +01:00
44dd158803 DRW: Command: Fix custom group test being always true 2022-11-03 19:34:58 +01:00
5401e68a61 Merge branch 'blender-v3.4-release' 2022-11-03 12:20:44 -05:00
838d20b990 make float value explicit 2022-11-03 12:18:53 -05:00
0e0b3d6e1a adding defaults for NLA Action scale and repeat
Differential Revision: https://developer.blender.org/D16379
2022-11-03 12:18:53 -05:00
3c39a3affe DRW: Add support for clip plane count as part of the draw state.
This moves the implementation from the View to the draw manager itself.

However, this is not its final place and should be moved to the shader
create info at some point in the future.
For now it is not possible because of possible interaction with the
old draw manager codebase.
2022-11-03 17:03:22 +01:00
dcfe4a302c Merge branch 'blender-v3.4-release' 2022-11-03 16:52:39 +01:00
2c0c431399 Fix T102221: Entering editmode invalidates the driver associated with that mesh
The regression is caused by D13824 0f89bcdbeb.

This fix follows the code from Sybren (D7785) to make object-mode
drivers from shapekey value to work. This intuitively makes sense
since the D13824 made the edit mode evaluation and ownership follow
the object mode more closely.

Differential Revision: https://developer.blender.org/D16380
2022-11-03 16:52:11 +01:00
Brecht Van Lommel
e449bf350c Fix Wayland warning on startup when running X11
On Ubuntu 20.04 running X11, there was this message on every Blender startup:
Unable to find 'wl_proxy_marshal_flags' in 'libwayland-client.so.0'.

The reason is that we build against Wayland protocols 1.21, which in turns requires
Wayland on the distribution to be 1.21+, which is not the case on Ubuntu 20.04.

This simply silences the warning. An improvement would be to explain the user that
their Wayland version is too old when neither X11 or Wayland can be found. Though
that's not trivial and a situation with old Wayland and no XWayland seems unlikely
to happen in practice.

Differential Revision: https://developer.blender.org/D16266
2022-11-03 15:46:44 +01:00
41c692ee2f Fix deprecation warnings in FFmpeg related code
The non-deprecated API dates back to 2017, so it should be safe
to simply migrate to it.

Fixes verbose error prints, making it easier to see actual issues.

Differential Revision: https://developer.blender.org/D16370
2022-11-03 15:18:02 +01:00
74c293863d Cycles: Remove use of sprintf() in MD5 code
The new Xcode declares the `sprintf()` function deprecated and
suggests to sue `snprintf()` as a safer alternative.

This change actually moves away from any formatted printing and
uses inlined byte-to-hex-string conversion which is also safe
and is (unmesurably) faster.

Differential Revision: https://developer.blender.org/D16378
2022-11-03 15:10:37 +01:00
90805c9943 Merge branch 'blender-v3.4-release' 2022-11-03 14:32:27 +01:00
09b9e1e95e Fix T102225: Crash opening menus
Seems to be introduced by 99e5024e97.

The crash is caused by the difference in the expected alignment
of the `uiPopupMenu` which is 16 bytes and the actual alignment
returned by the `MEM_mallocN()` which is 8 bytes due to the memory
head.

Now made it so that `MEM_new()` can be used for types with any
alignment.

Differential Revision: https://developer.blender.org/D16375
2022-11-03 14:32:04 +01:00
a16dd407b3 Revert "Blender 3.4 - Beta"
This reverts commit 666135c32a.
2022-11-03 10:12:46 +01:00
31c52bc34e Merge branch 'blender-v3.4-release' 2022-11-03 10:12:17 +01:00
ba8754cf11 Blender 3.5 Alpha: Start of new release cycle. 2022-11-03 10:11:13 +01:00
666135c32a Blender 3.4 - Beta
* BLENDER_VERSION_CYCLE set to beta
* Update pipeline_config.yaml to point to 3.2 branches and svn tags
* Update and uncomment BLENDER_VERSION in download.cmake
2022-11-03 10:08:10 +01:00
d5ce854fb1 CMake: workaround unsupported cmake_path(IS_PREFIX ..) in v3.20
Add a macro that implements something similar to cmake_path's IS_PREFIX
which isn't supported in older versions of CMake.

This caused the build-bot to fail.
2022-11-03 16:57:38 +11:00
65e4d169ba BLI_path: skip "/./" and "/." in BLI_path_name_at_index
This avoids having to run BLI_path_normalize before calling
BLI_path_name_at_index.
2022-11-03 15:33:08 +11:00
31d43cb0e7 Update RNA to User manual mappings 2022-11-03 00:32:22 -04:00
50c72069b4 Cleanup: replace BLI_join_path with BLI_join_string
There is no need to use path joining logic here.
2022-11-03 14:38:15 +11:00
92b2f4d249 BLI_string: C++ support for string joining macros
C++ doesn't support taking the temporary address of a temporary array,
use inline functions instead.

Also change array joining functions to return the length of the string
instead of returning the pointer (matching BLI_path_join).
2022-11-03 14:32:50 +11:00
5ba045af7b PyDocs: Upgrade Theme to 1.1.0
Updates to kbd and breadcrumbs along with some fixes to API docs that should'nt affect us.
2022-11-02 22:37:39 -04:00
ea94d5723f PyDocs: Upgrade Sphinx to 5.3.0
Trivial changes, should not affect us in anyway.
2022-11-02 22:35:42 -04:00
bb0b04f43a UI: Bevel: Specify the width type as "Width Type" in the status bar.
Part of T102224
2022-11-02 22:14:19 -04:00
6377d00a61 Cleanup: cmake comment line length 2022-11-03 12:11:08 +11:00
b320597697 Tests: don't create byte-code cache when calling Python from SVN
Creating `__pycache__` directories in SVN's lib/ directory can cause
updating SVN to fail. Add the -B flag when TEST_PYTHON_EXE from LIBDIR
is used so so Python doesn't generate this cache.
2022-11-03 11:51:52 +11:00
bad55d56bc Mesh: Parallelize remesh reprojections
In high poly meshes the reprojections after remesh can become slow.
This parallelizes reprojection of face sets, paint mask and vertex paint.
It also adds flags to disable dependency graph updates on
setting remesh options to remove UI lag.

Profiling of remeshing a 3.4M poly mesh (in sculpt mode):
Before: 19.6s
After: 8.7s

Differential Revision: https://developer.blender.org/D15638
2022-11-02 23:23:20 +01:00
a38b98478a Fix empty menu title in some menus (e.g. Text Editor context menu) 2022-11-02 18:01:18 +01:00
15fe7f3d93 Fix arrow key menu navigation using wrong direction
Steps to reproduce were:
* Right click in 3D View (context menu) press up or down arrow.

Or:
* Ctrl+Shift+O (Open Recent menu) press up or down arrow.
2022-11-02 17:57:36 +01:00
31746e1baa Fix memory leak with Freestyle renders after recent changes
Render stored a shallow copy of the scene view layers and views for thread
safety, without proper functions to free it. But with the CoW depsgraph this
scene is already a copy of the original and an additional copy is not needed.

Refactor to use the scene view layers and some other settings directly instead
of making a copy.
2022-11-02 17:16:50 +01:00
07ef428c6c Cycles: Add regression test for util_md5_string 2022-11-02 16:30:13 +01:00
38c7fd36ff Refactor: Rename Object->imat to Object->world_to_object
The goal is to improve clarity and readability, without
introducing big design changes.

Follows the recent obmat to object_to_world refactor: the
similar naming is used, and it is a run-time only rename,
meaning, there is no affect on .blend files.

This patch does not touch the redundant inversions. Those
can be removed in almost (if not all) cases, but it would
be the best to do it as a separate change.

Differential Revision: https://developer.blender.org/D16367
2022-11-02 15:42:23 +01:00
0fc958a174 Fix: Crash adding rest positions to empty mesh
The position attribute might not exist when the mesh is empty, which may
be another problem, but there is no need to count on it here.
2022-11-02 13:59:31 +01:00
bc8b15f1a5 Realtime Compositor: Move shaders to compositor module
This patch moves the GLSL shaders and their infos to the compositor
module as decided by the EEVEE & Viewport module. This is a non
functional change.

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

Reviewed By: Clement Foucault
2022-11-02 13:55:23 +02:00
c394f510a5 Realtime Compositor: Make vectors four dimensional
Currently, the realtime compositor treat vector types as 3D vectors,
which is true for most operations. However, some operations deal with
vector types as 4D vectors that encode two 2D vectors or one 3D vector
with the last component ignored. So this patch expands vector types to
include a fourth component that is only sometimes used.

Since we already stored vectors in RGBA textures, the necessary changes
are straightforward and are mostly concerned with adjusting the Result
class.

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

Reviewed By: Clement Foucault
2022-11-02 13:48:20 +02:00
Csaba Boncsér
14e4c96b64 Nodes: Reuse input sockets when creating new node groups
**Problem**
Currently multiple input sockets are created when a new node group is
made from selected nodes. Some of these are linked from the same source.
It is not convenient to sort out and remove multiple input sockets that
represent the same input. These inputs usually have meaningless names
like 'value', 'x', etc.

**Solution**
Create common input sockets for each link starting from the same input.
Move links inside the new group's node tree and reroute it to connect
the common input socket to the original nodes. This is done by building
up a mapping between the incoming link sources to the input interfaces
created for them. The input interfaces are reused by the rest of the
links having the same source.

This patch also changes the way the input sockets get their names.
Output socket names of the group nodes usually are specific and are
given consciously. Use the output socket names from group nodes instead
of the inputs where the links point to.

Differential Revision: https://developer.blender.org/D15802
2022-11-02 12:34:22 +01:00
5f7ca5462d Geometry Nodes: Add index and value inputs to sample curve node
As described in T92474 and T91650, this patch adds two features to the
sample curve node. First is an index input, to allow choosing the curve
to sample for each point. Second is a custom field input, which is
evaluated on the control points of the curve and then sampled like the
other outputs. There is an "All Curves" option for the old behavior
which takes the length of all curves into account.

For invalid curve indices, the node outputs zeros (default values).
Invalid lengths and factors are clamped.

There have been various discussions about splitting the node up more,
but this is an intuitive combination of options and will work well
enough for current use cases. The node could still be generalized more
in the future.

Keep in mind that the source field is evaluated on curve control points,
not the evaluated points used for sampling. This is necessary so that
fields like "Index" work as expected.

Differential Revision: https://developer.blender.org/D16147
2022-11-02 12:34:22 +01:00
460c9d3d92 Fix use-after-free in asset library storage destruction
Would only appear when more than 4 asset libraries were loaded, because
small buffer optimization would hide the issue.
2022-11-02 11:56:50 +01:00
638bf05a23 Fix BLI_path_parent_dir returning success with a single period as input
While relatively harmless, BLI_path_parent_dir wasn't returning failure
when passed in "./" which wouldn't succeed.

Instead of adding a ".." and normalizing, normalize the path and remove
the last directly. This is simpler than inspecting the resulting path
to see if normalize removed it or not.

Add additional tests which failed previously.
2022-11-02 17:17:28 +11:00
7f1e98839a Tests: enable path tests for WIN32
Tests for BLI_path_normalize, BLI_path_parent_dir & BLI_path_rel
were disabled on WIN32 because of complications with slash direction.

Enable these tests using character replacement to manipulate test data.
2022-11-02 16:15:48 +11:00
52664437fb Cleanup: use doxy sections for path tests 2022-11-02 14:28:00 +11:00
db43aa7729 Fix T102201: File selector shows "\" before folder names on WIN32
Regression in [0] on WIN32 caused joining paths {"//", "path"} to
result in "//\path".
This made the file selector show paths with a "\" prefix.

Add an exception for WIN32 where an initial path of forward slashes
is joined without a back-slash.

[0]: 8f7ab1bf46
2022-11-02 14:11:46 +11:00
5a90bbf716 Cleanup: format 2022-11-02 11:20:06 +11:00
889b3385b5 Cleanup: spelling in comments 2022-11-02 10:18:19 +11:00
cc6f41f8a5 Fix BLI_path_parent_dir failing on paths ending with ".."
The check for BLI_path_normalize having succeeded only checked for a
trailing "../" which isn't correct. This caused going up a directory
in the file selector to do nothing on directories ending with "..".

This also caused an empty path to expand into "../" because
BLI_path_extension_check didn't account for this case.

Resolve using BLI_path_name_at_index which extracts the last component
of the path without having to match the the surrounding slashes.
2022-11-02 07:21:10 +11:00
12f4ac1706 Fix BLI_path_normalize failing with "." and ".." in the path
The logic to go up a directory (using "..") ran before stripping "/./"
from the path. This caused "/a/b/./../" to result in "/a/b/"
instead of "/a/". Now redundant characters are removed before before
checking for ".." in paths.

Include test to ensure this works as expected.
2022-11-02 07:21:10 +11:00
513dfa179f Tests: add BLI_path_parent_dir tests, split BLI_path_normalize tests
Also enable a test that was disabled with a fix FIXME comment but works.
2022-11-02 07:21:10 +11:00
f8699881d6 CMake/MSVC: Disable ASAN for developer builds
ASAN is more often broken than working depending on the MSVC version
you have. As it is causing too many support incidents of people that
unknowingly turned ASAN on by running `make developer` and running
into issues starting blender due to the broken ASAN support in MSVC.

This commit changes the default not enable it for MSVC in the
developer profile. Devs that still want to enable it can do so though
turning WITH_COMPILER_ASAN on in their CMakeCache.txt or by running
`make developer asan`
2022-11-01 12:46:15 -06:00
f66236a827 Fix T102018: find HIP library also in system library paths on Linux
Previously it would use a hardcoded location where the AMD driver installs it,
but Linux distributions may use other locations. Now look for both cases.
2022-11-01 18:36:45 +01:00
518d7dbebb UI/Nodes: Update node add menu as assets get loaded
Adds a listener to the node add menu so that it refreshes as assets get
loaded asynchronously.

Followup to cf98518055, also see 99e5024e97 and the previous commit.
2022-11-01 17:43:55 +01:00
78a7d5cfcc UI: Support C defined menu types to listen to notifiers
Needed to dynamically load assets as menu items, see cf98518055 and
99e5024e97. The next commit will add the listener for the node add menu.
2022-11-01 17:43:38 +01:00
bcc2656299 USD IO: replace deprecated primvars API.
Updated the code to use the UsdGeomPrimvarsAPI class to read
and write mesh primvars instead of the now deprecated primvars
accessors in UsdGeomImageable.  This will be required to build
with USD 22.11 in the future, where the deprecated functions
have been removed.
2022-11-01 11:55:58 -04:00
99e5024e97 UI: Support refreshing menu popups
This allows us to asynchronously load items into the menu, see
cf98518055. All menus spawned from Python using the `wm.call_menu`
operator will be affected by this. We could avoid that and only refresh
the menu we need to, but it's worth trying to get this to work as a
general menu feature.

This is a slightly risky change, so keeping an eye open for bugs.
2022-11-01 16:45:31 +01:00
cf98518055 Nodes: Add node group assets in add menu
This patch builds on the work from bdb5754147 to add node group
assets directly in the node editor add menu. Assets are added after
separators to distinguish them, but otherwise they look like any other
node. The catalog trees from all configured libraries are used to build
the menu hierarchy. Only catalogs with matching asset types are used
though.

There are a few limitations of this initial version. For now this only
supports geometry nodes. Support for other built-in node systems just
requires some refactoring of the corresponding add menu though. Lazy
loading will be added in a followup commit. For now there is a label
the first time the menu is opened.

Like the search menu integration, re-saving asset library files in 3.4
is required, if it hasn't been done already.

Implementation wise, there is a some ugly code here. A lot of that is
because the asset system isn't complete. The RNA API doesn't work well
yet, and the system isn't built to interact with multiple libraries at
once. It's also ugly because of the way we combine automatic menu
generation with builtin menus. As noted in a code comment, these two
systems could be merged completely so that the menus for builtin nodes
are also generated in the same way.

Differential Revision: https://developer.blender.org/D16135
2022-11-01 16:09:58 +01:00
e6823f32e9 USD tests: replace deprecated imaging code.
UsdImagingCapsuleAdapter static functions GetMeshPoints() and
GetTopology() have been removed in USD 22.11.  In anticipation
of this upcoming change, I've updated the test code to call
the corresponding virtual functions instead.
2022-11-01 10:32:36 -04:00
108b3ee33e Cleanup: Use bool for binary (true-ish/false-ish) return value 2022-11-01 15:19:49 +01:00
4269559215 Build: bump expat version to 2.5.0 to address CVE-2022-43680 2022-11-01 14:35:21 +01:00
3f91540cef Fix T101062: sculpt curves crash using a paintcurve brush
For one, paintcurves were not considered in curves sculpt mode at all
(so you couldnt draw them). This is now enabled.

And the second issue was that since curves sculpt mode uses the reguar
paint_stroke_modal() [which handles paintcurves], this was actually
excuted, freeing the PaintStroke from SculptCurvesBrushStrokeData (but
not the CurvesSculptStrokeOperation) and immediately return
OPERATOR_FINISHED from modal (resulting in a double MEM_delete of
SculptCurvesBrushStrokeData -- in both invoke and modal).

There might be better ways to handle the memory free, for now the double
freeing is prevented by setting the operator customdata to NULL (and
check for that later).

Maniphest Tasks: T101062

Differential Revision: https://developer.blender.org/D16099
2022-11-01 12:19:14 +01:00
3136fb886e Command line: Tweaked doc of --gpu-backend.
There was a trailing ')' without any '(' in the generated
documentation.
2022-11-01 11:45:17 +01:00
d2406ad17d Update OCLOC version used on Windows
This only affects Windows since Linux uses pre-compiled
OCLOC version.
2022-11-01 11:28:46 +01:00
f17fbf8065 Refactor: Rename Object->obmat to Object->object_to_world
Motivation is to disambiguate on the naming level what the matrix
actually means. It is very easy to understand the meaning backwards,
especially since in Python the name goes the opposite way (it is
called `world_matrix` in the Python API).

It is important to disambiguate the naming without making developers
to look into the comment in the header file (which is also not super
clear either). Additionally, more clear naming facilitates the unit
verification (or, in this case, space validation) when reading an
expression.

This patch calls the matrix `object_to_world` which makes it clear
from the local code what is it exactly going on. This is only done
on DNA level, and a lot of local variables still follow the old
naming.

A DNA rename is setup in a way that there is no change on the file
level, so there should be no regressions at all.

The possibility is to add `_matrix` or `_mat` suffix to the name
to make it explicit that it is a matrix. Although, not sure if it
really helps the readability, or is it something redundant.

Differential Revision: https://developer.blender.org/D16328
2022-11-01 10:48:18 +01:00
8b2b5b0b83 Fix compilation error on Windows.
Missing return statement in recent commit. Code is disabled by default,
so might not have been noticed.
2022-11-01 09:20:42 +01:00
fe863b59db Fix T102194: unhandled number keys on AZERTY layout under Wayland
Support layouts such as AZERTY where the shift key is held for number
keys. Text entry remains unchanged but these keys now activate shortcuts
as expected.

This matches a fix in X11 for the same problem: T47228.
2022-11-01 14:28:54 +11:00
4d139601ba CMake: mark Wayland variables advanced 2022-11-01 12:48:57 +11:00
afc091c3c4 Cleanup: spelling in comments 2022-11-01 12:24:58 +11:00
ef76a67153 Cleanup: doxy comment formatting 2022-11-01 12:24:04 +11:00
4d78211070 Cleanup: disambiguate naming for Wayland surfaces
Name surfaces for their use.
2022-11-01 11:32:17 +11:00
409070e0d4 GHOST/Wayland: support for multiple seats (one active seat at a time)
This isn't full multi-seat support, instead set the active seat using
pointer/tablet & keyboard enter handlers.

This means that seats beside the first aren't prevented from having
their events handled.
2022-11-01 11:32:17 +11:00
c3e4fa7404 Cleanup: fix translation for rare UV unwrapping with unit scale
Fixes very rare cases where the UV Cylinder Project, UV Sphere Project
and UV From View might not set the translation correctly if the scale
is exactly 1.0.

Mainly fixed because this code might later be reused elsewhere.
2022-11-01 12:50:16 +13:00
5016a8687c deps: openPGL 0.4.1-beta 2022-10-31 16:37:09 -06:00
a8ce926eaa Build: ignore more CVEs from tiff command line tools that we don't use 2022-10-31 20:05:11 +01:00
c082b088ab Fix bpy wheel on buildbot being incomplete on Windows
Need to explicitly install __init__.pyd for the case where the install
folder is different than the build folder.
2022-10-31 19:56:59 +01:00
8bddbc9a94 Fix bpy wheel build error on Windows, where there are no abi flags 2022-10-31 19:33:17 +01:00
6a3af76fbe Geometry Nodes: Use attribute API in deform curves on surface node
Retrieve the surface UV coordinates with the attribute API instead of
the helper function. This allows more flexibility of data types (and
domains), which is helpful especially because geometry nodes
can't write 2D vectors yet.
2022-10-31 19:09:25 +01:00
c39eb09ae5 Nodes: Improve socket node lookup performance
Use the newly added node topology cache to find the node that contains
a socket rather than looping through all nodes every time. The change
improves performance of drawing a some large node trees by 2-3x.
2022-10-31 16:32:32 +01:00
Jeroen Bakker
0e6f2d9fe0 GPU: Add placeholder for Vulkan backend.
This patch adds a placeholder for the vulkan backend.
When activated (`WITH_VULKAN_BACKEND=On` and `--gpu-backend vulkan`)
it might open a blender screen, but nothing should be visible as
none of the functions are implemented or otherwise crash on a nullptr.

This is expected as this is just a placeholder. The goal is to add shader compilation
+validation to this backend as one of the next steps so we can validate
changes to existing shaders on OpenGL, Metal and Vulkan at the same time.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D16338
2022-10-31 16:01:15 +01:00
c2e36c09b9 Fix variable value assigned twice in succession
Error introduced in rBa7aa0f1a0c24

Mentioned in https://pvs-studio.com/en/blog/posts/cpp/1004/

It could cause the absolute snap to the y direction to fail in
some editor.
2022-10-31 06:54:17 -03:00
511ae22264 BLI_path: only operate on native path slashes for BLI_path_name_at_index
Prefer using the native path separator for low level path functions.
2022-10-31 13:21:24 +11:00
8f7ab1bf46 BLI_path: only operate on native path slashes for BLI_path_join
Previously both slashes were considered when joining paths, meaning
slashes that were part of the path name could be stripped before joining
the path.

Prefer using the native path separator for low level path functions,
callers can always convert slashes into the expected direction if they
need. This also matches BLI_path_append behavior.
2022-10-31 13:04:30 +11:00
fe5cbd5eea make_update: support updating "lib" as a single repository
With a full SVN checkout of "../lib", updating all paths is slower
than running an update on the whole repository at once.

Also collect paths and run the update in separate passes, this avoids
some duplicate checks such as checking the svn command exists.
2022-10-31 12:57:17 +11:00
5042f895ce make_update: add type hints 2022-10-31 12:54:36 +11:00
06abc9509d Cleanup: quiet warning building with MSVC (_CONCAT redefined)
This is defined by a system header (xatomic.h) with MSVC.
2022-10-31 11:15:38 +11:00
8c6d4aa103 Fix T102126 Regression: Grease Pencil: Broken 2D Layering
This was because `stroke_id` was not using `vertex_start`.
But since `vertex_start` is not 1 based like it used to be, we need to add
1 to it to avoid a fragment depth of `0.0` which would be equal to the
background and not render.
2022-10-30 17:31:01 +01:00
da365bc2ad Fix T102163: GPencil:Set start point Operator make stroke deleted
There were two problems:

* The stroke was deleted if the last point was selected. Now
the stroke is flipped because is faster.

* If the second point was selected, the first point was removed
because the internal api, removed one point strokes by
default.  This was done becaus ethe tools that used this API
did not need one point strokes as result. Now this optional 
and keep one point strokes.
2022-10-30 16:15:23 +01:00
77749eff87 DRW: Manager: Add possibility to record a framebuffer change inside a pass
This is a convenience when one needs to often change the current framebuffer
and avoid the overhead of creating many Main/Simple passes.
2022-10-30 15:00:28 +01:00
486e281644 Fix T102160: Regression: GPencil gradient fill not working
Was caused by uvs not being sourced from the correct buffer.
2022-10-30 13:00:38 +01:00
117e17fb22 DRW: Manager: Allow custom draw command in PassMain
This allows using drawcalls with non default vertex range.
These calls will be culled like any other instance by the GPU culling
pipeline. But they will not be batched together since the vertex range
is part of the group.
2022-10-30 12:36:33 +01:00
9bd38750b3 Cleanup: replace BLI string copy & append with BLI_path_join(..)
Copying and appending is unnecessarily verbose with each call having to
pass in the buffer size.
2022-10-30 15:56:28 +11:00
5392f220f0 BLI_path: add BLI_path_append_dir (appends and ensures trailing slash)
Avoid copying the string then calling BLI_path_slash_ensure afterwards.
2022-10-30 15:56:23 +11:00
d66f24cfe3 Fix potential buffer overflow with BLI_path_slash_ensure use
BLI_path_slash_ensure was appending to fixed sized buffers without
a size check.
2022-10-30 15:34:02 +11:00
5d77c3a6a5 Fix T102132: Directory selection fails to add trailing slash
Regression in [0], accessing the path from the file selector relied on
BLI_join_dirfile adding a trailing "/" when the filename was empty.

[0]: 9f6a045e23
2022-10-30 15:24:41 +11:00
d1d2f002c7 make.bat: skip SVN update when running make code_update
regression from rB116d7b0042bba7d6cabd8e04c7d020ac3816caf3
2022-10-29 11:25:33 -06:00
78fe6d7ab1 NLA: Push down Action names the Track after the Action
When pushing down an Action to a new NLA track, the track is now named
after the Action.
2022-10-29 17:08:12 +02:00
2c9fe719e6 Cleanup: use STREQ macro 2022-10-29 12:07:42 +11:00
Damian Trebilco
f9113b7eb6 Cycles: add Equiangular Cubemap Face camera projection
This can be used for example for VR video formats that use this projection
instead of perspective projection for cubemap faces.

Differential Revision: https://developer.blender.org/D13525
2022-10-28 16:24:03 +02:00
105c8d59cd Cleanup: format 2022-10-28 17:06:21 +11:00
d799388b02 Cleanup: quiet unused argument warnings and minor changes in GHOST 2022-10-28 17:05:13 +11:00
bb16a3af7f Fix error in leaving the tablet pointer set under Wayland
Missed clearing the tablet pointer after updating removing the tablet
manager.
2022-10-28 17:03:39 +11:00
af761021a3 GHOST/Wayland: code-comments
Note issues with track-pad event handling, add some other notes too.
2022-10-28 13:08:41 +11:00
48d8aa7484 Fix failure to clear DND in_use in rare cases under Wayland
If opening a pipe failed, 'data_offer->dnd.in_use' wasn't cleared.
Avoid early return where it duplicates logic in an error prone way.
2022-10-28 12:37:44 +11:00
586d9214b7 Cleanup: use common prefix for static ghost/wayland variables
File level static variable names weren't well distinguished from others.
Use `ghost_wl_` prefix for static variables.
2022-10-28 12:21:42 +11:00
18e0f741c8 GHOST/Wayland: improve code-comments 2022-10-28 12:16:25 +11:00
d447cf9704 Cleanup: use plain 'char *' for mime types in GHOST/Wayland
There wasn't much advantage in using C++ native types as all Wayland
API's deal with C strings.
2022-10-28 12:12:07 +11:00
00533de7d5 Cleanup: move GWL_DataOffer in_use to the 'dnd' struct
It wasn't clear that this is only used for drag & drop,
also don't use an atomic type as all access is guarded by the
drag & drop mutex.
2022-10-28 11:15:25 +11:00
d488a87d70 GHOST/Wayland: postpone reading from the clipboard until needed
A copy of the clipboard was always being, changes would re-read it.
Now read the clipboard on request. This avoids having to keep a copy
of the clipboard in memory as well as the need to keep a thread
to running to read the clipboard for each data-offer.

To prevent a deadlock when pasting from Blender's own clipboard.

- Sending the clipboard (using write(..)) runs in a background thread.
- Reading the clipboard uses a thread that performs round-trips to the
  Wayland server to prevent until the read is complete.

This is an update to [0] that resolves the deadlock.

[0]: c03838dbc8
2022-10-28 10:23:29 +11:00
b544d989d1 GHOST/Wayland: unlock clipboard mutex on failure
When the Wayland pipe can't be opened, don't leave the mutex locked.
Also skip checking wl_data_device_manager when reading from the primary
clipboard.
2022-10-28 09:32:03 +11:00
454dd3f7f0 Cycles: fix up logic in oneAPI devices filtering
CYCLES_ONEAPI_ALL_DEVICES environment variable wasn't working as
intended after 305b92e05f.
2022-10-27 23:09:14 +02:00
Anton Raves
7c3cd63f95 Fix T102085: X11 Startup crash
wl_registry_destroy does not enjoy being fed a null pointer.
Added a null check to keep it out of trouble.
2022-10-27 13:29:03 -06:00
c967bdcbb1 GPencil: Fix MSVC warning in lineart_cpp_bridge.cc
MSVC give a rather large warning when using blender::parallel_sort
without using a lambda for the comparison.

Fixed by using a lambda
2022-10-27 09:16:51 -06:00
2625c39ce7 Fix T102092: GPencil Sculpt Grab crash using Shift key
There was a problem with the hash table that was 
not created as expected.

Also fixed an unreported memory leak in Grab tool not
related to this crash but detected during debug.
2022-10-27 16:47:02 +02:00
e75be000e3 GHOST/Wayland: replace deferred registration with an update callback
There were two issues caused by deferred registration (added by [0]),
one crash on startup (T102075), another unreported issue with the GLX/EGL
context failing to initialize. Unfortunately I'm unable to reproduce the
errors but it seems likely deferring interface registration is not well
supported so this commit uses an alternative solution to some interfaces
depending on others for initialization.

Instead of relying on the order of registration, a separate "update"
callback has been added which is called after binding interfaces.
This has the advantage that it can be called when adding/removing
interfaces at run-time to avoid the dangling pointers being left in
locally allocated structures. In practice adding/removing interfaces
happens so rarely (only with "outputs" as far as I'm aware) that this
benefit is theoretical at the moment.

This should resolve T102075.

[0]: 9fe9705bc0
2022-10-27 19:23:46 +11:00
1e7776907c Fix T101925: sculpt color painting not updating with Cycles viewport render
* External engines do not use the PBVH and need slower depsgraph updates.
* Final depsgraph tag after stroke finishes was missing for sculpt color
  painting, caused missing updates for other viewports as well as any
  modifiers or nodes on other objects using the colors.
2022-10-26 19:59:55 +02:00
0385e4df3c Fix slow continuous depsgraph updates in sculpt paint mode in some cases
Updates for cursor could cause the paint data to be continuously refreshed,
which is pretty cheap by itself, but not when it starts tagging the depsgraph.

The paint slot refresh code ideally should not be doing depsgraph tags at all,
but checking if there were changes at least avoids continuous updates.
2022-10-26 19:59:55 +02:00
1840f44666 Fix build error on Windows without precompiled headers
Recent refactoring to use uint relied on indirect includes and precompiled
headers for uint to be defined. Explicitly include BLI_sys_types where this
type is used now.
2022-10-26 19:59:55 +02:00
bc7de854c9 Sculpt: fix T102067: Set material properly in new pbvh draw
Note: Still need to fix PBVH_BMESH.
2022-10-26 19:01:43 +02:00
414d5429fe Cycles: oneAPI: update dg2 target to acm-g10
Reverting 63aec82e8a since IGC dependency
now supports acm-g10 target.
2022-10-26 18:30:48 +02:00
ff89c1793d Cycles: List Level-Zero in oneAPI device requirements in the UI on Linux
Intel documentation for Ubuntu 22.04 does list all runtime components
needed by the driver and oneAPI Cycles device but end-users getting
drivers from (other) sources can easily end-up missing required
Level-Zero Loader and struggle root causing what's wrong in their
system. Calling this requirement out in the UI will hopefull help them.

oneAPI Level-Zero incl. Loader: https://github.com/oneapi-src/level-zero
Common package names: level-zero, level-zero-loader
2022-10-26 14:13:18 +02:00
4b14b33ea8 Cycles: use packed float3 back for oneAPI
This fixes a 15% performance regression silently introduced by
79ab76e156 that aligned the compact
float3 on 16 bytes for oneAPI.
Current change is minimalist, there are further cleanup opportunities
such as removing packed_float3 definition for oneAPI but for some
reason, it cuts the recovered speedup in half, so we're starting with
this small fix for now.

Reviewed by: brecht

Differential Revision: https://developer.blender.org/D16340
2022-10-26 10:53:23 +02:00
633d314b75 Fix T101790: MNEE caustic settings are not visible in the UI when using Metal
This patch fixes T101790 by adding a macOS version check for deciding whether to show the caustics settings in the UI  (MNEE kernels don't compile on macOS < 13.0)

Reviewed By: brecht

Maniphest Tasks: T101790

Differential Revision: https://developer.blender.org/D16339
2022-10-26 09:36:07 +01:00
16acd7e473 Fix: set more UI colors to PROP_COLOR_GAMMA
Followup to rBfb424db2b7bb. Found some more candidates.

UI colors should use PROP_COLOR_GAMMA to avoid being affected by scene
color management (clarification by @brecht).

Differential Revision: https://developer.blender.org/D16337
2022-10-26 09:11:17 +02:00
2186d58d1c Fix T102045: Properties Editor Attribute panels errors when pinning mesh
When pinning a Mesh, we cannot rely on the context object.
Instead, use the context mesh now.
For vertexgroups names [which are still on the object API wise], this
means name collisions cannot be checked when pinning a Mesh (so print
this as a warning in that case)

Maniphest Tasks: T102045

Differential Revision: https://developer.blender.org/D16333
2022-10-26 09:10:50 +02:00
49cd04044a Revert "GHOST/Wayland: postpone reading from the clipboard until needed"
This reverts commit c03838dbc8.

Pasting from Blender's own clipboard locked the process.
This needs furhter investigation.
2022-10-26 15:44:31 +11:00
c03838dbc8 GHOST/Wayland: postpone reading from the clipboard until needed
A copy of the clipboard was always being, changes would re-read it.
Now read the clipboard on request. This avoids having to keep a copy
of the clipboard in memory as well as the need to keep a thread
to running to read the clipboard for each data-offer.
2022-10-26 14:15:00 +11:00
4046d9a384 Cleanup: remove GWL_RegisteryAdd_Params.wl_registry
No longer needed now GWL_Display holds a reference to the registry.
2022-10-26 12:18:46 +11:00
e844f706fb GHOST/Wayland: support device add/removal at runtime
Keep the registry listener active at runtime, now plugging/unplugging
monitors at run-time is detected and the associated data stored by
Blender is added/removed as well.

Previously all interfaces were detected at startup, afterwards no
changes were supported.
2022-10-26 12:11:44 +11:00
9fe9705bc0 GHOST/Wayland: use a predictable order for interface registration
Defer interface registration so all known interfaces can be called in
the order defined by the array of supported types.

Without this, the compositor defined the order of registration so it
wasn't possible to rely on registration functions to depend on other
interfaces.

This caused initialization for 'seats' to be moved out of the
register callback to ensure multiple interfaces were initialized.
This isn't good for readability or maintenance since it meant the
add/remove callbacks didn't act on matching data.
2022-10-26 12:11:44 +11:00
14c218b3fd deps_builder: fix hardcoded path
the windows builder has 2 different build folders for the debug and
release libs, hardcoding the path like this leads to an extra 1GB
of downloaded files. The windows builder supplies a single PACKAGE_DIR
for both but gets ignored.

This change promotes PACKAGE_DIR to be cached in CMakeCache so it can
be changed if needed.

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

Reviewed by; brecht, dfelinto
2022-10-25 17:00:48 -06:00
4a87f8107e Cleanup: format 2022-10-26 09:33:22 +13:00
9d18874083 Fix window flickering when moving windows between monitors in Wayland
Moving widows between monitors with different scale set could flicker
in a feedback loop because the bounds of the window resizing could
cause the bounds of the windows to overlap different monitors.

Now the window is resized immediately, instead of letting the change
to the windows surface scale resize the window.
2022-10-26 02:01:01 +11:00
7da85ea35a Fix Cycles build error on 32bit x86 2022-10-25 16:56:35 +02:00
601995c3b8 Cleanup: Curves: Remove GPUTexture wrappers for buffer texture
These are unecessary now that we can bind buffers as textures directly.
2022-10-25 16:44:21 +02:00
7522c05076 Fix T102052 GPencil: stroke outline glitches in object mode
Was caused by an extra point per stroke being drawn.
2022-10-25 16:12:17 +02:00
ffdb41a8bc DRW: Pointcloud: Refactor drawing to remove instancing
This change the attribute binding scheme to something similar to the
curves objects. Attributes are now buffer textures sampled per points.

The actual geometry is now rendered using an index buffer that avoid too
many vertex shader invocation.

Drawcall is wrapped in a DRW function to reduce complexity of future
changes.
2022-10-25 15:50:13 +02:00
fb424db2b7 Fix T99603: node body colors colormanagement issue
This led to the color actually looking different on the node body itself
vs. in the panel, also using the colorpicker gave unexpected results.

UI colors should use PROP_COLOR_GAMMA to avoid being affected by scene
color management (clarification by @brecht).

Maniphest Tasks: T99603

Differential Revision: https://developer.blender.org/D16334
2022-10-25 14:06:02 +02:00
2240ca3e7b Fix T101933: pick deselecting bones in empty space deactivates armature
As a consequence of this, subsequent box-selection of bones would not
show correctly in Animation Editors (not showing the channels there
because of the lack of an active object).

The bug was caused by rBba6d59a85a38.
Prior to said commit, code logic was relying on the check for `basact`
being NULL to determine if object selection changes need to happen.
After that commit, this was handled by a `handled` variable, but this
was not set correctly if `basact` is actually NULL after the initial
pick (aka deselection by picking).

Maniphest Tasks: T101933

Differential Revision: https://developer.blender.org/D16326
2022-10-25 13:42:23 +02:00
78b13ab3db Fix T102048: Tablet cursor remains hidden under KDE/Wayland 2022-10-25 22:27:12 +11:00
c4f9e4afab GHOST/Wayland: swap tablet middle/right mouse buttons
There looks to be an inconsistency between Gnome/KDE here,
match KDE and Gnome applications under X11 (even XWayland)
by making the button closest to the nib MMB, and the other button RMB.
2022-10-25 20:42:46 +11:00
7e3e4751b5 UI: Fix count on node editor/group header when fake user
The number of node groups was including the fake user count.
I was ignoring the Fake User, and how it affects the id->us count.

This problem was present since the initial commit: 84825e4ed2.
2022-10-25 10:15:24 +02:00
3e292404d2 Build: fix/workaround for the opencollada.diff not applying on Linux 2022-10-25 17:51:30 +11:00
059d963192 GHOST/Wayland: store fractional scaling in each window instead of DPI
This makes it possible to access the fractional scaling for a window,
there is no need to store the DPI which can be returned by getDPIHint().
2022-10-25 15:56:09 +11:00
dd08b490af Cleanup: move singleton pointers into the system
Avoid top level global pointers, remove the window_manager pointer
and move the clipboard mutex along side the clipboard data.

Also skip updating window DPI if the window doesn't use the output
that changed it's scale.
2022-10-25 15:00:03 +11:00
71079d49e2 Cleanup: move ghost/wayland local methods after type declarations
Also correct prefix naming.
2022-10-25 15:00:02 +11:00
bf0ae05d25 Fix T82412: Space-mouse not registering (WIN32)
Using the 3DConnexion Universal Wireless Receiver on MS-Windows caused
a different ID to be reported. While I'm not sure of the cause of this,
adding the ID doesn't conflict with other devices and fixes the problem.
2022-10-25 13:37:38 +11:00
c1768507a9 Correct naming in 97414fb484 2022-10-25 13:24:56 +11:00
97414fb484 GHOST/Wayland: support adding/removing global objects at runtime
Share logic for adding/removing global objects and freeing them on exit.

Refactor object registration add/remove into an array of callbacks
to localize logic into generic functions for each kind of interface.

Also corrects own error where the primary clipboard manager wasn't
being destroyed on exit.
2022-10-25 13:06:07 +11:00
5d5e0f1b0e GPencil: Fix crash when using circle or rectangle tool
This was caused by a wrongly sized vertex buffer for the stroke buffer.
2022-10-24 21:44:57 +02:00
e2d06eb68a GPencil: Fix missing fills
For some reason stroke_id needs to be the triangle index, not the vertex
index.
2022-10-24 21:44:57 +02:00
954b834053 Fix T102015: AV1 - No valid formats found
I did a poor master merge in D14920 before landing and AV_CODEC_ID_AV1
accidentally ended up in `ffmpeg_format_items` rather than
`ffmpeg_codec_items`
2022-10-24 12:03:41 -06:00
583ae0caaa VSE: Don't use timecodes if not explicitly enabled
UI panel may suggest, that disabling "Proxy & timecode" would cause
timecodes not being used, but this was not the case. Now timecodes will
be used only if the checkbox is checked.
2022-10-24 20:02:32 +02:00
4e9a8109b2 Fix T100571: Subdivision disabled with Orbit Around Selection
The bug has existed since crasy space was implemented.

rBbf8a26b7453d made the error even worse as the
`modifiers_disable_subsurf_temporary` function, which works like a
toggle, did not temporarily re-enable subsurf.

The main problem is that the derived mesh is modified but not marked as
dirty at the end.
2022-10-24 14:59:00 -03:00
a67876103a Fix T101981: Incorrect playback of AVI files
Commit bcc56253e2 introduced 3 frame negative offset for seeking. This
can result in negative seek values.

Ensure, that seek value is always positive.
2022-10-24 19:46:42 +02:00
5379587772 Fix T101210: invalid internal node links lead to crash
Internal links are run-time/derived data. Therefore it is not necessary
to load them from .blend files where invalid internal links may be stored.
They will be regenerated after a node tree is loaded anyway.
2022-10-24 19:01:14 +02:00
63675b8d70 GPencil: Fix regression (part3) with edit mode introduced in rB0ee9282b5c51
Vertex indexing has not been updated and stroke_start usage was wrong.
Update all `stroke_start` usage.
2022-10-24 18:19:23 +02:00
8dd7b5b26b Cycles: Metal integrator state size tuning
This patch tunes the integrator state sizing for Metal (`num_concurrent_states` and `num_concurrent_busy_states`).

On all GPUs architecture, we adjust the busy:total states ratio to be 1:4 which gives better rendering performance than the previous 1:16 ratio (independent of total state count). This gives a small performance uplift (e.g. 2-3% on M1 Ultra).

Additionally for M2 architectures, we double the overall state size if there is available headroom. Inclusive of the first change, we can expect uplift of close to 10% in future, as this results in larger dispatch sizes and minimises work submission overheads. In order to make an accurate determination of available headroom, we defer the calculation of `num_concurrent_states` and `num_concurrent_busy_states` until the time of integrator state allocation (i.e. after all of the scene data has been allocated). We also refactor `alloc_integrator_soa` to calculate an *exact* single-state-size in a first pass, right before allocating the integrator SoA buffers in a second pass.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16313
2022-10-24 17:14:33 +01:00
4c6e07230f Pencil: Fix regression (part2) with stroke buffer introduced in rB0ee9282b5c51
`vert_len` was being shadowed and index_min & max wasn't correctly set.
2022-10-24 16:25:04 +02:00
b400717326 GPencil: Fix regression with stroke buffer introduced in rB0ee9282b5c51 2022-10-24 15:28:49 +02:00
a8731718a1 GPencil: Fix regressions introduced in rB0ee9282b5c51
Batching was broken / disabled and starting indices were wrong.
2022-10-24 12:55:41 +02:00
9fc000cc6f Fix T101946: Outliner data-block counter treats bones as collection
Mistake in own rBb6a35a8153c3 which caused code to always recurse into
bone hierarchies (no matter which collapsed level an armature was
found).
This led to bone counts always being displayed even outside a collapsed
armature (e.g. if an armature was somewhere down a object or collection,
the collapsed object or collection would show this bonecount).
This is inconsistent with other data counting in the Outliner, e.g.
vertexgroups or bonegroups do have their indicator at object level,
however the counter only shows if `Vertex Groups` or `Bone Groups` line
shows (so if the object is not collapsed).

And this also led to the bug reported in T101946 which was that the bone
counts would be treated as collections when further down a collapsed
hierarchy.
Background: The whole concept of `MergedIconRow` is based on the concept
of counting **objects types or collectinons/groups**. If other things
like overrides, vertexgroups or bonegroups are displayed in a counted/
merged manner, then these will always be counted in the array spots that
are usually reserved for groups/collections. But for things this is not
a problem (since these are only displayed below their respective
outliner entry -- and will never be reached otherwise).

So to correct all this, we now only recurse into a bone hierarchy if a
bone is at the "root-level" of a collapsed subtree (direct child of the
collapsed element to merge into).

NOTE: there are certainly other candidates for counted/merged display
further up the hierarchy (not just bones -- constraints come to my mind
here, but that is for another commit)

Maniphest Tasks: T101946

Differential Revision: https://developer.blender.org/D16319
2022-10-24 12:20:11 +02:00
0584a88046 Fix T102008: Images are stretched when texture limit is enabled
Currently, if an image exceed the texture limit setup by the user or the
GPU backend, it will be scaled down to satisfy the limit. However,
scaling happens independently per axis, that means the aspect ratio of
the image will not be maintained.

This patch corrects the smaller size to maintain the aspect ratio.

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

Reviews By: Clement Foucault
2022-10-24 12:15:22 +02:00
365cce4750 GPencil: Fix build errors caused by designated initializer in C++ 2022-10-24 12:07:54 +02:00
216e8d887b Cleanup: quiet parentheses warning 2022-10-24 20:32:03 +11:00
0ee9282b5c GPencil: Use indexed rendering instead of instances
This allows using instancing in other ways, like resources indexing.
2022-10-24 11:21:17 +02:00
b27c831e0c GPencil: Port draw_cache_impl_gpencil.cc to C++ 2022-10-24 11:21:17 +02:00
b7c5ce8c2d Transform: limit zero radius Shrink/Fatten to only 1 curve point
rBb70bbfadfece allowed scaling of zero-radius points, but as it behaves
differently from other radius, it may not be suitable for multi-point
transformation.
2022-10-24 00:16:21 -03:00
93afc50ac3 Fix large incremental snap values in uv editor
Regression in rBa7aa0f1a0c24.

The default values of `t->snap` have been changed.
2022-10-23 11:34:51 -03:00
da36efdf48 GHOST: expand GHOST_PRINT/PRINTF without WITH_GHOST_DEBUG
It was too easy accidentally break builds without WITH_GHOST_DEBUG
enabled because the arguments were ignored. Now they are expanded in an
`if (0) {...}` block, so invalid expressions result in errors.
2022-10-23 17:41:04 +11:00
6172258250 Fix build error when WITH_GHOST_DEBUG is enabled 2022-10-23 17:21:22 +11:00
4130cad489 Fix T101607: Changing Image source inadvertently clears file path
This could result in wrong behavior depending on the order in which the
Image.filepath and Image.source fields are set from within Python for
example.

Caused by rB72ab6faf5d80
2022-10-22 22:11:59 -07:00
763ad17769 GHOST/Wayland: support building with older versions of pointer-gestures
Missing support for the hold gesture broke building on the build-bot.
Since this gesture was only logged, it's harmless to leave it off.
2022-10-23 15:24:06 +11:00
ca0f4f8c5c Fix crash on exit when background rendering in wayland
Disable libdecor Wayland requirement which would use an X11 fallback.

While the crash could be investigated, using libdecor at all makes
no sense in background mode.
2022-10-23 14:07:22 +11:00
b70bbfadfe Fix T102000: Curve Shrink Fatten doesn't work for zero radius
Kind of intentional regression on rB2d1fe736fabd.

But the solution now is (theoretically) better than adding a hard coded
threshold.

For cases with zero radius, the new radius is now the offset of the
ratio projected onto the plane of the origin point.
2022-10-22 19:32:06 -03:00
afec1cd333 Cleanup: clang-format 2022-10-22 18:32:06 +02:00
21fdb0d92b Fix T101329: EXR 'JPG Preview' doesn't use color space anymore
For the JPG preview, the only thing that was changed in the image
format was the format itself. However, the colorspace code now also
checks the bitdepth through BKE_image_format_is_byte, so the depth
needs to be explicitly set to 8-bit for the JPG preview output.
2022-10-22 18:17:01 +02:00
588db6152a Transform: remove unreachable code
The node grid snap only works with 2D coordinates, no transformation
matrix and no Objects.

Also rename `applyGridAbsolute` to `node_snap_grid_apply`.
2022-10-22 13:00:40 -03:00
e16cea019e Cleanup: move grid snap functions to files where they are used 2022-10-22 13:00:40 -03:00
a7aa0f1a0c Fix T101991: "Absolute Grid Snap" not working
Error introduced in rB1edebb794b76.

In that commit it was kind of forgotten that the snap to grid is also
used in 3D views.

Also a refactoring and cleanup was applied to simplify the code.
2022-10-22 12:38:48 -03:00
9f56021975 Fix T101930: NLA Actions Stash remove doesn't work on overriden linked data.
Code adding stash track was clearing out track flags, instead of editing
them as it should have...

Note that there are a lot of other weaknesses in action stash code (like
relying on the (translated!!!!!!) name of the track to know whether it's
a stah or not).
2022-10-22 17:19:55 +02:00
8bb211a771 GHOST/Wayland: multi-touch gesture support
Add support for zoom & rotate gestures, hold and swipe may
be used in the future although swipe maps to 2D smooth-scroll for
Gnome & KDE.

Tested to work with Apple track-pad & Wacom tablet on Gnome & KDE.
2022-10-22 18:01:39 +11:00
e54ea0f90e Cleanup: use wl_/wp_ prefix to match native Wayland types 2022-10-22 16:49:19 +11:00
23c05a916c GHOST/Wayland: support changing seat capabilities at run-time 2022-10-22 16:49:19 +11:00
Stephen Seo
59a0b49c10 Video rendering: FFMpeg AV1 codec encoding support
Previously, the Blender video renderer did not have support for
encoding video to AV1 (not to be confused with the container AVI).
The proposed solution is to leverage the existing FFMpeg renderer
to encode to AV1.

Note that avcodec_find_encoder(AV_CODEC_ID_AV1) usually returns
"libaom-av1" which is the "reference implementation" for AV1 encoding
(the default for FFMpeg, and is slow). "libsvtav1" is faster and
preferred so there is extra handling when fetching the AV1 codec for
encoding such that "libsvtav1" is used when possible.

This commit should only affect the options available for video
rendering, which includes the additional AV1 codec to choose from, and
setting "-crf".

Also note that the current release of FFMpeg for ArchLinux does not
support "-crf" for "libsvtav1", but the equivalent option "-qp" is
supported and used as a fallback when "libsvtav1" is used (as
mentioned here: https://trac.ffmpeg.org/wiki/Encode/AV1#SVT-AV1 ).
(Actually, both "-crf" and "-qp" is specified with the same value in
the code. When a release of FFMpeg obtains support for "-crf" for
"libsvtav1" is released, the code shouldn't be needed to change.)

The usage of the AV1 codec should be very similar to the usage of the
H264 codec, but is limited to the "mp4" and "mkv" containers.

This patch pertains to the "VFX & Video" module, as its main purpose
is to supplement the Video Sequencer tool with the additional AV1
codec for encoded video output.

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

Reviewed By: sergey , ISS, zeddb
2022-10-21 20:10:17 -06:00
ea571ddc29 Fix T101969: Crash when using large texture with nonstandard colorspace
When the image colorspace is not data, linear or sRGB, the image will
be converted to float (and colorspace-converted) during loading.

However, if it also needs to be rescaled (due to exceeding the GPU
texture size limit), the resizing assumed that it's still a byte
texture.
2022-10-22 02:51:52 +02:00
04eab0fd01 deps_builder: expose FORCE_CHECK_HASH as an option
The check was already there, but given it was not
exposed as an option it didn't show up in my cmakecache
and i got tired of having to lookup the exact name
all the time.
2022-10-21 12:48:17 -06:00
e7a6917617 Build: add option to error when features can't be enabled
This is to help ensure buildbot builds are correct, while still gracefully
disabling features in user/developer builds.

* Add WITH_STRICT_BUILD_OPTIONS to give an error when features can't be
  enabled due to missing libraries or other reasons. Add new macro
  set_and_warn_library_found used everywhere features were being
  automatically disabled.

* Remove code from Windows and macOS for various libraries that would
  automatically disable features. set_and_warn_library_found could be
  used here also, but we are generally assuming the precompiled libraries
  are complete and only test for availability when libraries are just
  added.

Differential Revision: https://developer.blender.org/D16104
2022-10-21 20:04:47 +02:00
ebe2319692 Build: disable JACK option in macOS releases
It has not actually been enabled there for a long time in official releases,
so this just fixes the warning. Making it work again would be good, but for
now JACK is only supported on Linux.
2022-10-21 20:04:47 +02:00
56d1f0772d Fix missing OpenMP in Linux builds
OpenSubdiv OpenMP detection was interfering, but we don't use it there
anymore so just remove that code.
2022-10-21 20:04:47 +02:00
9c20eda0ad Fix T101244: Empty point list in shader batch creation cause error
Allow empty VBOs in Python GPUBatch creation.
2022-10-21 14:24:30 -03:00
116d7b0042 make.bat: update the libraries before calling update_sources.py
The issue we ran into a lot is we have a python script that updates
git+SVN. Which works fine most of the time, except when we have a
python update in SVN, or worse a python version change. Python really
doesn't enjoy having its files being deleted or changed while it is
running and users generally end up with a corrupted lib folder.

This change updates the library folder using svn.exe first before
letting the python script run sidestepping the issue in most cases.

The python script will still run and do the more elaborate work
like updating git and switching SVN branches which could still
run into issues cause python still doesn't like being changed
while running but there's not a whole lot we can about that,
for *most* people however things will just work now.
2022-10-21 09:50:14 -06:00
2c108d5503 Avoid re-compilation of oneAPI AoT kernels when configuration changes
Buildbot infrastructure relies on the fact that it can enable and
disable `WITH_CYCLES_<COMPUTE>_BINARIES` without affecting speed of
incremental builds. This allows buildbot to skip GPU kernels when
doing CI regression tests which do not need GPU kernels, as well as
it allows to move GPU kernels compilation to a separate step where
all the resources are available to the GPU kernel builders.

For the oneAPI compute enabling and disabling AoT kernels has much
higher implications due to the kernels being a part of the device
implementation from the build target perspective.

This change makes it so different target names are used for JIT and
AoT configurations, which allows CMake to more fully benefit from
"caching" the compiled result.

The end goal of this change is to make it so sequential build of the
same code base on the buildbot happens super fast,

Blender binary still needs to be re-linked when the AOT of oneAPI
option is toggled, but that's already the case in the buildbot due
to the WITH_BUILDINFO.

Differential Revision: https://developer.blender.org/D16312
2022-10-21 17:17:51 +02:00
048f1a1b8b GPU: remove unused member from FrameBuffer
Accidentally added in rB2510bd3a5f35d14f5e0e098c79a776916d273223
2022-10-21 11:57:42 -03:00
0cfac5b043 Cycles: oneAPI: migrate from deprecated APIs, require libSYCL 6.0+
sycl::info::device::ext_intel_* descriptors are deprecated,
replaced with sycl::ext::intel::info::device:: that are available from
6.0+, for which we now check version in CMake.
2022-10-21 15:36:49 +02:00
305b92e05f Cycles: oneAPI: remove use of SYCL host device
Host device is deprecated in SYCL 2020 spec, cpu device or standard C++
should be used instead.
2022-10-21 15:36:48 +02:00
Edward
4776a74bf7 Fix T101974: Potential memoryleak GHOST_WindowWayland.newDrawingContext
Reviewed By: jbakker

Maniphest Tasks: T101974

Differential Revision: https://developer.blender.org/D16309
2022-10-21 15:35:30 +02:00
ec60c8abe7 SystemInfo: Add active GPU backend.
For debugging it is useful to known the active GPU backend. Although
it could be determined from looking at the extensions, this is easier
to understand when not activly working in this area.
2022-10-21 15:06:07 +02:00
3ccec47841 cmake/windows: Prepare for 3.4 library changes for opencollada
The opencollada dependency will be using an external xml2 library
for 3.4. This change allows to build against both old and new
style lib folders.

As it is a C library it did not need a special debug version.
2022-10-21 07:04:21 -06:00
d39f2eed98 GPU: Don't exit after first GPUBackend. 2022-10-21 14:58:27 +02:00
e8c4411035 GPU: Add gpu.platform.backend_type_get function.
Function returns the active GPU backend type.
2022-10-21 14:58:27 +02:00
3225bc2e7f GPU: Fix Metal GLSL compilation errors due to recent changes.
vec.st is legacy OpenGL and should not be used.
2022-10-21 14:58:27 +02:00
f0ebf696cb Fix T101964: Edge and face snapping no locking to axis
In rBed6c8d82b804 it was wrongly assumed that the constraint functions
always apply the transformations.

But that is not the case for when axes are aligned.

The `mul_m3_v3(t->con.pmtx, out)` fallback is still required.
2022-10-21 09:53:07 -03:00
899d4ddbd0 Fix: Bokeh blur node flips its bokeh input
The bokeh blur node flipped its bokeh input due to the conceptual
difference between the search window space and the weights texture
space. This patches fixes that by inverting the weights texture to match
the search window.

The variable size option actually flips the bokeh input for the CPU
compositor. It is unclear if this is expected, so we deviate from that
behavior for now.
2022-10-21 14:05:19 +02:00
26f181c6b7 EEVEE: Fix ill defined blend in cubemap array workaround
This fixes some firefly issues on corners of the cubemaps where the
blending factors would go above 1 or below 0.
2022-10-21 13:11:39 +02:00
4bfb99e4d8 Cycles: Bump versions of DPC++, IGC, and dependencies
Patch by Xavier Hallade. Committing next to the actual libraries update
in the svn.
2022-10-21 12:19:54 +02:00
5814e35af1 install_deps: Update OSL for Blender 2.4 release.
As requested by T101403, OSL version is now 1.12.6.2.
2022-10-21 08:51:23 +02:00
a0bbd65d57 Fix T66713: Walk mode doesn't take scene unit scale into account
When changing a scene's unit scale from 1 to something else, 0.1 for
e.g. walk navigation no longer worked properly. Whenever gravity is
enabled, and the user starts to fall or jump, the view-port glitched out
into low earth orbit.

Reviewed By: campbellbarton

Ref D16277
2022-10-21 16:17:22 +11:00
dc09cc13ea deps_builder: add missing OSLNoise library on windows
OSLNoise is a new library, was missing in the debug
configuration on windows.
2022-10-20 18:31:15 -06:00
6515177981 deps_builder: OpenCollada fixes for windows
- build and use our version of libxml

- the cli tools had a linker error due
to it trying to link a shared version
of libxml, disabled both and zlib 1.2.3
with a patch since we do not want/need
them for blender.

- postfix the libraries with _d for debug
automatically so we don't have to fix that
during the harvest.

due to this only being windows changes no
rebuild needed for the other platforms.
2022-10-20 18:29:59 -06:00
ff8c0f062a GHOST/Wayland: code comments, minor improvements
- Clarify how data_offer is used for both the clipboard & drag-and-drop.
- Acquire the clipboards mutex lock before freeing.
- Log a warning when creating a pipe fails.
- Add doxy-sections.
2022-10-21 11:08:03 +11:00
97f4e076c7 Fix: USD & Alembic importers might not initialize material indices
f1c0249f34 incorrectly assumed that the importer functions that
assigned material indices set all of the values, but that isn't true
for all files.
2022-10-20 17:23:54 -05:00
bd1ff201b1 Buildfix for 078e034 missing include 2022-10-20 21:06:44 +02:00
8c361d6f66 deps_builder: fix missing png harvest on windows 2022-10-20 11:46:42 -06:00
5e0e5b1341 Fix T101215: Distribute Points in Volume node does not refresh on frame change 2022-10-20 18:02:14 +02:00
24fd8f729a Fix memory leak when proxy building fails
Leak introduced in recent fix - bf8d4a9bc6.
2022-10-20 17:59:23 +02:00
4b30ee773c Fix T101316: workbench texture mode not working with geometry nodes
The `ED_object_get_active_image` is used from the renderer which deals with
evaluated objects. This means the material api for evaluated objects has
to be used.
2022-10-20 17:34:43 +02:00
3bac6f17f1 install_deps: Update Python, OIIO, openPGL and FFMPEG versions.
Update libraries for Blender 3.4, according to T101403:
* python: 3.10.8
* OIIO: 2.3.20.0
* OpenPGL: 0.4.0-beta
* FFMpeg: 5.1.2
2022-10-20 17:07:53 +02:00
8415bc9c80 Fix T101554: disable viewer node when corresponding modifier is disabled 2022-10-20 16:54:32 +02:00
84825e4ed2 UI: Icon number indicator for data-blocks
Adds the possibility of having a little number on top of icons.

At the moment this is used for:
* Outliner
* Node Editor bread-crumb
* Node Group node header

For the outliner there is almost no functional change. It is mostly a refactor
to handle the indicators as part of the icon shader instead of the outliner
draw code. (note that this was already recently changed in a5d3b648e3).

The difference is that now we use rounded border rectangle instead of
circles, and we can go up to 999 elements.

So for the outliner this shows the number of collapsed elements of a
certain type (e.g., mesh objects inside a collapsed collection).

For the node editors is being used to show the use count for the data-block.
This is important for the node editor, so users know whether the node-group
they are editing (or are about to edit) is used elsewhere. This is
particularly important when the Node Options are hidden, which is the
default for node groups appended from the asset libraries.

---

Note: This can be easily enabled for ID templates which can then be part
of T84669. It just need to call UI_but_icon_indicator_number_set in the
function template_add_button_search_menu.

---

Special thanks Clément Foucault for the help figuring out the shader,
Julian Eisel for the help navigating the UI code, and Pablo Vazquez for
the collaboration in this design solution.

For images showing the result check the Differential Revision.
Differential Revision: https://developer.blender.org/D16284
2022-10-20 16:46:54 +02:00
58e25f11ae Realtime Compositor: Implement normalize node
This patch implements the normalize node for the realtime compositor.

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

Reviewed By: Clement Foucault
2022-10-20 16:32:28 +02:00
9d710374bd Fix T101645: division by zero in fillet node 2022-10-20 16:15:16 +02:00
Monique Dewanchand
f017fdecef ViewLayer: Reduce object duplication syncing
During object duplication the syncing is temporarily disabled.
With {D15885} this isn't useful as when disabled the view_layer
is still accessed to locate bases. This can be improved by first
locating the source bases, then duplicate and sync and locate
the new bases.

This patch removes the resync forbid and improve the times
that resyncing actually must happen.

Reviewed By: mont29

Maniphest Tasks: T73411

Differential Revision: https://developer.blender.org/D15886
2022-10-20 16:14:36 +02:00
66a166d236 GL: Make restart index consistent on older implementation
This prevents weird quirks where the implementation might skip
the ushort max index even in non-indexed draws.
2022-10-20 16:07:14 +02:00
7aaebf31df Cycles: replace (tm) with unicode equivalent in UI
It was already done for (TM) which is present in some GPU names on Windows.
Names on Linux ended up using (tm) instead:
91fec2657a
2022-10-20 15:49:36 +02:00
7f2cd2d969 Realtime Compositor: Implement Tone Map node
This patch implements the tone map node for the realtime compositor
based on the two papers:

Reinhard, Erik, et al. "Photographic tone reproduction for digital
images." Proceedings of the 29th annual conference on Computer graphics
and interactive techniques. 2002.

Reinhard, Erik, and Kate Devlin. "Dynamic range reduction inspired by
photoreceptor physiology." IEEE transactions on visualization and
computer graphics 11.1 (2005): 13-24.

The original implementation should be revisited later due to apparent
incompatibilities with the reference papers, which makes the operation
less useful.

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

Reviewed By: Clement Foucault
2022-10-20 15:02:41 +02:00
fd7a3e2622 Cleanup: compiler warnings 2022-10-20 13:57:59 +02:00
0d7065504e Build: mark remaining CVEs reported by cve_check as mitigated or ignored
After the last library update cve_check still reported some false positives.
One GMP issues was mitigated with a patch in the library update. The others
are ignored, with a description explaining why they do not affect Blender.

Ref D16269, T101403
2022-10-20 13:57:45 +02:00
21deba56aa Build: update various libraries for 3.4, fixing bugs and security issues
THis is bumping dependencies to fix known CVEs, with the exception of
OpenImageIO which also includes bugfixes for performance and correctness
with some image types.

zlib 1.2.12 -> 1.2.13
freetype 2.11.1 -> 2.12.1
openimageio 2.3.13.0 -> 2.3.20.0
python 3.10.2 -> 3.10.8
openjpeg 2.4.0 -> 2.5.0
ffmpeg 5.0 -> 5.1.2
sndfile 1.0.28 -> 1.1.0
xml2 2.9.10 -> 2.10.3
expat 2.4.4 -> 2.4.9
openssl 1.1.1g/i -> 1.1.1q
sqlite 3.31.1 -> 3.37.2

Notable changes:
* AOM: the hack we had in place to make it not detect pthreads on windows no
  longer worked with a more recent cmake version. Disabled pthreads with a
  diff on Windows.
* Python: embedded copy of zlib 2.1.12 swapped out for our 2.1.13 copy with
  some folder manipulation on Windows.
* Freetype: was harbouring a copy of zlib 2.1.12 as well, so that had to end.
* FFmpeg: patch used to fix D11796 is no longer needed. Add new patch to deal
  with simple_idct.asm generating an object file with no sections in it,
  backport from upstream commit.
* TinyXML: still being downloaded but no longer used by OpenColorIO, removed.
* GMP applied upstream patch to fix CVE-2021-43618, as there is no release yet.
* SQLite and Libsndfile patches no longer needed.

Includes contributes by Ray Molenkamp, Campbell Barton and Brecht Van Lommel.

Ref T101403

Differential Revision: https://developer.blender.org/D16269
2022-10-20 13:56:01 +02:00
debacbfe5c Build: update OpenPGL hash for re-tagged version without symbols conflicts
Ref D16269, T101403
2022-10-20 13:56:01 +02:00
303dd263e2 Build: update OSL to version 1.12.6.2
Required changes to make OSL pick up the new oslnoise library.

Ref D16269, T101403
2022-10-20 13:56:01 +02:00
a30128a3c1 Fix missing free in 8a43bfd8fd 2022-10-20 22:26:13 +11:00
c81bc09876 GPU: Avoid undocumented/fragile dependency on shader enumerator order
Previously this was using `GPU_SHADER_TEXT` as default value indicating
an "unset" state. This wasn't documented in the definition (and so
D16284 added a new enumerator that broke this). Plus code was assuming
this enumerator would always have the value 0 without specifying this in
the definition either.

In this case it's easy to not rely on the enum value at all, and just
use `std::optional` to add a "unset" state.

Differential Revision: https://developer.blender.org/D16303
2022-10-20 13:17:22 +02:00
8a43bfd8fd GHOST/Wayland: refactor copy/paste buffer storage
- Improve reporting when reading a file descriptor into a buffer fails,
  also check for failure to allocate memory.
- Store buffers with size in a simple struct.
- Use shared utility functions for simple buffer operations.
2022-10-20 22:15:34 +11:00
40afb8ae6a Lib reload/relocate: Improve performances.
Reduce amounts of viewlayer updates during remapping while relocating
libraries. Gives some improvements on relocating process, depending on
complexity of existing scene and reloaded libraries, whether there is
liboverrides to resync, etc., can give up to 10% speedup.
2022-10-20 11:39:59 +02:00
bd9d68e4dc Fix (studio-reported) issue with overrides on library relocating.
Liboverrides that were using a missing linked reference ID would not get
their 'MISSING' tag properly cleared afer relocating, in case their
linked reference is no more missing.

Reported by Andy (@eyecandy) from Blender studio.
2022-10-20 11:39:59 +02:00
ff157d7eba Fix incorrect shader state after shader interface creation
Use store-current-and-restore-previous OpenGL program in the OpenGL
Shader Interface. This is a better fix for the initial error, which
additionally solves interface artifacts when opening non-default
startyp files on macOS with AMD GPU.
2022-10-20 10:09:32 +02:00
90686ff6f4 Fix WebM naming in the interface
Use the official spelling of the WebM codec. Only affects the interface
string and not the identifier used in the Python API. Should not even
affect translations: the current msgstr's do no translate the original
string.

Reported by Anton Raves, thanks!
2022-10-20 09:52:37 +02:00
b0eff51fb7 GHOST/Wayland: primary clipboard support
Match X11's primary clipboard support
(typically used for MMB to paste the previous selection).
2022-10-20 14:39:04 +11:00
1e1b9eef1b GHOST/Wayland: skip redundant strlen() sending the clipboard 2022-10-20 13:58:42 +11:00
d392e9afea Cleanup: correct prefix for internal wayland utility function 2022-10-20 13:58:42 +11:00
f24dfdcd3c Cleanup: format 2022-10-20 13:57:43 +11:00
c58d6b30ad GHOST/Wayland: correct assert from recent commit
Error in [0], only clear the stored clipboard data source pointer if it
matches the data being cleared.

[0]: 09e3ea49db
2022-10-20 13:57:43 +11:00
e2a93e9c7c Fix T94136: Cycles: No Hair Shadows with Transparent BSDF 2022-10-20 04:47:21 +02:00
3915f5300a Fix T99151: Cycles not updating on Object Type visibility change
Differential Revision: https://developer.blender.org/D16259
2022-10-20 02:36:36 +02:00
3411a96e74 Fix T93382: Blender still generates subsurface render passes
In T93382, the problem was that the Blender-side rendering code was
still generating the subsurface passes because the old render pass
flags were set, even though Cycles doesn't generate them anymore.

After a closer look, it turns out that the entire hardcoded pass
creation code can be removed. We already have an Engine API function
to query the list of render passes from the engine, so we might as
well just call that and create the returned passes.

Turns out that Eevee already did this anyways. On the Cycles side, it
allows to deduplicate a lot of `BlenderSync::sync_render_passes`.
Before, passes were defined in engine.py and in sync.cpp. Now, all
passes that engine.py returns are created automatically, so sync.cpp
only needs to handle a few special cases.

I'm not really concerned about affecting external renderer addons,
since they already needed to handle the old "builtin passes" in
their Engine API implementation anyways to make them show up in the
compositor. So, unless they missed that for like 10 releases, they
should not notice any difference.

Differential Revision: https://developer.blender.org/D16295
2022-10-20 02:23:28 +02:00
e3075f3cf7 Cleanup: simplify uv packing api
Part of a wider set of changes to migrate UV packing from
uv_parametrizer.cc to uvedit_islands.cc.

This allows UV packing improvements including margin calculation,
correctness fixes such as support for non-manifold geometry,
and new packing algorithms including speed and quality improvements.

See for example c2256bf7f7, T82637

This change migrates UV.unwrap and Live UV Unwrap.

Differential Revision: https://developer.blender.org/D16296
2022-10-20 12:44:56 +13:00
21a1c332b0 GHOST/Wayland: update code comment for Gnome-Shell workaround
Note that the bug has been fixed upstream.
2022-10-20 10:03:55 +11:00
09e3ea49db GHOST/Wayland: clear data source pointer when canceled
The external cancel callback destroyed the data source but didn't
clear the pointer. While this didn't cause problems,
avoid keeping references freed pointers.
2022-10-20 10:03:55 +11:00
c67975c6bb Cleanup: use 'wl_' prefix for data_source
Without this the local and wayland native types could be mixed up.
2022-10-20 10:03:55 +11:00
1a11353d34 Cleanup: Remove unused grease pencil / RNA includes 2022-10-19 16:33:44 -05:00
ba6f25dd1b Fix T101907: restore snapping in node editor
Regression from 1edebb794b
2022-10-20 10:10:39 +13:00
bf8d4a9bc6 Fix T101857: Crash when trying to build proxies on read-only filesystem
Skip building if proxy file can't be created.
2022-10-19 21:07:52 +02:00
d046c8c9d7 Fix T101926: Curves: Remove type-specific attributes when deleting
Remove NURBS or Bezier specific attributes after removing points or
curves. In theory we could avoid copying those attributes in the
first place, but that doesn't seem worth the extra complexity here,
since we don't necessarily know the result curve type counts before
copying attributes.
2022-10-19 13:39:23 -05:00
193b456d2d Fix macOS build error after recent changes to enable Intel GPUs
This will only work once we upgrade to the macOS 13 SDK.

Ref D16253
2022-10-19 20:34:53 +02:00
Yann Lanthony
c3d0ba3b33 Fix T101622: Sequencer channels not updating while panning view
`V2D_VIEWSYNC_AREA_VERTICAL` flag was mistakenly set to the sequencer
toolbar region instead of the channels region.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D16155
2022-10-19 20:14:58 +02:00
c14b113746 Fix: Geometry Nodes: Memory leak when deleting instances
The instance attributes assignment operators were broken in multiple
ways: there wasn't a move constructor (probably causing performance
issues), and the destination attributes weren't freed before they
were replaced.
2022-10-19 13:12:20 -05:00
a803dbe7ed Geometry Nodes: Use common utility for copying attribute data
Attribute copying often uses identical logic for copying selected
elements or copying with an index map. Instead of reimplementing
this in each file, use the common implementation in the array_utils
namespace. This makes the commonality more obvious, gives improved
performance (this implementation is multithreaded), reduces binary
size (I observed a 173KB reduction), and probably reduces compile time.
2022-10-19 12:38:48 -05:00
Morteza Mostajab
e6902d19a0 Cycles: Allow Intel GPUs under Metal
Known Issues:
- Command buffer failures when using binary archives (binary archives is disabled for Intel GPUs as a workaround)
- Wrong texture sampler being applied (to be addressed in the future)

Ref T92212

Reviewed By: brecht

Maniphest Tasks: T92212

Differential Revision: https://developer.blender.org/D16253
2022-10-19 17:09:38 +01:00
053fc35b01 EEVEE: Depth Of Field: Replace ambiguous select with manual check
This is an attempt to remove a driver bug.
2022-10-19 17:55:51 +02:00
63aec82e8a Cycles: oneAPI: switch back target to dg2
Current version of IGC dependency doesn't yet support acm-g10 target.
2022-10-19 17:47:21 +02:00
bad7340811 Fix control reaches end of non-void function error 2022-10-19 17:32:43 +02:00
96c085d4af Cleanup: WM: Fix missing enumerator case in switch 2022-10-19 17:19:18 +02:00
3d878cd0df Fix T101896 Eevee: Custom object properties don't work in shader for Curves objects
Move the material resources binding inside the
`DRW_shgroup_curves_create_sub` so that `DRW_shgroup_call_no_cull`
extracts the attributes.
2022-10-19 17:08:30 +02:00
ceb0e7fcea Fix (devs-reported) mistake in batch delete code in recent change.
Mistake in own rB358155a8da60, change ended up discarding the case where
we need to also delete IDs using a tagged-to-be-deleted ID in a 'never
NULL' way. Typical example: Whene deleting a Mesh ID, one also needs to
delete all the Objects using that mesh, since obdata pointer is of type
'never NULL'.

Note that luckily, this fix does not affect the performance improvements
from rB358155a8da60.

Noted by Brecht and Clement because of failing unittests, shame on me.
2022-10-19 16:52:48 +02:00
d763e294fc Cycles: oneAPI: fix libsycl.so files harvesting
was missing libsycl.so.5.7.0-16 when using such version.
2022-10-19 16:42:10 +02:00
151b653bd5 Cycles: oneAPI: fix clean Windows ninja builds
Previously, a first build using ninja would throw "ninja: error:
'intern/cycles/kernel/cycles_kernel_oneapi.lib', needed by
'bin/blender.exe', missing and no known rule to make it".
2022-10-19 16:42:10 +02:00
5bfce9a822 Cycles: oneAPI: preload kernels only when not using prebuilt binaries
sycl::build triggers compilation even if prebuilt binaries are
available, we'll have to find a better way in this case.
2022-10-19 16:42:10 +02:00
86bb79e756 Cycles: oneAPI: update dg2 target to acm-g10
"dg2" target is deprecated from the GPU compiler/ocloc.
We switch to targeting acm-g10 instead, for which generated binaries are
compatible with other Arc GPUs.
2022-10-19 16:42:10 +02:00
2943997d2a Cycles: oneAPI: include sycl/sycl.hpp instead of CL/sycl.hpp
Since SYCL 2020 API, sycl/sycl.hpp is the way.
2022-10-19 16:42:10 +02:00
d816bae7bf Cycles: oneAPI: fix check_usm for debug builds 2022-10-19 16:42:10 +02:00
5d67fb0f18 Cycles: oneAPI: fix MSVC_TOOLS_DIR for some build environments
MSVC Tools version doesn't match MSVC Redist version on some systems and
it's not populated when using Ninja outside of Visual Studio shell,
trying another way.
2022-10-19 16:42:10 +02:00
425e7ca342 Fix T101928: transform operator properties saving wrong snap values
The check for the flags should be `== 0` since they are describing a
negative state.

Thanks to @lone_noel for pointing out the error.
2022-10-19 10:59:17 -03:00
6165395927 Fix T101922: transforming surface points misses redraw
Oversight in rBf8b1483566cc which resulted in fonts/surfaces not having
their draw caches being tagged dirty.

Not only OB_CURVES_LEGACY have their object data of type ID_CU_LEGACY,
but also OB_SURF/OB_FONT objects.

Maniphest Tasks: T101922

Differential Revision: https://developer.blender.org/D16298
2022-10-19 15:45:46 +02:00
Jeroen Bakker
3655eb7ff0 Blender: Add command line argument to switch gpu backends.
Add command line argument to switch gpu backend. Add `--gpu-backend` option to
override the gpu backend selected by Blender.

Values for this option that will be available in releases for now are:
* opengl: Force blender to select OpenGL backend.

During development and depending on compile options additional values can exist:
* metal: Force Blender to select Metal backend.

When this option isn't provided the internal logic for GPU backend selection will be used.
Note that this is at the time of writing the same as always selecting the opengl backend.

Reviewed By: fclem, brecht, MichaelPW

Differential Revision: https://developer.blender.org/D16297
2022-10-19 15:13:26 +02:00
ead3fc4a07 Fix T99997: Calling teleport without waiting for the previous event disables gravity
During teleport event, gravity is disabled and WalkMethod
is stored in `teleport.navigation_mode` which is used later to reset
the status after execution. Calling teleport events consecutively
will change the initial WalkMethod value. So update it only on the
first call. Also remove `else condition` as it stops the previously running
teleport when the new teleport call fails to find a hit point.

Reviewed by: dfelinto, mano-wii

Differential Revision: https://developer.blender.org/D15574
2022-10-19 18:20:47 +05:30
3ac2f15a04 GL: Fix incorrect shader state after shader interface creation
The interface needs to bind the shaders for some parameter setup.
This program change wasn't reflected in the GPUContext.
This was then conflicting with the next shader bind if the next shader was
the same as the shader bound before the interface creation.

Setting the state to the correct shader ensures a rebind if needed.

Fix T101792 New hair curves do not render properly first time in EEVEE with motion blur enabled
2022-10-19 14:40:42 +02:00
f0fba1a2d8 GHOST/Wayland: invert touch-pad scrolling
This should use the system preference for scroll direction eventually,
for now default to a down-motion scrolling down (matching GTK & QT).
2022-10-19 21:48:42 +11:00
ec638d3108 GHOST/Wayland: only prioritize discrete scroll for mouse wheel events
Smooth & discrete scrolling may both be set, instead of always
prioritizing discrete, use discrete scrolling when the source is a
mouse wheel, otherwise prioritize smooth scrolling.
2022-10-19 21:37:14 +11:00
89525fae59 Cleanup: CMake include paths
Remove redundant separators & redundant references to parent paths.
2022-10-19 21:37:10 +11:00
d4b8e9b69f Cleanup: format 2022-10-19 21:32:12 +11:00
b51763a773 Fix T101888: Curves editmode: modifiers "Display in Edit mode" no effect
Add the eModifierMode_Editmode to the required modes for curves modifier
evaluation. Only this way the modifier can be skipped in evaluation.

Maniphest Tasks: T101888

Differential Revision: https://developer.blender.org/D16280
2022-10-19 11:57:43 +02:00
2180e6fc9f Curves: make the "surface_uv_map" a searchable dropdown
The users had to type in a name here, but we can also make it a dropdown
choice with existing UV Maps for convenience:
- dont have to remember a name or copy paste obviously
- shows in red if it was removed / invalid

Came up in T101028

Maniphest Tasks: T101028

Differential Revision: https://developer.blender.org/D15956
2022-10-19 11:56:27 +02:00
e5782df4ab Fix (unreported) error messages about invalid ID usercount when batch-deleting IDs.
Batch-delete by-passes a lot of ID usages handling in to-be-deleted IDs,
so usercount of deleted IDs needs to be manually reset to avoid the
annoying error messages in the console.
2022-10-19 10:27:56 +02:00
358155a8da Make batch ID deletion 100 times faster.
Simplify and optimize remapping handling in bacth ID deletion, by moving
it outside of the initial loop gathering all IDs to be deleted, and and
by using batch remapping code.

Speedup can be over 100 times faster in complex production scenes using
thousands of IDs, when e.g. deleting a whole library.

Examples before/after times on my machine (deleting two different libraries):
lib1:  5.55 sec/0.03 sec
lib2: 13.60 sec/0.13 sec

Found while investigating T101903.
2022-10-19 10:17:33 +02:00
a450a2f2b2 Fix T101903: Crash when deleting library in some cases.
Remapping in batch deletion could end up calling viewlayer resync code
on partially invalid BMain (some IDs still in Main using IDs removed
from Main).

Think this code can actually be further optimized, but this fix should
be safe enough for 3.3 (and potentially 2.93).

Thanks to Jeroen (@jbakker) for the initial investigation.
2022-10-19 09:22:02 +02:00
4163c63def Curves sculptmode: fix missing mode and tool in Brush Specials
For consistency with other brush based (paint) systems we should add
these entries in the brushes context menu.
For this, expose the brushes `ob_mode` to RNA and show this (along with
the tool choice) to the appropriate menus.

Differential Revision: https://developer.blender.org/D16287
2022-10-19 08:53:09 +02:00
4d185921f6 Sculpt curves: Fix BKE_paint_object_mode_from_paintmode
Currently harmless (since atm. it is not possible to trigger this part
of the code from curves sculpting), but in a future fix (for T101518), it
would be good to use `BKE_paint_init` (and having the correct ob_mode
for the brush would be nice).

Differential Revision: https://developer.blender.org/D16286
2022-10-19 08:52:27 +02:00
96fa5e1e84 Cleanup: remove unused 'VIEW3D_MT_brush_context_menu_paint_modes'
This was added in rB4c9fe657458f, however that new code never used this
menu (but the existing `VIEW3D_MT_brush_paint_modes` instead).

Differential Revision: https://developer.blender.org/D16285
2022-10-19 08:50:38 +02:00
760a6aa1f5 Fix error in 30d9a6245f
X/Y for mouse wheel events was unintentionally flipped.
2022-10-19 16:35:32 +11:00
30d9a6245f GHOST/Wayland: support high resolution 2D track-pad scroll events
These events are interpreted as MOUSEPAN by Blender.
Tested with a Wacom Intuos5. This isn't full touch support
which is needed to support gestures such as Swipe, Rotate .. etc.
2022-10-19 16:32:32 +11:00
da4bd24c3e Sculpt: Improve performance of face set creation from selection
Skip BMesh conversion and read the selection attribute directly.
With a Ryzen 3700x, my test face of a simple 4 million face grid
became over 4000 times faster, from 2.6s to 0.6ms.
2022-10-18 23:44:16 -05:00
42f37106c5 GHOST/Wayland: add listener for touch events (no touch support yet)
Currently unused as my tablet isn't generating touch events.
This may be useful for development as touch events are logged.
2022-10-19 14:53:48 +11:00
e4c5a46c12 Cleanup: remove NDOF_BUTTON_NONE from the range of usable buttons
This is used to represent unknown state, so there is no need to be
able to store it's pressed state.
2022-10-19 14:07:36 +11:00
c9f1378863 Cleanup: use '_' suffix for private members for NDOF Manager 2022-10-19 13:53:20 +11:00
c247562b07 GHOST/NDOF: various minor changes to NDOF manager
- Use logging for NDOF device output
  (this removes printing on startup buy default).
- Use `ndof_` prefix for button maps.
- Use full sentences.
2022-10-19 13:38:31 +11:00
ab28abcb6b Cleanup: remove the last button from NDOF button enum values
This is only used for comparison, no need to make it part of the enum.
2022-10-19 12:58:36 +11:00
ecda118be4 Fix T101866: Incorrect buttons for space-mouse enterprise
Use key from spacenavd's wiki.

Also add keys: ENTER, DELETE, TAB, SPACE & Views 1-3.
2022-10-19 12:52:58 +11:00
8aca40652a Cleanup: spelling in comments 2022-10-19 12:52:55 +11:00
8115d30dca License headers: add missing license identifiers 2022-10-19 12:52:54 +11:00
be32882e1c Fix T101883: Issue applying modifier to mesh with shape keys
Caused by 21f2bacad9 which misunderstood the logic handling
shape keys in this function. The shape key on the original mesh in the
main data-base should be cleared if the "no-main" mesh doesn't have any
shape key layers and the vertex count has changed. The complexity is
necessary because shape keys are stored differently on original and
evaluated meshes.

Also change to "Warn" because this is expected behavior in some cases,
like when applying a geometry nodes modifier that creates a new mesh
from scratch.
2022-10-18 15:57:57 -05:00
d57352b114 Fix T101893: Auto merge affecting edge crease and bevel weight
None of the special transformations in `special_aftertrans_update__mesh`
are really applicable or useful for edge crease and bevel weight.
2022-10-18 12:51:32 -03:00
91e85230f9 Fix T101660: crash when trying to propagate string attributes in some nodes
String attributes are intentionally not fully supported in geometry nodes
yet because more design work is necessary to decide how they should behave.

For now just disable handling string attributes to avoid crashes.
2022-10-18 17:17:08 +02:00
91ecf47b2c Fix: Sample nearest surface node crash with empty mesh 2022-10-18 10:07:32 -05:00
a2fcfcabd7 Cleanup: add missing CPPType for MStringProperty 2022-10-18 16:50:42 +02:00
7abd79398d Fix T101642: crash when deleting group output inside node group 2022-10-18 16:15:27 +02:00
5c1d2c5a9d Brush: Wrap mtex/mask_tex around functions.
`Brush` has two attributes for holding texture information (`MTex`).
One for color textures (`mtex`) and one for mask textures (`mask_mtex`).

Unfortunately sculpt mode due to reasons used `mtex` to store mask textures.
Changes like brush asset/paint mode require modes/tools to read the mask/color texture from
one place.

To start sanatizing this we isolate the attributes in functions.
`BKE_brush_color_texture_get` and `BKE_brush_mask_texture_get`. All object
paint modes should use these functions.
2022-10-18 16:06:40 +02:00
619ce8392b Depsgraph: wrong copy-on-write update after depsgraph rebuild
Differential Revision: https://developer.blender.org/D16268
2022-10-18 15:49:05 +02:00
489260198e File Browser: Fix slowdown with non-existing ID previews in big files
When the File (or Asset) Browser would display data-blocks without
previews in a heavy .blend file, there would be a drastic slowdown.

See patch for details and comparison videos.

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

Reviewed by: Bastien Montagne
2022-10-18 15:10:59 +02:00
c2fe387244 Build: get make deps working with Xcode command line tools
Deduplicating code with Xcode detection for Blender builds.
2022-10-18 14:17:28 +02:00
Sebastian Herholz
2006c3ed10 Fix T101529: Blender crashes when using Path Guiding 2022-10-18 13:59:12 +02:00
Jason Fielder
aed301704a Metal: MTLBatch and MTLDrawList implementation.
MTLBatch and MTLDrawList implementation enables use of Metal Viewport for UI and Workbench. Includes Vertex descriptor caching and SSBO Vertex Fetch mode draw call submission.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D16101
2022-10-18 12:47:43 +02:00
e47bf05e85 NDOF: use logging for GHOST so users can enable event logging
Previously this was only available as a build options, making it
difficult to get user feedback when NDOF events didn't work as expected.

Now logging can be enabled with:

  blender --log "ghost.ndof.*" --log-level 2 --log-show-basename
2022-10-18 14:54:33 +11:00
1edebb794b UV: support snapping on non-uniform grids
Part of a wider set of changes to Grid and Pixel snapping in the
UV Editor.

This change fixes snapping behavior for non-uniform grids, either
manually specified Fixed grids, or pixel grids where the underlying
image is non-square.

See a24fc6bbc1 for visual changes.

Maniphest Tasks: T78391

Differential Revision: https://developer.blender.org/D16275
2022-10-18 16:05:30 +13:00
c7051192e2 UI: Improve tooltip for texture shading mode
Pointed out in T98506
2022-10-17 22:57:10 -04:00
85875455b9 Fix T101872: Curves sculpt deform node crash with changed curve count
There might be more or fewer curves in the input to the deform curves on
surface node than the original, so the curve's surface UV coordinates
need to be retrieved from the original curves.
2022-10-17 17:08:09 -05:00
161aa5e0d0 Fix T101882: Division by zero in mesh topology nodes
A vertex might be connected to no edges or no faces. Most of these nodes
worked fine in that case, but we might as well make that explicit
and skip the sorting anyway.
2022-10-17 16:51:42 -05:00
e8291f4504 Sculpt: Remove face sets from default cube
As discussed in T101623, since face sets have become optionally stored,
(see b5f7af31d6) the default cube shouldn't have face sets--
they should be created explicitly by the user instead. This may improve
performance when modifying the default cube mesh.
2022-10-17 13:18:25 -05:00
23ea72f051 Cleanup: Move versioning_defaults.c to C++ 2022-10-17 13:18:25 -05:00
603a534f09 Fix T101850: Cycles DDS oversaturation when alpha is in use
DDS files coming through OIIO needed a similar treatment as TGA in
T99565; just for DDS OIIO just never set the "unassociated alpha"
attribute. Fixes T101850.

Reviewed By: Brecht Van Lommel
Differential Revision: https://developer.blender.org/D16270
2022-10-17 21:03:37 +03:00
728451f01a Fix T101871: Realize instances node can skip material indices
The node only created a material index attribute on the result mesh
if it existed on any of the input meshes. But the input meshes might
not have the attribute if they had a single material or no materials.
As a fix, also create the attribute if the result has more than one
material.
2022-10-17 12:21:30 -05:00
Jason Fielder
d3b47fa842 FIX T101445: halo Particles are not working.
color uniform assignment needing to be changed to ucolor was missed.

Ref T101445

Reviewed By: fclem

Maniphest Tasks: T101445

Differential Revision: https://developer.blender.org/D16236
2022-10-17 17:46:51 +02:00
694481095b Fix for T101506: BLF Disable Kerning in Main Font
Disable kerning in our main font to exactly restore the spacing of text
as seen in Blender 3.1 - 3.3

See D16186 for more details.

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

Reviewed by Brecht Van Lommel
2022-10-17 08:35:11 -07:00
660c47596e Weight Paint: relax heuristic to determine when final mesh can be used.
Checking for polygon and loop data to be referenced is too fragile
re changes in geometry node implementations. Instead, compare counts
of polygons, face corners and vertices: topology changes are unlikely
to keep all three unchanged.

Ref D15501
2022-10-17 16:48:29 +03:00
1111af5cb4 Sculpt: add versioning for Auto-masking cavity factor default
Also remove automasking_cavity_factor default from RNA for brushes.
Data-blocks set their defaults via `DNA_brush_defaults.h`

Continuation from previous commit and rBdb40b6

Thanks to Dalai for the help!
2022-10-17 14:47:58 +02:00
0a35afbf86 Fix T99565: Cycles reading TGA files with alpha different than Blender
Thanks to Lukas for tracking down the cause in OIIO.
2022-10-17 14:34:25 +02:00
3eaf2b7fc6 Fix OpenPGL and OneAPI being detected by CMake when Cycles is disabled 2022-10-17 14:34:25 +02:00
baa9a00f5f Fix Wayland not being disabled when dependencies are not found 2022-10-17 14:34:25 +02:00
390cf2fe75 Cleanup: compiler warnings 2022-10-17 14:34:25 +02:00
69e7274d4f Brush: Fix mismatch in DNA Brush defaults
Missed changing the DNA brush default in rBdb40b6

Thanks to SteffenD for reporting in blender.chat!
2022-10-17 14:11:21 +02:00
e96ad822b3 Fix AssetCatalogTest failure on WIN32
Recent changes to path handling (most likely [0]) caused
AssetCatalogTest.create_catalog_after_loading_file to fail on WIN32.

The test relied on the resulting path to be joined with "/" as a path
separator. The resulting path used both forward and back-slashes.
While these do work for some API's on WIN32, mixing both in a file path
isn't expected behavior in most cases, so update the tests to use native
slash direction for file-paths.

[0]: 9f6a045e23
2022-10-17 21:27:05 +11:00
Iliya Katueshenock
a6b83617e9 Fix T101705: crash when connecting reroute to multi-input socket
Differential Revision: https://developer.blender.org/D16203
2022-10-17 12:00:09 +02:00
e5425b566d Geometry Nodes: separate Instances from InstancesComponent
This makes instance handling more consistent with all the other geometry
component types. For example, `MeshComponent` contains a `Mesh *` and
now `InstancesComponent` has a `Instances *`.

Differential Revision: https://developer.blender.org/D16137
2022-10-17 11:39:58 +02:00
Pablo Vazquez
db40b62252 Sculpt: Auto-masking UI improvements
Add auto-masking as a popover in the header while in Sculpt mode,
following the design in T101593.

These properties were present in the Options panel (and popover),
they have been removed from there.

Moreover, this commit makes the auto-masking section in Brush settings
match the new popover.

In the future this popover can be used for other modes that support
auto-masking such as Grease Pencil.

See D16145 for details and screenshots.

Reviewed By: JulienKaspar

Differential Revision: https://developer.blender.org/D16145
2022-10-17 11:23:16 +02:00
11bb38e887 Make sure all dependency graphs are updated on particles system copy 2022-10-17 11:03:21 +02:00
89effac57e Fix T101851: Duplicating a particle system crashes 2022-10-17 11:02:13 +02:00
3e35beae61 Cleanup: correct doc-string & remove unused define
Minor edits to recent commits.
2022-10-17 12:41:56 +11:00
94ce176e75 Cleanup: renaming GHOST/Wayland functions & private members
- Use `_` suffix for private members.
- Use `wl_` prefix for Wayland native types to help distinguish
  them from local types.
- Replace single character names `d` & `w` with `display` `window`.
- Rename `selection` to `clipboard`. Using the primary selection as a
  clipboard is a separate and as yet unsupported feature.
2022-10-17 12:25:40 +11:00
9f6a045e23 Cleanup: replace BLI_join_dirfile with BLI_path_join
These functions are almost identical, the main difference being
BLI_join_dirfile didn't trim existing slashes when joining paths
however this isn't an important difference that warrants a separate
function.
2022-10-17 11:38:54 +11:00
1d1cade9a9 BLI_path: remove trailing NULL argument to BLI_path_join
Using varargs had the disadvantages, replace with a macro which has
some advantages.

- Arguments are type checked.
- Less verbose.
- Unintended NULL arguments would silently terminate joining paths.
- Passing in a NULL argument warns with GCC.
2022-10-17 11:16:41 +11:00
2f3f208901 Cleanup: spelling in comments, unused arg warning 2022-10-17 11:16:39 +11:00
6ad04a031c Cycles: Fix floor intrinsic for ARM Neon 2022-10-17 01:13:43 +02:00
25e84334f7 Sculpt: Fix T101864: Mask initialization not updating multires data
BKE_sculpt_mask_layers_ensure now takes a depsgraph argument and
will evaluate the depsgraph if a multires mask layer is added.
This is necassary to update the multires runtime data so that
pbvh knows it has a grids mask layer.

Also added code to update pbvh->gridkey.
2022-10-16 13:24:26 -07:00
Monique Dewanchand
4c320e2639 Fix T101394: Ensure all viewlayers on scene copy.
When a scene copy is called, all viewlayers are ensured before they are
copied. In case of multiple viewlayers, a viewlayer can be out of sync.
This triggers an assert in the BKE_view_layer_copy_data.

Reviewed By: mont29

Maniphest Tasks: T101394

Differential Revision: https://developer.blender.org/D16214
2022-10-16 11:24:07 +02:00
0c50f9c4aa Fix T98672: Noise texture shows incorrect behaviour for large scales
This was a floating point precision issue - or, to be more precise,
an issue with how Cycles split floats into the integer and fractional
parts for Perlin noise.
For coordinates below -2^24, the integer could be wrong, leading to
the fractional part being outside of 0-1 range, which breaks all sorts
of other things. 2^24 sounds like a lot, but due to how the detail
octaves work, it's not that hard to reach when combined with a large
scale.

Since this code is originally based on OSL, I checked if they changed
it in the meantime, and sure enough, there's a fix for it:
https://github.com/OpenImageIO/oiio/commit/5c9dc68391e9

So, this basically just ports over that change to Cycles.

The original code mentions being faster, but as pointed out in the
linked commit, the performance impact is actually irrelevant.

I also checked in a simple scene with eight Noise textures at
detail 15 (with >90% of render time being spent on the noise), and
the render time went from 13.06sec to 13.05sec. So, yeah, no issue.
2022-10-16 02:34:10 +02:00
b898330c37 Fix T99450: Animated Holdout not updating on frame change
Problem here was that layer_collection_objects_sync wasn't called when
the holdout property is updated due to frame change, so the changed
visibility flag was never applied to ob->base_flag.

Turns out there's no real reason to handle the per-object holdout
property through the layer system. So, instead of merging both the
layer holdout and object holdout into base_flag and checking that
from the render engines, only handle the layer holdout (which can't
be animated, so no issue here) through base_flag and explicitly also
check the object holdout in the render engines.
2022-10-15 23:11:20 +02:00
ebe9804cfa Cleanup: comment out unused lambda parameter 2022-10-14 23:03:10 -07:00
b7ea79fde7 Sculpt: Fix face set relax being too strong 2022-10-14 23:00:13 -07:00
c207571d44 Sculpt: Fix draw artifacts when drawing multires mask 2022-10-14 22:51:45 -07:00
010c10febe Sculpt: Ensure faces are uniquely assigned to PBVHNodes
PBVH_FACES and PBVH_GRIDS do not store faces directly in nodes;
instead they store 'primitives', which are tesselation triangles
for PBVH_FACES and grids (which are per-loop) for PBVH_GRIDS.

Primitives from the same face could sometimes end up in different
PBVH nodes.  This is now prevented in two ways:

* All primitives of the same face are given the same boundary
  during PBVH build.  This prevents them from being swapped
  away from each other during partitioning.
* build_sub adjusts the final partition midpoint to fall
  between primitives of different faces.
2022-10-14 22:08:36 -07:00
bc06fcca47 Sculpt: do not validate PBVH draw data in mesh_batch_cache_valid
Turns out PBVH drawing and normal mesh batches are not mutually
exclusive inside the draw cache; there are edge cases with modifiers
and instancing where you need both, and forcing one or the other
inside this function leads to memory corruption.
2022-10-14 15:00:42 -07:00
7a005e089d Sculpt: fix crash when instancing sculpt objects 2022-10-14 15:00:42 -07:00
2111fab88a Fix: Missing part of previous BMesh bug fix
Missed actually using the variables from 6f190c669f.
2022-10-14 16:26:49 -05:00
6c4b72b135 Fix T101746: Node copy and paste changes multi-input socket order
The multi-input indices have to be copied, and updated after
pasting in case all original connected nodes weren't copied.
2022-10-14 14:18:59 -05:00
Sebastian Herholz
a90b0eb772 Deps: Updating OpenPGL 0.4.0 hash value 2022-10-14 21:10:55 +02:00
e3de5af135 Fix wrong Cycles default radius for motion blurred point clouds
Missing from recent commit to change the default in a6db2c2.
2022-10-14 19:51:28 +02:00
9e77f5f17f Fix T101803: Max length Operator bl_idname is truncated 1 character.
There were quite a few issues here:
* Bad usage of nagic number leading to confusing code
* Forgetting to take into accoun final `NULL` char
* RNA code thinkin `bl_idname` is python version, when it is actually
  BL/C version.
2022-10-14 18:35:28 +02:00
4112f0241b Fix: Draw: Initialize StencilSet in the correct order
tmp
2022-10-14 17:00:13 +02:00
Jun Mizutani
f940ecde7a Cleanup: Fix wrong comment of breadcrumb tree path
The breadcrumb of tree path in node editor is displayed on the top of the editor.

Reviewed by: PratikPB2123

Diff: https://developer.blender.org/D14994
2022-10-14 19:19:47 +05:30
Charlie Jolly
84d70de25a Fix: Muted curves connect to the Fac socket
Resolve by setting no_muted_links() on Factor sockets.

Same issue as T101613

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D16153
2022-10-14 14:21:58 +01:00
58324f0c86 Cycles: oneAPI: Make test kernel more representative
Test kernel will now test functionalities related to kernel execution
with USM memory allocations instead of with SYCL buffers and accessors
as these aren't currently used in the backend.
2022-10-14 11:22:11 +02:00
5d53e6b3c1 Deps: include libxkbcommon-devel for Linux build script, remove wayland
- Include libxkbcommon headers: needed for building Blender with Wayland.
- Remove Wayland libraries (now wayland is built locally).
- Split up packages into two lists, one for building libs,
  another for building Blender - since it's useful to be able to build
  Blender, testing the libs work as expected.
2022-10-14 19:12:11 +11:00
06081d48e3 Deps: add comments noting why packages are installed
Some don't seem to be needed anymore, noted these in comments too.
2022-10-14 18:59:12 +11:00
b2ab9977bf Deps: use the locally built wayland-scanner for wayland_protocols
This removes the dependency on wayland-devel, with some potential
for errors caused from using two different versions.

Note that the generated files are currently unchanged.
2022-10-14 18:59:11 +11:00
695614ad3b Fix T101805: Blender icons doesn't show in GNOME 43
Use an app_id that matches the naming for the `.desktop`
file distributed with Blender.

Follow up to T101779.
2022-10-14 16:53:41 +11:00
e4e80058c8 Cleanup: simplify calculation of NDOF pan/zoom in 2D views
Make the logic for converting NDOF Z-motion to a scale value more
straightforward. Flipping the Z axis was scaling by negative-time,
now the entire pan vector is scaled by time and the zoom value is
calculated as `scale = 1 - (z * time)` instead of `1 + (z * -time)`.
Although they're equivalent, confusion here caused T100953.

Also clamp the scale (while unlikely, negative scale wasn't prevented).
2022-10-14 16:32:59 +11:00
1fbd300adb Fix: Curves sculpt adding resets attribute values
Error in 9088a1f476.
2022-10-13 18:21:39 -05:00
e8eed82bd5 Cleanup: Small changes to curves draw cache
- Remove unused include
- Avoid repeating blender:: namespace
- Remove timer left in by mistake in previous commit
2022-10-13 17:40:30 -05:00
98aa7276c8 Curves: Multithread position vertex buffer extraction
On a Ryzen 3700x I observed a 4ms improvement (from 5ms to 1ms)
on every redraw when sculpting with 88000 curves.
2022-10-13 17:21:23 -05:00
1703a8fb33 Build: Add TBB define to BMesh module
Allows using BLI_task.hh to write multithreaded code.
2022-10-13 14:48:35 -05:00
6beeba1ef5 Nodes: Duplicate Linked operator + User Preference option for Node Tree
This operator (Alt + D) allows users to explicitly create a linked copy
of a group node (same current behaviour for the Duplicate operator).

The duplicate operator (Shift + D) now takes the new User Preference
duplicate data option for Node Tree into account. It is by default
disabled, leading to no functional change for users.

Although we could make in the future make this option "on" by default,
to make it consistent with the rest of Blender we do not at the time.

Differential Revision: https://developer.blender.org/D16210
2022-10-13 20:06:20 +02:00
a5d3b648e3 Outliner: Use row background color for elements count indicator
From T101799:

Currently, the count indicator background and color are hardcoded to
black and white in an attempt to maximize contrast, at the expense of
being too prominent even when not needed.

Changing the background color to match the row (or any other element)
background, would make it look like the data-block icon is masked
out, improving readability while not standing out too much.

The circle background color should not have transparency, as it does
now. And the text inside should match the color of the text used for the
parent element (instead of hardcoded white). This should make it look
good in any theme.

---

Before:
{F13674265, size=full}

After:
{F13674269, size=full}

Differential Revision: https://developer.blender.org/D16246
2022-10-13 20:05:28 +02:00
6f190c669f Fix: Attribute layers can be skipped in Mesh to BMesh conversion
In some situations, layers were filled with their default value
when converting from Mesh to BMesh (entering edit mode, for example).
This was caused by the recently added "copy mesh to bmesh" or "merge
mesh to bmesh" custom data functions creating a difference custom
data format than was used for the copying functions used later.

`CustomData_to_bmesh_block` is not robust enough to handle simple
differences in layout between the layout of the source and result
CustomData layers, because it relies on the order of the types and
the number of layers within each type.

As a fix, make the "mesh to bmesh" special case more explicit in
the conversion functions. This makes the difference in the API
smaller, which is a nice improvement anwyay.

Fixes T101796
2022-10-13 12:43:04 -05:00
Sebastian Herholz
b2627dff49 Build: Upgrading OpenPGL version to 0.4.0 2022-10-13 17:45:14 +02:00
afd30e5e3a Fix: Crash updating draw cache of original curves data
Error in c67e5628d2 which mistook clearing
the pointer for clearing the values in the struct.
2022-10-13 09:37:12 -05:00
d292d635ea install_deps: Add system libdecor dev package.
ref. T101403
2022-10-13 14:49:29 +02:00
1a9480cf25 Realtime Compositor: Keep interpolation in Scale node
Currently, the scale node always changes the interpolation of its result
to bilinear. This was done because the scale node does not have an
interpolation option, unlike the Transform node, so a default of
bilinear was assumed. This turned out to be problematic, because in the
pixelation use cases, a nearest interpolation is typically preferred by
the user.

This patch changes the default interpolation of input nodes to bilinear,
makes the scale node keep the interpolation of the input it receives,
and makes the pixelate node changes the interpolation to nearest. In
effect, for non-pixelation use cases, the default bilinear interpolation
will be used, and for pixelation use cases, the nearest interpolation
will be used unless explicitly specified using a node that sets the
interpolation.
2022-10-13 12:42:43 +02:00
cbe1c1474b Fix T101501: Masks are not visible in Image Editor
Need to initialize the mask drawing overlays when the new space
is created. Otherwise the new space is configured in a way that
the splines are not visible and overlay opacity is 0.

This change fixes the new masking files created. The currently
saved ones need a manual tweak.
2022-10-13 12:26:36 +02:00
f95071028c UI: Fix wrong error message when trying to apply modifier
The error message when trying to apply a constructive modifier on a curve
object was wrong, "transform" makes no sense in this context.

Thanks Philipp for pointing it out!
2022-10-13 12:24:03 +02:00
4767a8eb4a Cleanup: simplify uv packing api
Affects paint.add_simple_uvs

No user visible changes.

Differential Revision: https://developer.blender.org/D16231
2022-10-13 23:07:12 +13:00
057e99d6df Cycles: use one instance of oneAPI gpu compiler by default
This change removes CMake code for automatic calculation of the number
of offline device compiler instances, to hand over control to developers
instead as it incurs a rather large memory usage with around 8GB per
instance at peak.
Use SYCL_OFFLINE_COMPILER_PARALLEL_JOBS CMake variable to configure it.
2022-10-13 10:49:30 +02:00
Werner, Stefan
c32a455605 Cleanup: Fixed some warnings
Some unused parameters were left after changing the oneAPI device code
to be a direclty linked shared library.
2022-10-13 09:45:53 +02:00
fabf4ee33d Fix T100699: Older preferences from 2.93 wont load
Even though this was intentionally removed in [0], loading data from
older startup files is supported. So show them when available.

[0]: 45439dfe4c
2022-10-13 17:36:30 +11:00
c67e5628d2 Cleanup: Use std::mutex for mesh runtime mutexes
Instead of allocating three separate ThreadMutex pointers,
just embed std::mutex into the struct directly.
2022-10-12 22:31:50 -05:00
375dafe3ef Build: use bash for build environment script
- Prefer bash over sh to so it's unambiguous which features can be used.
- Use array syntax to specify main package list, allowing to comment
  why packages are required and making git-blame easier to track down
  commits that add/remove packages.
- Add license header.
2022-10-13 13:20:58 +11:00
c34c6d3e25 Mesh: Move runtime data out of DNA
This commit replaces the `Mesh_Runtime` struct embedded in `Mesh`
with `blender::bke::MeshRuntime`. This has quite a few benefits:
- It's possible to use C++ types like `std::mutex`, `Array`,
  `BitVector`, etc. more easily
- Meshes saved in files are slightly smaller
- Copying and writing meshes is a bit more obvious without
  clearing of runtime data, etc.

The first is by far the most important. It will allows us to avoid a
bunch of manual memory management boilerplate that is error-prone and
annoying. It should also simplify future CoW improvements for runtime
data.

This patch doesn't change anything besides changing `mesh.runtime.data`
to `mesh.runtime->data`. The cleanups above will happen separately.

Differential Revision: https://developer.blender.org/D16180
2022-10-12 20:55:57 -05:00
b3e6a2888a Point Cloud: Support applying modifiers
The geometry nodes modifier can now be applied on point cloud objects.
This is basically a copy of the logic from 96bdd65e74
and 538da79c6d.
2022-10-12 19:16:37 -05:00
99f88281df Fix T101776: wrong logic for GLX setSwapInterval
Regression in 93e4b15767.
2022-10-13 10:27:22 +11:00
3980af7453 Fix T101779: Incorrect app_id on Wayland
Using the title as the app_id prevented the proper icon being used
under KDE-Plasma.
2022-10-13 10:10:26 +11:00
a481eb5576 Cleanup: Use correct blenkernel namespace for mesh functions 2022-10-12 17:41:35 -05:00
6c4210b97b Draw: Add missing TBB define to draw module
Allows improving performance with BLI_task.hh in draw extraction code.
Threading added in c15a63d21e improved performance by 3-4x
for me, but didn't make a difference until now.
2022-10-12 16:51:29 -05:00
7f921032c2 Cleanup: Remove deprecated socket variables
Last used in 62421470ee.
2022-10-12 16:10:06 -05:00
bcc56253e2 Fix T95683: FFmpeg seeking is broken
According to information I gathered, ffmpeg seeks internally using DTS
values instead of PTS. In some files DTS and PTS values are offset and
ffmpeg fails to seek correctly to keyframe located before requested PTS.

This issue become evident after hardcoded preseek of 25 frames was
removed and effort went into more precise seeking to improve
performance. It was thought, that this is bug in ffmpeg code, but
after reading some discussions, I don't think it is considered as such
by their developers, see below:
http://ffmpeg.org/pipermail/ffmpeg-devel/2018-March/226354.html
https://trac.ffmpeg.org/ticket/1189

Best solution seems to be to add small preseek value possibly at
detriment of performance, so 3 frames of preseek are applied. Number 3
was chosen experimentally.

Performance impact seems to be insignificant with this change.

Reviewed By: zeddb

Differential Revision: https://developer.blender.org/D15847
2022-10-12 20:10:15 +02:00
a1bc05b200 Nodes: Add "Legacy" to legacy node UI names, skip in search
Currently there is no way to tell that these node types are deprecated
in the UI. This commit adds "(Legacy)" to the end of the names.
It also makes it simple to skip these in the various node searches
more automatically than before.

Fixes T101700

Differential Revision: https://developer.blender.org/D16223
2022-10-12 12:31:38 -05:00
0d25169dc5 Fix T101711: Curve to points node sometimes skips initializing radius
Don't add the radius attribute to point clouds by default, since not
having a radius attribute should be a valid state. The radius is only
set when a radius attribute also exists on curves.
2022-10-12 12:29:25 -05:00
a6db2c22b1 Cycles: Use 0.01m as default point cloud radius
Currently Cycles uses zero as a default radius when no "radius"
attribute exists. This is more confusing than helpful. Instead,
use the same default radius as EEVEE and Workbench.
2022-10-12 12:23:23 -05:00
605f87256e Cleanup: Decrease variable scope in UI region popup code 2022-10-12 12:19:28 -05:00
ba67a383fa Cycles: Enable MNEE on Metal (macOS >= 13)
This patch enables MNEE on macOS >= 13. There was an inefficiency in the calculation of spill requirements, fixed as of macOS 13. This patch also adds a temporary inlining workaround for a Metal compiler bug which causes `mnee_compute_constraint_derivatives` to behave incorrectly.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16235
2022-10-12 17:06:50 +01:00
d586f8962d Cleanup: EEVEE-Next: Add precision to comment 2022-10-12 17:39:23 +02:00
0610fc38b9 DRW: View: Expose matrices through interface 2022-10-12 17:39:23 +02:00
7a9a83f4a0 DRW: Wrappers: Add TextureRef to wrap around GPUTexture pointers
This adds the possibility to use the C++ API for other GPUTexture.
2022-10-12 17:39:23 +02:00
b249b3658c DRW: Fix gl error related to incorrect uniform size 2022-10-12 17:39:23 +02:00
4552924dcc Cleanup: DRW: Improve state_stencil documentation 2022-10-12 17:39:23 +02:00
aa5ce2fcc1 Cleanup: Use const vertex pointer argument 2022-10-12 10:08:10 -05:00
e38377d690 Cleanup: Reduce variable scope in vertex group mirror operator
Combined with the previous cleanup, this would have prevented T101773.
2022-10-12 10:04:54 -05:00
7e4786503c Cleanup: Remove macro usage in vertex group mirror operator
Avoiding a few lines of duplication is not worth the
confusion and worse debugging experience of macros.
2022-10-12 09:52:06 -05:00
a35d5378ad Fix T101773: Mirror Vertex Weights operator broken 2022-10-12 09:48:07 -05:00
a379fce14b Fix T101679: Duplicate objects are created when 'Make' override is called on existing override in 3DView
When the active selected object in the 3DView is already a local
liboverride, only perform the 'clear system flag' process on selected
objects, there is no point in trying to create an override out of it.
2022-10-12 11:45:25 +02:00
872a45f42b ImageEngine: Clamp image data to fit half float range.
When image data exceeds half float ranges values are set to +/-
infinity that could lead to artifacts later on in the pipeline.
Color management for example.

This patch adds a utility function `IMB_gpu_clamp_half_float`
that clamps full float values to fit within the range of
half floats.

This fixes T98575 and T101601.
2022-10-12 08:56:14 +02:00
78634b1fd1 Cleanup: minor edits to recent wayland/libdecor
Remove asserts committed by accident & simplify preprocessor checks.
2022-10-12 17:23:51 +11:00
f0e1089a33 GHOST/Wayland: only require libdecor when running in gnome-shell
- Support switching between libdecor and xdg_shell at run-time.

- Require libdecor when using gnome-shell, otherwise use xdg_shell.

- Gnome-shell detection checks for a gtk_shell* interface which
  isn't ideal however it's not possible to check server-side-decorations
  are supported without first creating a window.

- Unload Wayland libraries when Wayland fails to load.
2022-10-12 17:01:52 +11:00
0f60872461 Cleanup: Simplify node insert after drag code
- Give functions and variables more descriptive names
- Use references for arguments
- Use tree topology cache to avoid iterating over all links
- Group related code together
2022-10-11 20:33:31 -05:00
b9e4d930b3 Cleanup: use 'u' prefixed unsigned types 2022-10-12 10:39:12 +11:00
3f64b88684 Cleanup: use function style casts for C++, format & spelling 2022-10-12 10:39:12 +11:00
984b279ef1 Cleanup: use commented arguments for unused args in C++ 2022-10-12 10:39:12 +11:00
89bd261d9e Cleanup: Convert two nodes files to C++ 2022-10-11 18:17:37 -05:00
a80b1adc10 Cleanup: Comment formatting in BMesh operator 2022-10-11 18:17:37 -05:00
f5e6d4e4b0 Cleanup: Remove link drag search operations for socket templates
Besides texture nodes, which aren't supported anyway, we don't have any
builtin nodes that still use the socket template system, so this can be
removed.
2022-10-11 18:17:37 -05:00
37d83f0095 Cleanup: Reduce indentation in node attach operator 2022-10-11 18:17:37 -05:00
b7decab07e UV: add grid shape source to the uv editor, and add new "pixel" option
This change is part of a wider set of changes to implement Grid and Pixel
snapping in the UV Editor. This particular change adds a new third option,
`pixel grid`, to the previous grid options, `dynamic grid` and `fixed grid`.

Maniphest Tasks : T78391

Differential Revision: https://developer.blender.org/D16197
2022-10-12 11:27:41 +13:00
c2256bf7f7 Fix T90782: add uv pack option to specify margin as a fraction
A refactor of the margin calculation of UV packing, in anticipation
of multiple packing methods soon becoming available.

Three margin scaling methods are now available:

* "Add", Simple method, just add the margin. [0]
    (The default margin scale from Blender 2.8 and earlier.)
* "Scaled", Use scale of existing UVs to multiply margin.
    (The default from Blender 3.3+)
* "Fraction", a new (slow) method to precisely specify
    a fraction of the UV unit square for margin. [1]

The "fraction" code path implements a novel combined search / secant
root finding method which exploits domain knowledge to accelerate
convergence while remaining robust against bad input.

[0]: Resolves T85978
[1]: Resolves T90782

Differential Revision: https://developer.blender.org/D16121
2022-10-12 11:05:34 +13:00
a376c4c3c3 Nodes: Change Mix node link drag weighting
This lowers the search weight for color-specific
mix functions on non-color sockets.

Reported in blender.chat by simonthommes

Differential Revision: https://developer.blender.org/D16228
2022-10-11 22:59:22 +01:00
7636fc06ea Cleanup: Move draw_cache_impl_volume.c to C++ 2022-10-11 13:01:13 -05:00
48fd4a01ef Sculpt: Fix mask from cavity not redrawing viewport with modifiers 2022-10-11 10:11:16 -07:00
7119582b66 Sculpt: Fix T101595: sculpt_attribute_update_refs called in wrong place
Needs to go after the assignment to ob->sculpt->pbvh, not before.
2022-10-11 09:58:43 -07:00
188786f0b0 Sculpt: Fix T101718: Automasking crash with new texture paint
* 'Original coordinates' mode can't be used in image paint mode
(it does nothing in this case anyway).
* SCULPT_automasking_factor_get now returns 1.0 if
  a PBVH_REF_NONE vertex reference is passed in.
2022-10-11 09:58:41 -07:00
65b42d8c57 Fix T101709: Proportional editing being disabled in NLA Editor redo panel
Do not save the "use_proportional_edit" property if it is not supported.
This prevents it from being automatically disabled.

And hide "use_proportional_edit" in `SPACE_NLA`
2022-10-11 12:47:50 -03:00
4fc4005f6b deps_builder: add missing openpgl config file
harvesting openpgl_Exports-debug.cmake was missing for
windows in the build script, and we manually added it
to svn when openpgl landed when we realized it was
missing.

This fixes the issue at the root of the problem, so
the file will not be missing for future updates.
2022-10-11 09:14:10 -06:00
Alaska
0048820df8 Fix T101601: Compositor/Set cryptomatte alpha to 1.
Cryptomatte uses alpha node, which was altered to by default
apply the alpha. This patch changes it back to replacing the
alpha.

Reviewed By: jbakker

Maniphest Tasks: T101601

Differential Revision: https://developer.blender.org/D16165
2022-10-11 16:59:37 +02:00
009acfa477 Cleanup: Add missing include for parallel reduction
The parallel reduction file didn't include its own header, which can
yield "no previous declaration" warnings. This patch includes the header
to fix the warning.
2022-10-11 16:22:14 +02:00
37461b8bdd Cleanup: Remove unused spreadsheet geometry cache item 2022-10-11 08:52:18 -05:00
be44fd9401 Fix SVG tests: Add missing file 2022-10-11 15:13:30 +02:00
223ba59cb0 Beginning of automated SVG regression test
This commit contains the CTest integration.

Starting with the very simple tests for the recent fixes in the
io_corve_svg addon which were related on closing path.

The idea is to use same framework as what we use for render tests
to make it easily visible what aspect of SVG changed or broke.

In order to achieve this both .blend and .svg files are used.
The .svg file defines the exact subject of test, and the .blend
file defines camera, and possibly material.

The longer term idea is to have a number of atomic tests for a
specific SVG features to help isolating problematic areas, as
well as a more comprehensive tests to perform QA.
2022-10-11 15:03:09 +02:00
c425599216 Fix linker order of X11 and Wayland libs
For some compiler and linker configurations, linking would fail as the
wayland libs were linked at a high level and not at the actual code
where they were needed.

After talking to Campbell, we decided to clean up this part and now
only link both the X11 and Wayland libs where they are used.
2022-10-11 14:52:35 +02:00
50943f5dc7 Realtime Compositor: Implement variable size bokeh blur
This patch implements the variable size blur option in the Bokeh Blur
node. The implementation is different from the CPU one in that it also
takes the Bounding Box input into account, which is ignored for some
reason for the CPU. Additionally, this implementation does not do the
optimization where the search radius is limited relative to the maximum
value in the size texture. That's because the cost of computing the
maximum is not worth it for most use cases.

The reference implementation does three unexpected things that are
replicated here nonetheless. First, the center bokeh weight is always
ignored and assumed to be 1. Second the size of the center pixel is
taken into account. Third, a unidimensional distance is used instead of
a 2D euclidean one. Those need to be considered independently.

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

Reviewed By: Clement Foucault
2022-10-11 13:40:48 +02:00
0037411f55 Realtime Compositor: Implement parallel reduction
This patch implements generic parallel reduction for the realtime
compositor and implements the Levels operation as an example. This patch
also introduces the notion of a "Compositor Algorithm", which is a
reusable operation that can be used to construct other operations.

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

Reviewed By: Clement Foucault
2022-10-11 13:22:52 +02:00
f6a6992031 GPencil: Fix unreported Close Stroke operator did not select new points
When use the close stroke, the new created points were not addedd to the
selection.
2022-10-11 12:04:16 +02:00
Pratik Borhade
9a6dc39d4b Sculpt: Fix T101694: Change operator for unhide face sets
In 22c3db72ca `SHOW_ALL` has been removed from
`face_set_change_visibility`. Instead `SCULPT_OT_reveal_all` is now used
for unhiding all face sets.

Reviewed By: Joseph Eagar & Julian Kaspar
Differential Revision: https://developer.blender.org/D16199
Ref D16199
2022-10-11 02:49:45 -07:00
be27159527 Cleanup: rename base_index to ob_index in knife logic
This indexes the "objects" array, so rename 'b' and 'base_index'
to 'ob_index'.
2022-10-11 20:30:31 +11:00
2590626e77 Fix T101741: GPencil Outline modifier removes unexpectedly strokes
The stroke could be tagged before modifier and was removed due  the tag.

Now, the tag is reset before to avoid this problem.
2022-10-11 11:20:48 +02:00
2bacf1cb26 Fix T101721: Knife project crashes
The crash was caused by [0] however knife-project functionality has been
incorrect since [1] which would loop over each edit-mode object and run
the knife project function which operated on all edit-mode objects too.

- Resolve the crash by postponing face-tessellation recalculation
  until the knife tool has cut all objects

- Objects occluding each other is now supported
  (an old TODO and something that was never supported).

[0]: 690ecaae20
[1]: 6e77afe6ec
2022-10-11 20:19:13 +11:00
70ef334f08 GHOST/Wayland: correct the library path for libwayland-egl
Systems without `libwayland-egl.so` (Fedora 37 beta) failed to start,
as the name `libwayland-egl.so.0` wasn't correct.
2022-10-11 17:08:18 +11:00
9cd99684b0 Py Docs: Update to sphinx 5.2.3
Notable change is the improvements made to search.
2022-10-10 23:17:23 -04:00
b51d337adc GHOST/Wayland: print all dynamic loading failure when using Wayland
Previously only failure to dynamically load libdecor would report a
warning. Now report failure to load all Wayland libraries.

This was done because Wayland libraries (besides libdecor) are likely to
be installed on systems running Wayland. However it makes it difficult
to troubleshoot failure to load Wayland on systems with libdecor.

Only silence Wayland dynamic loading warnings when Wayland isn't running.
2022-10-11 11:14:40 +11:00
f495939e6e Correct argument type for BKE_pbvh_node_get_bm_orco_data, format 2022-10-11 11:06:32 +11:00
7f133b7a38 Sculpt: Clean up Dyntopo's original triangle api
Cleaned up Dyntopo original triangle API (which is deprecated):

* BMVerts for original triangles are now stored.
* BKE_pbvh_bmesh_update_topology now handles original triangle
* data properly.
* BKE_pbvh_bmesh_node_save_orig can now initialize the original
  coordinates from the current BMLogEntry.
* Ray casting of original data now returns active vertex.
  Should fix various random crashes.

Hopefully this will fix a number of bugs.
2022-10-10 14:45:48 -07:00
dc1418e5d9 Sculpt: Fix T101674: Passing null to GPU_batch_elembuf_set 2022-10-10 14:08:02 -07:00
da25006bc4 Sculpt: T101699: Face set change visibility crashes on no face sets
Cleaned up sculpt_face_sets_change_visibility_exec some more:

* SCULPT_UNDO_HIDDEN is now pushed instead of SCULPT_UNDO_FACE_SETS
  (since face sets no longer encode visibility).
* Added branches for if face sets do not exist.
* Cleaned up independent if statements into a switch.
2022-10-10 13:34:37 -07:00
473df37134 Sculpt: Fix T101729: Automasking crash in elastic deform brush
Was missing a call to SCULPT_automasking_node_update.
2022-10-10 13:05:43 -07:00
9b8be81eef deps_builder: Add support for cve-bin-tool
This change adds support for intels cve-bin-tool [1]
in the deps builder. This adds 2 new targets to the
builder that do not build automatically but can be
build on demand when required.

`make cve_check` will output to the console.
`make cve_check_html` will output a html file that
can be shared with other people.

Requirements:

- A working installation of cve-bin-tool on the system

Not required but higly recommended:

- Obtaining a key from the nvd [2] to speed up the
  database download. you can pass the key to cmake
  using `-DCVE_CHECK_NVD_KEY=your_api_key`

[1] https://github.com/intel/cve-bin-tool
[2] https://nvd.nist.gov/developers/request-an-api-key

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16160
2022-10-10 11:48:05 -06:00
03fd2f7a5a Fix building WITH_HEADLESS
An earlier commit removed the '#ifdef' check for the function call but not for
the function declaration.
2022-10-10 18:16:29 +02:00
9a8746dff1 Cleanup: clang-format 2022-10-10 17:57:25 +02:00
95aac5df73 Fix T101651: Cycles crashes when failing to initialize render device
The issue here was that PathTraceWork was set up before checking if
any error occurred, and it didn't account for the dummy device so
it called a non-implemented function.

This fix therefore avoids creating PathTraceWork for dummy devices
and checks for device creation errors earlier in the process.
2022-10-10 17:55:08 +02:00
Damien Picard
7d7318f6c5 I18n: disambiguate message "World"
The confusion is about World as an ID type, and the World coordinates.

Use no context for the latter, and either `BLT_I18NCONTEXT_ID_WORLD`,
or other more fine-grained contexts when needed as part of enums for the
former.

The message from the custom HDRI installation operator cannot be
disambiguated right now, because Python enums don't support contexts.

Ref T43295

Reviewed By: mont29

Maniphest Tasks: T43295

Differential Revision: https://developer.blender.org/D16194
2022-10-10 17:37:32 +02:00
Thibault de Villèle
962b647690 Cleanup: NLA transforms, simplify recalcData_nla()
Refactor the `recalcData_nla()` function, which takes data from the
transform system and updates NLA strips, such that the actual logic to
change the strip is moved into its own function.

This also moves some generic code (find prev/next strip) from that
function to BKE.

This is to make the code easier to adjust when different transform
operations need to perform different modifications of the strip (i.e. to
fix T101130).

Manifest Task: T101130

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D16181
2022-10-10 17:28:35 +02:00
82a5790d2a Cycles: oneAPI: Trigger compilation of used kernels only
JIT compilation of oneAPI kernels now happens during load stage
and proper message gets shown in the GUI during compilation.
Also, this implementation skips kernels that aren't needed for
the used scene, reducing overall (re)compilation time.
2022-10-10 16:38:11 +02:00
bb8dba8609 Fix missing view layer update when iterating a collection from Python.
The previous fix ignored the most fundamental access operation.

Follow up to 4a60c4746d fixing 68589a31eb.
2022-10-10 17:13:06 +03:00
Charlie Jolly
f5e1a2119d Node: Add blend modes to Mix node link drag search
Allows searching for Mix blend modes
e.g. Overlay when using link drag search

Requested by @simonthommes in GN chat

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D16209
2022-10-10 14:36:44 +01:00
25b745ae85 IO: support Presets in Alembic, Collada, OBJ, STL, USD importers
The exporters already had Preset functionality, but the importers
did not.
2022-10-10 16:01:18 +03:00
499af28a35 IO: remove BKE_layer_collection_resync_forbid & allow
Part of T101073: after the view layer sync was made lazy (D15885), the
BKE_layer_collection_resync_forbid and BKE_layer_collection_resync_allow
in Alembic/USD/OBJ importers is no longer needed, as long as they do
view layer dependent operations (selecting new objects) in a separate
loop after creating all the objects.

Verified that this does not regress import times for 26k objects OBJ
scene (Blender 3.0 splash) and 250k objects USD scene (Moana).
2022-10-10 14:06:54 +03:00
Damien Picard
b099cf73ae I18n: disambiguate or extract a few messages
Disambiguate:
- "Active Only" (GPencil copy material and layer, add NLA modifier)
- "Clip" (movie clip, image extension mode)
- "Emission" (particles)
- "New" (scene)
- "Tracking" (movie clip)

Extract:
- "ViewLayer", the default view layer name when creating new scene

Ref T43295

Reviewed By: mont29

Maniphest Tasks: T43295

Differential Revision: https://developer.blender.org/D16196
2022-10-10 13:03:26 +02:00
Damien Picard
9b2d682394 I18n: fix popup menus context
When calling `wm.call_menu_pie` and `wm.call_menu`, the menu context
was ignored when showing its name in the header or pie menu center.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D16195
2022-10-10 13:01:18 +02:00
9df9397ae8 EEVEE-Next: Fix surface deferred shader compilation in debug mode 2022-10-10 11:09:29 +02:00
f77eadc203 GHOST/Wayland: warn when falling back to X11 because of missing libdecor
X11 is used as a fallback when libdecor isn't found on the users system.

Now print a warning when Blender falls back to X11 and a missing
libdecor is the only reason wayland could not be used.

Only print this warning when using Wayland so this warning doesn't show
on X11 systems which have Wayland libraries installed.

Addresses T101715.
2022-10-10 19:50:33 +11:00
d855f5fdcd Fix typos & co in UI messages. 2022-10-10 10:36:15 +02:00
42b1a7d4c6 OBJ: add global scale factor import setting
Requested in D16095 proposal - also USD & Alembic have import scale
option; OBJ has an export scale object but the import scale
was not there for some reason.
2022-10-10 10:10:46 +03:00
a24f11e0ec UI: show the windowing environment in the "About" splash
Show the windowing environment on non MS-Windows/Apple systems,
since X11/WAYLAND are selected startup there was no convenient way
for users to know which back-end was being used.

Include the windowing environment in the About splash & system-info.txt
since it will be useful for handling bug reports.

This commit adds a private API call not intended for general use
as I would like to be able to remove this later and it's only needed
in the specific case of testing if Blender is using WAYLAND or X11
(which maybe be used via XWayland).

Python scripts can already inspect the system to check which windowing
environment used, the API call is mainly useful for troubleshooting.
2022-10-10 11:22:41 +11:00
210f4db81c Cleanup: spelling in comments 2022-10-10 11:22:41 +11:00
e0ad4712f6 Cleanup: quiet warnings, format 2022-10-10 11:22:41 +11:00
aaa731a782 Partially fix T101702: OSL Shaders with boolean inputs crash
OSL (like Cycles) has no internal boolean type, instead an integer
input can be flagged to be shown as a boolean in the UI.
Cycles reacts to this by creating a boolean socket on the Blender
side, but as a result incorrectly called the boolean overload of the
set function even though the internal type is an integer.

There's another unrelated crash in the GPU viewport shader code that
appears to apply to every OSL node that outputs a shader, and the file
in T101702 triggers both, so this is only a partial fix for the report.
2022-10-10 01:03:12 +02:00
bd2f002e71 Fix T101685: OBJ importer does not assign proper material if "usemtl" is before "o"
The importer logic was wrongly resetting "current material name"
upon encountering a new object ("o" command). However as per OBJ
specification, this is incorrect:

> Specifies the material name for the element following it. Once a
> material is assigned, it cannot be turned off; it can only be
> changed.

Fixes T101685. Test coverage for this was added in svn tests repo.
2022-10-09 21:21:31 +03:00
c2fb85282d OBJ: extend importer tests to test imported material expectations
Previously "which material got assigned to an object in the end"
was not covered by tests. This is preparation for fixing T101685.
2022-10-09 20:52:23 +03:00
af34c13da4 Cleanup: Remove data duplication from large array in eevee_camera.hh
Use `inline constexpr` instead of `static const` to prevent these
variables from being duplicated in each translation unit that includes
the eevee_camera.hh header (was included into 17 different object files
with MSVC).

Differential Revision: https://developer.blender.org/D16200
2022-10-09 00:34:59 -07:00
cee6c07f9e Set operator poll message when vertex group is locked
Differential Revision: https://developer.blender.org/D16190
2022-10-08 11:43:38 -07:00
f61ff22967 Attribute Node: support accessing attributes of View Layer and Scene.
The attribute node already allows accessing attributes associated
with objects and meshes, which allows changing the behavior of the
same material between different objects or instances. The same idea
can be extended to an even more global level of layers and scenes.

Currently view layers provide an option to replace all materials
with a different one. However, since the same material will be applied
to all objects in the layer, varying the behavior between layers while
preserving distinct materials requires duplicating objects.

Providing access to properties of layers and scenes via the attribute
node enables making materials with built-in switches or settings that
can be controlled globally at the view layer level. This is probably
most useful for complex NPR shading and compositing. Like with objects,
the node can also access built-in scene properties, like render resolution
or FOV of the active camera. Lookup is also attempted in World, similar
to how the Object mode checks the Mesh datablock.

In Cycles this mode is implemented by replacing the attribute node with
the attribute value during sync, allowing constant folding to take the
values into account. This means however that materials that use this
feature have to be re-synced upon any changes to scene, world or camera.

The Eevee version uses a new uniform buffer containing a sorted array
mapping name hashes to values, with binary search lookup. The array
is limited to 512 entries, which is effectively limitless even
considering it is shared by all materials in the scene; it is also
just 16KB of memory so no point trying to optimize further.
The buffer has to be rebuilt when new attributes are detected in a
material, so the draw engine keeps a table of recently seen attribute
names to minimize the chance of extra rebuilds mid-draw.

Differential Revision: https://developer.blender.org/D15941
2022-10-08 16:43:18 +03:00
a716e69658 Cleanup: Use helper function for previous mesh loop 2022-10-07 22:46:52 -05:00
577a79b485 Cleanup: Fix outdated mesh data comments 2022-10-07 22:46:52 -05:00
f9ab2214ae Linux: enable WAYLAND by default
Enable the following CMake options:

- WITH_GHOST_WAYLAND
  Enable Wayland which is now included as part the bundled dependencies.
  When the pre-compiled libraries aren't used, only X11 will be enabled.

- WITH_GHOST_WAYLAND_DYNLOAD
  So systems without libwayland can fall back to X11.

- WITH_GHOST_WAYLAND_LIBDECOR
  To draw window frames on WAYLAND compositors such as gnome-shell which
  expect client-side decorations (without this the Blender window is
  borderless).

  Unfortunately there doesn't seem to be a reliable way to know if the
  compositors handles server-side decorations, so libdecor is required
  for Wayland to be used even with KDE and tiling compositors where it's
  not needed. Although this is an area that could use some further
  investigation - possibly bundling libdecor or handling client-side
  decorations in Blender.

The final part of D16091.
2022-10-08 13:26:33 +11:00
18c045a35f Build: show X11 & Wayland options on first run 2022-10-08 13:16:11 +11:00
Iliya Katueshenock
3d209d1619 Mesh: Multithread some boolean domain interpolation logic
This can improve performance by 3-10x in some simple test cases,
when reading a boolean attribute on a different domain from the
one it's stored on.

Differential Revision: https://developer.blender.org/D16054
2022-10-07 17:54:24 -05:00
af288a09a5 Viewport: Enable draw_debug.cc code when WITH_DRAW_DEBUG is on 2022-10-07 15:40:41 -07:00
Laurynas Duburas
f3f0ea8dc2 Curve: Retain active NURBS curve after point deletion
Before, the active spline index and the active point index were always
cleared. Now the active index is only cleared when the curve/surface is
deleted. This was accomplished by making the surface patch delete
function handle that correctly. The spline deletion already handled it.

This fixes only vertex deletion mode.
Fixes problem mentioned in T101160.

Differential Revision: https://developer.blender.org/D16133
2022-10-07 16:33:50 -05:00
d779792977 Build: reference bundled wayland and libdecor headers
When using pre-compiled libs, reference the bundled wayland headers,
needed so the headers from the bundled wayland-scanner are compatible.

Part of D16091.
2022-10-08 08:00:17 +11:00
66f184d981 Deps: add libdecor for Wayland window frames
Include libdecor, note that this only bundles a header file
as Blender dynamically loads on the system at run-time.

Part of D16091.
2022-10-08 08:00:08 +11:00
b083755c20 Deps: harvest Wayland headers, build Wayland libraries
The headers on centOS7 (Wayland 1.15) aren't compatible with the headers
generated by wayland-scanner 1.20.

Include the headers to support building Wayland on systems with
older Wayland installed.

Using these headers will be part of a separate commit.

Part of D16091.
2022-10-08 08:00:04 +11:00
f63179cc9f Fix T101424: Empty group node added to node add search
The group node type polls true, but adding an empty group node isn't
useful, so just skip it.
2022-10-07 12:32:23 -05:00
Nate Rupsis
f96b729d7b FIX T101275: Regression in NLA causes Actions to be ignored by Context menu (I.e influence, etc)
Reviewed By: sybren

Differential Revision: http://developer.blender.org/D16154
2022-10-07 11:03:24 -05:00
9cf2b413c2 Fix small errors in tool tips for path guiding
Contributed by Alaska.

Differential Revision: https://developer.blender.org/D16166
2022-10-07 17:59:22 +02:00
349091ce00 Cleanup: Move editmesh_undo.c to C++
To allow moving mesh runtime data to C++ (D16180).
2022-10-07 10:41:19 -05:00
1a5c57cdec Fix: One-API build issue on windows.
Flags were not properly passed to the
compiler.
2022-10-07 09:16:29 -06:00
bf85074148 GPencil: New Fill Extend lines adjust with MMB
The actual length of extension lines can be adjusted using wheel mouse 
but this is very inconvenient for tablet users.

Now, the extension can be adjusted using MMB of the pen.

There was a similar request in Right-Click Select

Reviewed By: Matias Mendiola, Daniel Martinez Lara

Differential Revision: https://developer.blender.org/D16128
2022-10-07 16:18:56 +02:00
3714d3c3ce Cycles: link oneAPI backend with debug version of sycl when in Debug
It fixes SYCL runtime issues in Debug builds that were due to mixing
Release and Debug MSVC runtimes.
This commit also removes specific handling of dpcpp compiler executable
to simplify the CMake implementation. Using it like clang++ works and
clang++ executable is also available from Intel oneAPI DPC++ compiler in
case it doesn't.
2022-10-07 16:14:50 +02:00
331f850056 Cleanup: redundant parenthesis 2022-10-07 22:55:03 +11:00
11abeae99f Cleanup: use function style casts for C++ 2022-10-07 22:55:03 +11:00
9dec9eee0d Cleanup: DRW: Rename ViewInfos to ViewMatrices
This makes sense now that the struct only contains matrices.
2022-10-07 13:15:22 +02:00
bae22ac7b4 DRW: Remove mouse_pixel and is_inverted from ViewInfos
This is part of the effor to simplify the View struct in order to implement
multiview rendering.

`mouse_pixel` is only use for debug purpose and will be reintroduced later.
`is_inverted` is moved to `draw::View`.
2022-10-07 13:13:23 +02:00
6fd557e2c2 DRW: Remove viewport_size from DRWView
This is part of the effor to simplify the View struct in order to implement
multiview rendering.
2022-10-07 12:43:10 +02:00
f8384485fc EEVEE-Next: Use global viewport size instead of DRWView one
This is part of the effor to simplify the View struct in order to implement
multiview rendering.
2022-10-07 12:43:10 +02:00
7b9ce3af98 GPencil: Use global viewport size instead of DRWView one
This is part of the effor to simplify the View struct in order to implement
multiview rendering.
2022-10-07 12:43:10 +02:00
f11b3ed9b0 Basic: Use global viewport size instead of DRWView one
This is part of the effor to simplify the View struct in order to implement
multiview rendering.
2022-10-07 12:43:10 +02:00
70b35c7ad0 Overlay: Use global viewport size instead of DRWView one
This is part of the effor to simplify the View struct in order to implement
multiview rendering.
2022-10-07 12:43:10 +02:00
126d485b83 DRW: Remove screen_vecs
These were only a normalized copy of the XY axes of the inverse viewmat.
But since the viewmatrix is always normalized we can use it directly.
2022-10-07 12:43:10 +02:00
a945cf4d0f DRW: Move clipping planes to their own UBO
This is part of the effor to simplify the View struct in order to implement
multiview rendering.
2022-10-07 12:43:10 +02:00
223f970407 EEVEE: Move reflection clip plane to local storage
This avoid dependency with the draw view.
2022-10-07 12:43:09 +02:00
a775e42dee DRW: Use view_clipping_distances instead of world_clip_planes_set_clip_distance
No functional change. `view_clipping_distances` is prefered as it is
auto masked.
2022-10-07 12:43:09 +02:00
8f96d0f732 DRW: Remove view vectors
This is part of the effor to simplify the View struct in order to implement
multiview rendering.

The viewvecs can easilly be replace by projection matrix operation.
Even if slightly more complex, there is no performance impact.
2022-10-07 12:43:09 +02:00
03a7f1d7b1 DRW: Move CameraTexCoFactors to engine specific storage
This is part of the effor to simplify the View struct in order to implement
multiview rendering.

The CameraTexCoFactors being only valid for a single view, and being only
used in very few places, it make sense to move it to the engine side.
2022-10-07 12:43:09 +02:00
055680a89e DRW: Split ViewCullingData out of ViewInfos
This is in order to reduce the size of ViewInfos and support multi view
rendering.
2022-10-07 12:43:09 +02:00
f43c2d9abe Armature Modifier: skip non-deforming vertices in Multi-Modifier mode.
The modifier already contained a check to skip complex processing of
vertices that won't produce any deformation due to the vertex group
mask, but this only works for the non-Multi Modifier case. This adds
a similar check for the Multi Modifier mode.

Differential Revision: https://developer.blender.org/D16152
2022-10-07 13:11:44 +03:00
f7a781d45f Fix T101547: Add update notifiers in dopesheet and timeline selection operators
Updates the function checking if a container can have grease pencil layer keyframes, to account for dopesheet in main mode, and timeline.

Reviewed By: Sybren A. Stüvel

Differential Revision: http://developer.blender.org/D16132
2022-10-07 11:44:27 +02:00
87ef423e6e Fix missing header include when using timeit feature. 2022-10-07 11:32:13 +02:00
412d670e9c Refactor: adding function to check if an animation container has grease pencil layer keyframes.
Used in action_select to refactor the selection operators.

No functional changes.

Reviewed By: Sybren A. Stüvel

Differential Revision: http://developer.blender.org/D16168
2022-10-07 11:07:02 +02:00
7eeeaec6da Cycles: use direct linking for oneAPI backend
This is a minimal set of changes, allowing a lot of cleanup that can
happen afterward as it allows sycl method and objects to be used outside
of kernel.cpp.

Reviewed By: brecht, sergey

Differential Revision: https://developer.blender.org/D15397
2022-10-07 09:50:05 +02:00
fc0b1627eb Fix T100953: Zooming with NDOF is inverted in the camera view
Use convention for applying zoom in other 2D views.
2022-10-07 17:46:25 +11:00
3522c6e59c Cleanup: replace static variables with arguments
Functions in vfontdata_freetype.c used static variables instead of
argument parsing. This originates from initial freetype support [0].

This didn't cause problems as callers use a global lock, however it
makes the code more difficult to follow means we can more easily remove
the lock in the future.

[0]: d4f9678b39
2022-10-07 16:44:13 +11:00
0d16625d35 Cleanup: use doxy sections
Also use doxy syntax for some comments.
2022-10-07 16:05:39 +11:00
650beef4b6 GHOST/Wayland: silence warnings for modifier key handling in GNOME
GNOME (mutter) intentionally doesn't follow the Wayland spec for the
keyboard_enter events (held keys are always an empty array).

This means we can't know which keys are held on window activation,
making the result of getModifierKeys invalid (in that we don't know
which modifiers are held).

Detect this situation and suppress warnings as the issue has been
reported and it doesn't help for users to see noisy warnings for
a known problem.
2022-10-07 15:53:47 +11:00
a0af1e3971 GHOST/Wayland: improve logging messages for keyboard events 2022-10-07 15:53:46 +11:00
cafd204af6 Cleanup: remove redundant 'using'
clang-tidy converts C-style typedefs to this style,
but the "using ..." isn't needed.
2022-10-07 14:36:35 +11:00
47d3e76567 3D View: depth sort candidates in the selection menu
Objects/bones in the selection menu weren't ordered usefully,
worse, the closest items could be left out of the menu since items
would stop being added once the menu-size limit was reached.

Resolve this by sorting the menu items by depth, removing the most
distant when the number of items exceeds the limit.

When Ctrl is held, order by the distance to the object center
instead of depth.
2022-10-07 13:26:43 +11:00
3b77d60b6c Cleanup: share factory reset properties 2022-10-07 13:19:13 +11:00
db2b889618 Cleanup: quiet compiler shadowed variable warning 2022-10-07 13:19:12 +11:00
104fd82f74 Fix for T101481: Improved VFont Loading
Remove redundancy in the testing and loading of VFont fonts. Includes
improved setting of character map for using Wingding and Symbol fonts.

See D16174 for more details.

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

Reviewed by Campbell Barton
2022-10-06 18:02:40 -07:00
781d03efe4 Preferences: support loading factory settings only for app-templates
When app-templates are enabled, support resetting defaults only for the
app-templates.

Without this, it's not possible to reset app-template preferences
without also resetting the default preferences for all settings the
app-template does not override (used when there is no application
template loaded, and other app-templates).

These additional menu items are shown in menus when an app-template has
been loaded.

Address issue raised by T96427.

Reviewed By: mont29, brecht

Ref D16150
2022-10-07 10:50:17 +11:00
4eb3e7ff86 Cleanup: compiler warning 2022-10-07 10:42:56 +11:00
ecc404ea1a Cleanup: spelling in comments 2022-10-07 10:42:56 +11:00
b04b87b322 Cleanup: Avoid inconsistent naming in mesh topology API
Mesh corners are called "loops" in the code currently. Avoid diverging
naming and just use that convention in some newly added code.
2022-10-06 17:35:02 -05:00
79b1e267ef Cleanup: Move subdiv_ccg.c to C++
In preparation for moving mesh runtime data to C++
2022-10-06 17:24:16 -05:00
406a98aff8 Cleanup: Move eight modifier files to C++
In preparation for moving mesh runtime data to C++.
2022-10-06 16:08:07 -05:00
53d937a170 Sculpt: Raise pbvh->leaf_limit to 400 for dyntopo
Setting pbvh->leaf_limit (the max triangles per node)
too low results in lots of distinct GPU meshes, which
can be slow for even moderately sized sculpt meshes
(starts to be a problem around 100-150k triangles).
2022-10-06 14:06:16 -07:00
dfa0eb298e Sculpt: Fix T101502: GPU tris miscounted for dyntopo
Dyntopo PBVH draw was miscounting the number of triangles.
2022-10-06 14:04:12 -07:00
eae3fa8730 Cleanup: Move subdiv_modifier.c to C++
In preparation for moving mesh runtime data to a C++ type
2022-10-06 15:48:02 -05:00
d4f77c2266 Cleanup: Move shrinkwrap.c to C++ 2022-10-06 15:48:02 -05:00
f58b524669 Sculpt: Fix bug in sculpt attribute api
SculptAttribute.domain wasn't being set
when creating from an existing CustomData
attribute.
2022-10-06 13:19:35 -07:00
65c8c83679 Fix: Properly free non-trivial node editor runtime type 2022-10-06 15:07:09 -05:00
14de57713d Cleanup: Remove unnecessary MOD_nodes.h includes 2022-10-06 15:07:09 -05:00
0d0e2dc0a8 DRW: fix use of potentially uninitialized variable
Bug introduced in rB6774cae3f25b.

This causes undefined behavior in `DRW_state_draw_support()` making
overlay depth drawing unpredictable.
2022-10-06 16:04:11 -03:00
be8ee05dcb Fix for T53332: BFont 43 Inaccessible Glyphs
Preloading of BFont (default for 3D Text Objects) glyphs will not load
any with a character code greater than 256, resulting in 43 characters
that are inaccessible. This patch corrects that preloading code.

See D16122 for more details

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

Reviewed by Campbell Barton
2022-10-06 10:36:57 -07:00
c592bff047 Animation: Expose "mute" for drivers in their properties UI
In the driver editor and the "edit driver" popover, add a checkbox that
can mute the driver. This is the same functionality as the checkbox in
the driver editor's channel list, but then exposed in a different place
in the UI.

This is for convenience, such that a driver can now be muted by
right-clicking on the driven property, choosing "Edit Driver", then
muting it there. The same checkbox was added to the regular driver
editor's header for consistency.

Reviewed By: Severin

Maniphest Tasks: T101592

Differential Revision: https://developer.blender.org/D16173
2022-10-06 19:07:33 +02:00
46c40d7fa1 Fix: Use after free in geometry node group logger
The name of the node group in the geometry nodes logger is created
in `GeoModifierLog::get_local_tree_logger`, where it references the
compute context. However, the compute context is a local variable
that doesn't live as long as the log. Therefore the log needs to own
the node group name.

Removing the ownership from `NodeGroupComputeContext` may be
possible as well, but seems less obviously correct. This can be a
temporary solution until we can completely avoid storing strings
in the logger (see D15775).

Fixes T101599
2022-10-06 11:58:11 -05:00
26df25caef UI: remove extraneous inversion of "inverted" button state
Fix an issue where a `UI_BTYPE_CHECKBOX_N` button couldn't be toggled.

When toggling the value of a property, the `UI_BTYPE_TOGGLE_N`,
`UI_BTYPE_ICON_TOGGLE_N`, and `UI_BTYPE_CHECKBOX_N` types shouldn't
matter. These determine the inverted display of the value, but toggles
of that value should still happen once.

For these button types, the toggle happened twice, effectively making it
a no-op. The code for individual values is now also consistent with the
code for handling bit-flags.

Actually found & over-the-shoulder-reviewed by @Severin
2022-10-06 18:54:36 +02:00
bd77cdde58 Build Environment: Update Ubuntu instructions to include bison
Ubuntu also requires bison (just like macOS seems to do).
2022-10-06 18:09:29 +02:00
0f224ceedb Cleanup: Move multires.c to C++ 2022-10-06 10:49:24 -05:00
dc93235797 GPencil: Use new icons for Envelope and Outline modifiers
Before both modifiers were using Skin icon.
2022-10-06 17:25:38 +02:00
6942f05848 UI: New modifier Icons Envelope and Outline
Task: T101155

Designed by: Matias Mendiola
Reviewed by : Pablo Vazquez
2022-10-06 17:16:56 +02:00
29e1cd75fa Linux CentOS 7 setup script
Add a script to set up a Linux CentOS 7 machine so that it can be used
to build the precompiled libraries for Linux.

Reviewed By: sergey, brecht

Differential Revision: https://developer.blender.org/D16171
2022-10-06 16:59:07 +02:00
Sebastian Herholz
e1a3348755 Fix T101458: Changing volume density when pg is enabled causes crash
Changing volume parameters during rendering could cause a crash
when guiding was enabled. It was due to an unintialized state paramter
at the beginning of the path tracing process.

In addition guiding is disabled when dealing with almost delta volumes
(i.e., g close to 1.0 or -1.0).
2022-10-06 14:39:51 +02:00
423c1366b0 Fix T101618: Freeze when reloading a library in certain situation
Freeze happened when reloading a library while having an Object property
with a custom getter function defined in Python.

Just piggybacking on rB62eb21e3ce87, this just applies the same fix (use
the BPy_BEGIN/END_ALLOW_THREADS macros) to relading from RNA/py.

All credit goes to @brecht and @mont29.

Maniphest Tasks: T101618

Differential Revision: https://developer.blender.org/D16167
2022-10-06 14:18:02 +02:00
a01ab2b4e0 Fix T101492: UV stitch crash (more than 32 objects selected)
Crash happened when adjusting operator props in Adjust Last Operation
panel.

When there are more than 32 objects selected in muti-object-editmode, we
are running into RNA array limit (`objects_selection_count` is defined as
an RNA array (which can only hold 32 entries, see
`RNA_MAX_ARRAY_LENGTH`), leading to reading random memory errors.

While there might be ways to make this work with more than 32 selected
objects (e.g. by instead using a collection, or investigate supporting
dynamic sized arrays for run-time RNA), this patch only cancels the
operator with a report message (instead of crashing).

Maniphest Tasks: T101492

Differential Revision: https://developer.blender.org/D16115
2022-10-06 14:11:02 +02:00
25533ac22d Fix T101517: GPencil strokes snap to origin in a Scale value is on 0
The problem was the conversion to object space converted the
points to zero.

Now, the new function `zero_axis_bias_m4` is used in order to add
a small bias in the inverse matrix and avoid the zero points.

A known math issue is the stroke can be offsetted if the scale is set to 1 
again. In this case apply the scale to reset to 1.

Differential Revision: https://developer.blender.org/D16162
2022-10-06 13:30:09 +02:00
7163a83450 Fix addons submodule ref
Was downgraded to a version from 2019 by mistake
2022-10-06 12:53:19 +02:00
Damien Picard
8b485e7226 I18n: ignore user-installed add-ons when extracting bl_info
Since add-on info was made translatable in D15747, user-installed
add-ons could also get their info extracted. This led to having
different messages depending on the environment of the Blender doing
the I18n messages update.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15963
2022-10-06 10:28:18 +02:00
247af8cf5b UI Translations: Add context to 'New' menu entries for files.
Aftermath of rBf5d67f3fdf2d and rBa096248d1253, from D16159 (did not
apply direclty).
2022-10-06 10:16:09 +02:00
0484b6bb18 Fix T101591: mathutils.geometry.intersect_line_line 2D vector error
Uninitialized stack memory was used when intersecting 2D vectors.
2022-10-06 17:33:50 +11:00
707c7de21f Fix T101628: Correct frame node intersection in add reroute operator
Fix reroute nodes added via the cut link gesture being parented to the
wrong frame node.

The frame's bounds that are used for the intersection test with the
newly added reroute are in view space, but the reroute's location was
given in the node tree's coordinate space, when the add reroute
operator was recently refactored (56193eccf6).

Reviewed By: Hans Goudey

Differential Revision: http://developer.blender.org/D16163
2022-10-06 07:35:35 +02:00
c2c31afa92 Cleanup: split BLF glyph rendering into a function
This makes the drawing loop easier to follow.
2022-10-06 16:28:12 +11:00
RedMser
6fac4bb8b0 Curve: increase max of order U/V
Uses soft and hard max of the resolution properties.

Range for order U/V was 2-6, but after testing higher max values with
NURB splines and surfaces with many control points, no problems were
found.

Reviewed By: campbellbarton

Ref D13918
2022-10-06 13:17:21 +11:00
63ed9550e9 Fix exception in bpy_extras.object_utils.object_data_add(..)
Adding object-data that doesn't support edit-mode would raise an
exception when the "Enter Edit Mode" preferences was enabled.

Other changes:

- Don't attempt to enter edit-mode for library-data.
- Support entering edit-mode for grease-pencil objects.

Alternate fix for the issue raised by D15999.
2022-10-06 13:07:16 +11:00
68ea6c85ab Fix: File context menu broken after recent commit
layout.menu does not have a text_context argument.
f5d67f3fdf
2022-10-06 12:49:22 +11:00
86352364a6 3D View: use float for ED_view3d_project_base & minor changes
Using 'short' was historic (as the value was stored in the Base).
Prefer floats which allow sub-pixel distances to be differentiated.

Also remove IS_CLIPPED assignment as this only made sense when the
values were stored in the Base, without any other ways to check
if projection failed.
2022-10-06 12:35:28 +11:00
87d737cd79 Cleanup: spelling in code comments 2022-10-06 12:13:00 +11:00
51bd26d0fa New math function to add small bias to zero axis
In some situations the zero axis can produce problems and need to add a small bias.

This function adds a small bias using the orthogonal result of the others valid axis.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D16158
6d
2022-10-05 22:11:08 +02:00
1ff51f30ad GPencil: Use stroke function for convert points
The stroke function is faster because the matrix 
is inverted only once.
2022-10-05 22:11:08 +02:00
bfeb64d620 Cleanup: make format 2022-10-05 21:40:58 +02:00
9d40b1cc3e Sculpt: Fix crash in face set init 2022-10-05 12:38:26 -07:00
38af785dba Sculpt: Fix crash in dyntopo draw 2022-10-05 12:38:26 -07:00
a096248d12 Fix: File menu broken after recent commit
layout.menu does not have a text_context argument.
f5d67f3fdf
2022-10-05 13:48:01 -05:00
548a2cbe06 Cleanup: Clang tidy
Also remove unnecessary struct keywords in C++ files.
2022-10-05 13:48:01 -05:00
6306d747b7 DRW: Split ViewProjectionMatrix in order to increase precision
This also removes the need to compute the persmat and saves some memory
from the `ViewInfos` struct. This is needed to allow multiview support.

Initial testing found no major performance regression during vertex
heavy workload.

Test file: {F13610017}

Results:
| Platform | Master | Split Matrix|
| Linux + Mesa + AMD W6600 | 48 fps | 47 fps |
| Macbook Pro M1 | 50 fps | 51 fps |
| Linux + NVidia 1080Ti | 51 fps | 52 fps |
| Linux + Radeon Vega 64 | 25.6 fps | 26.7 fps |

Increased precision when far from origin:
{F13610024}

{F13610025}

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D16125
2022-10-05 20:29:12 +02:00
74ff0aeea0 deps_builder: harden the package download process
During the 3.3 release some packages were missing
in SVN during the release and it ended up building
the release tarball without issues when re-running
the `make source_archive_complete` command after it
failed initially. The tarball however had 0 byte files
for the missing packages.... not good.

This diff hardens the download process by :

1) Validating all required variables are set. This
catches the erroneously attempt at downloading the
nanovdb package even though we have removed it
from versions.cmake but neglected to remove it
from download.cmake

2) When a download fails (due to either a missing
package, or bad download URL) FILE Download will
warn about a hash mismatch but will carry on
happily, you then have to go into the file system
go delete the 0 byte file to retry the download.
We know for a fact the file is bad when it is 0
bytes, just delete it.

3) When we are using the blender repository
(and likely building a source archive) explicitly
validate the hash of all packages. Normally the
build process does this, however when building
a source archive the build does not actually
run for a dep. So preform this check during the
configuration stage.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16124
2022-10-05 12:05:26 -06:00
Iliya Katueshenock
e89b2b1221 Mesh: Skip some domain interpolations for single values
Completely skip the work of interpolating domains for single values
for many to and from combinations. Similar to 535f50e5a6,
but slightly more complex because of the possibility of loose elements
on some mesh domains.

From D16054, with added comments.
2022-10-05 12:42:46 -05:00
124df79e78 Fix T101523: Cycles path guiding debug settings not affecting final render 2022-10-05 19:33:36 +02:00
Iliya Katueshenock
829569dccf Cleanup: Use generic array for mesh domain interpolation result
Instead of declaring a typed array inside the static type block.
This generates slightly less code and should have the same performance.

From D16054
2022-10-05 12:03:07 -05:00
9a633b967a Revert "Geometry Nodes: Add index input to Edge Vertices node"
Unfortunately this commit changed behavior in a fundamental way that
can't be addressed without larger changes. Previously the position
outputs were evaluated on the edge domain and then interpolated to the
context domain, which could be useful for some rudimentary mesh smoothing.
After the commit they were just evaluated at the specified index, which
looks practically random when evaluated on a different domain. We may need
a new node that doesn't have the implicit behavior in the future.

This reverts commit 4ddc5a936e.
2022-10-05 11:38:53 -05:00
424df9ea87 Fix T101610: UV Sphere missing from geometry nodes menu
Caused by 837144b457
2022-10-05 11:02:45 -05:00
Damien Picard
fd48f1b505 I18n: improve unit extraction regex
There were two issues with the unit extraction regex:
- it didn't take the inches, feet, arcminutes and arcseconds symbols
into accounts, which aren’t letters but ' and ";
- some units have more than one B_UNIT_DEF_* flag.

This allows extracting feet, inches, square millimeters, cubic
millimeters, arcminutes, and arcseconds.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D16144
2022-10-05 17:58:50 +02:00
Damien Picard
f5d67f3fdf I18n: disambiguate a few messages
- Active Track (NLA vs movie clip)
- New (file)
- Object Index (loop cut)
- Object Index (render pass)
- Proxy Storage (sequence)
- Rim (Solidify modifier)
- Roughness (particle children)
- Spaces (text whitespace)
- Out (sequencer wipe transition)

Also make new asset tag name translatable.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D16067
2022-10-05 17:53:37 +02:00
Damien Picard
860a539fb5 I18n: extract dynamic enum items
These item names and descriptions never got extracted because they're
not in the RNA until the proper context occurs, and so the extraction
script never even knew about them.

The properties are mostly located in the fluids UI.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15994
2022-10-05 17:47:54 +02:00
195bcea0d0 install_deps: Fix typo in previous commit.
Typo from rB7fa0080c4ffa.
2022-10-05 17:19:16 +02:00
6dd2e193e1 Fix T101405: Deleting a baked action results in an error.
RNA code to create new actions did not properly remove the extra user
set by default, as done in other `new` callbacks of other ID types.

NOTE: Mask ID had the same issue, also fixed in this commit.

NOTE: At some point this needs to be properly fixed, default super-low
level ID creation code should simply not add a 'default' user, this is
extremely bad design and forces higher-level code to do all kind of
extra work to get rid of it half of the time, in very unclear and
confusing ways and places.
2022-10-05 15:59:25 +02:00
Bastien Montagne
b47a234f98 BKE_Main: Add clear separation between 'temp' mains and global main.
Blender is using more and more temporary Main data-base (historically
for reading linked data, but also now when resyncing liboverrides, for
temp data in asset code, etc.).

This commit aims at making this a bit more formal and defined, by:
* Adding a dedicated flag in Main struct to mark a Main as global.
* Adding some API to replace, or temporarily swap the current global
  Main (`G_MAIN`) by another one.

NOTE: Having to temporarily replace `G_MAIN` is a workaround for the
limitation of current RNA, ideally this should be fixed in RNA itself,
but for now at least having an API helps tracking those cases (since
this is potentially risky operation).

This work is also a preparation for more usages of temp mains in the near
future (Asset Brushes and its presets system e.g. will most likely use
temp mains too).

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D15977
2022-10-05 14:26:45 +02:00
31a4fb42d4 Fix T101613: Muted Mix node wrongly connects to Factor socket
T101613: Muting/ctrl+x deleting the new mix node in Float mode
passes through the wrong input.

Fix by setting no_muted_links() on Factor sockets.
2022-10-05 13:19:54 +01:00
634e4a49d6 Fix T101334: Paint Texture Slots appear greyed out
To the user, this looks like a disfunctional thing (usually greying out
is used for props having no effect).

The greying out is caused by
{rB8b7cd1ed2a17e40661101eea4adae99e8e3d02e9}.
Above commit disabled the direct renaming of images in the
`TEXTURE_UL_texpaintslots` UIList (and instead displays the texture slot
directly as a prop -- which has its `PROP_EDITABLE` flag cleared)
(from the commit message):
> A limitation of this patch is that is isn't possible anymore to rename
images directly from
> the selection panel. This is currently allowed in master. But as
CustomDataLayers
> aren't ID fields and not owned by the material supporting this wouldn't
be easy.

To work around the UI confusion (but still keep the non-editable nature
of the property), now just display this as a label.

Maniphest Tasks: T101334

Differential Revision: https://developer.blender.org/D16138
2022-10-05 13:41:59 +02:00
cfa765845b Fix T101306: crash when calling Delete command for Library Override
Was not passing user_data to id_override_library_delete_hierarchy_fn.

Also correct a wrong assert.

Greenlit by @mont29 in T101306.
Should also go into 3.3 LTS.
2022-10-05 12:47:13 +02:00
6d879601b7 LineArt: Fix "No intersection" flicker.
The flicker was caused by the failure for checking both triangles for
flags. Now fixed.
2022-10-05 18:11:43 +08:00
7fa0080c4f Install_deps: Add building of OpenPGL.
Ref. T101403.
2022-10-05 12:08:05 +02:00
e3bcb203a9 Fix order of include-guard & C++ extern block 2022-10-05 20:27:45 +11:00
1a485a3aa6 Fix error in 6b76381e0a
Missed flipping arguments for caller.
2022-10-05 16:56:10 +11:00
b9cbb229b1 Fix app-template settings being used for non-template preferences
Saving non app-template preferences would use add-ons and other
app-template settings to write the default preferences if there was no
existing user preferences file saved.
2022-10-05 15:34:02 +11:00
79774aa68c App Template: quiet warning when existing preferences don't exist
Suppress warning when saving app-template preferences.

Check if the preferences exist before attempting to read them,
while harmless it looked as if something went wrong.
2022-10-05 15:34:02 +11:00
5dc798f2e4 Docs: improve doc-strings for blend file IO
- Document the behavior of app-template IO for preferences.
- Add doxy-sections for each kind of blend file IO.
- Clarify BKE_blender_userdef_app_template_data_swap doc-string.
2022-10-05 15:30:42 +11:00
6be8c6b3b1 Cleanup: Remove unused includes 2022-10-04 22:17:59 -05:00
fbbd7f0d5c Fix: Crash when reininitializing empty generic array
Noticed this while developing new code that used GArray.
2022-10-04 22:17:59 -05:00
b804f925c7 Fix T101185: New Mikktspace crashes on meshes without valid triangles
The code already had a check for meshes with zero triangles, but it
didn't catch the case where all triangles are flagged as degenerate.
A simple way to reproduce this is to take a mesh and scale it to zero.

After checking the code, it turns out that in this case it's supposed
to just set all tangents to zero, so the fix simply is to detect this
case and skip the computation.
2022-10-05 02:42:43 +02:00
f9a10e7ed0 Geometry Nodes: Add soft min for points node radius input
Also remove an unnecessary cast.
2022-10-04 17:45:58 -05:00
41281cc0e7 Build: fix missing xml2 build time dependency for wayland
Also prepend the existing 'PKG_CONFIG_PATH' instead of overwriting it
as this prevents 'devtoolset-9' libraries being used in the release
environment.
2022-10-05 08:48:32 +11:00
82de17c801 Cleanup: VSE: Rename val to timeline_frame 2022-10-04 21:24:09 +02:00
6309f67718 Cleanup: Add docstrings to SEQ_time.h 2022-10-04 21:24:09 +02:00
76043bc3d6 Cleanup: VSE code readability
Add function `SEQ_time_content_end_frame_get` to get content end frame.
New function is shorthand for
`SEQ_time_start_frame_get() + SEQ_time_strip_length_get()`.
2022-10-04 21:24:09 +02:00
d981418c8c Fix: Crash versioning transfer node with animation data
This versioning needs to be done after linking in order to affect
animation  data which might not be loaded in the regular "do_versions"
loop. Animation data is removed in `nodeRemoveNode`.

Fixes T101439
2022-10-04 13:27:24 -05:00
ea95d04245 Build: integrate OpenPGL into platform files like other libraries
To avoid issues with install_deps. If we more generally switch to using
CMake configs then perhaps this code can be deduplicated again or at
least simplified.
2022-10-04 20:24:27 +02:00
6167a065a5 Build: also list Cycles build options on first cmake config 2022-10-04 20:13:58 +02:00
3353fc60c2 Cleanup: remove unused members from RenderResult 2022-10-04 20:13:54 +02:00
9f8b0b83a9 UI: Avoid unnecessary label in set curve normal node
"Mode" is obvious and isn't worth cutting off the text.
2022-10-04 12:36:06 -05:00
31e89ee5b9 Fix: Bump subversion after forward compatibility breakage
c3b6e37254 change node ID names. Bump the subversion and the
min file subversion so older versions get warnings opening newer files.
2022-10-04 12:33:09 -05:00
8102510482 Fix T101583: Issues applying modifier to mesh with shape keys
The wrong mesh was used to read the position attribute. Also, there was
always a warning about missing shape keys when that wasn't the case.
2022-10-04 12:10:10 -05:00
bc00666683 Fix: UI: Warning for description with period at end
The last period is added automatically, for better or worse.
2022-10-04 12:10:10 -05:00
3e2d7403f9 Cycles: refine inlining thresholds for oneAPI backend
New thresholds give a few percent improvement in average.
2022-10-04 18:34:54 +02:00
df29211eeb Cycles: Speed up oneAPI GPU binaries compilation by using parallel instances
This change speeds up the compilation at the cost of higher memory usage.
CMake implementation checks the amount of available memory to spawn a
reasonable number of parallel compiler jobs.
2022-10-04 18:19:37 +02:00
d2f0cb6745 BLI: Unroll vector loops for better performance on GCC
On GCC, the loops created by `BLI_VEC_OP_IMPL` were not always
unrolled, leading to branching. For `attribute_math::mix4<float3>`,
this lead to a significant performance regression compared to its
older `interp_v3_v3v3v3v3` counterpart.

Instead of a using macros to create the for loops, use variadic
templates to manually unroll them. The compiler might do it anyway
(I didn't observe any effect on Clang in my tests), but there should
be no reason not to unroll these small loops, and making it explicit
and removing use of macros seems better.

On a Ryzen 3700x, this commits doubles the performance of Catmull
Rom curve position evaluation (from 18-19ms to around 9-10ms).

Differential Revision: https://developer.blender.org/D16136
2022-10-04 11:16:25 -05:00
4d9588ee45 Revert "install_deps: update OpenVDB for Blender 3.4."
This update has been moved back to Blender 3.5.

This reverts commit ded4604d71.
2022-10-04 17:35:21 +02:00
25d162f864 Revert "install_deps: update OIIO/Boost/Python/NumPy versions."
These updates have been moved back to Blender 3.5.

This reverts commit 1e1e9014cf.
2022-10-04 17:35:21 +02:00
4186b0ebe4 Fix T101233: Crash on deleting the object in outliner due to null pointer access
After rB188f7585a183 deleting the object results in crash due
to null pointer access if collections are filtered out

Reviewed by: mont29

Differential Revision: https://developer.blender.org/D16031
2022-10-04 20:49:34 +05:30
dd4a40f42d Always initialize MaterialPass (Fixes a crash in mscv)
Differential Revision: https://developer.blender.org/D16134
2022-10-04 16:16:46 +02:00
957cb173f2 Fix T101447: Hold split not working correctly
Caused by incorrect conflict resolution in commit 302b04a5a3.
2022-10-04 16:11:34 +02:00
0458b24a23 Fix T101499: Do not allow unlinking objects from linked collections. 2022-10-04 14:59:06 +02:00
38170cd295 Cleanup: Remove commented out code in ssr_lib.glsl. 2022-10-04 13:33:41 +02:00
Miguel Pozo
6c2c3ed2c9 Fix T101438: Wrong LOD selection after clamping the mip value (Nvidia)
Fix for T101438

Clamping the mip seems to always set it to 9.0.
I couldn't find an alternative way to avoid triggering the error (ie. min(mip, 9.0)).

In any case, the results with this patch applied look the same to the (correct) ones on AMD.
And, since clamping the max mip to a hardcoded value could result in resolution-depended behavior, I guess disabling the clamp should be ok anyway.

Reviewed By: fclem

Maniphest Tasks: T101438

Differential Revision: https://developer.blender.org/D16129
2022-10-04 13:32:15 +02:00
James
da6d6f99a8 Animation: Update tooltips to be more readable
Change some wording of tooltips for readability, in animation-related
areas (drivers, keying sets, animation channel visibility).

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D16131
2022-10-04 12:30:30 +02:00
c3003b4346 Fix T101559: Rain Test Animation demo crashes Blender 3.3
Update to liboverride creation code to add support of keeping active
object forgot to consider case when there is no known/given view layer.

NOTE: due to differences in code, fix for 3.3 will be a bit different.
2022-10-04 10:56:49 +02:00
501fff40e8 New viewlayer deferred resync code: add utils to ensure resync of whole Scene and Main.
Similar to existing `BKE_main_collection_sync` and `BKE_scene_collection_sync`,
in some cases code does not have access to a specific view layer,
and/or does not know exactly which view layer needs to be in sync,
or just need the full data to be up to date.
2022-10-04 10:53:05 +02:00
6b76381e0a Cleanup: rename BKE_appdir_folder_id_version, improve doc-strings
Rename BKE_appdir_folder_id_version to
BKE_appdir_resource_path_id_with_version because BKE_appdir_folder_id
and BKE_appdir_folder_id_version didn't accept compatible arguments.

Also add notes to GHOST_getSystemDir & GHOST_getUserDir that
BKE_appdir_resource_path_id(..) should be used instead (in most cases).
2022-10-04 16:52:10 +11:00
bf4926b30c Support environment variables to override USER & SYSTEM resource paths
Even though individual USER/SYSTEM paths could be set using environment variables,
it wasn't possible to override the USER or SYSTEM paths.

This meant the result of `bpy.utils.resource_path('USER')` &
`bpy.utils.resource_path('SYSTEM')` could still be used by scripts,
making the Blender session potentially the default USER directory
(even when `BLENDER_USER_CONFIG`, `BLENDER_USER_SCRIPTS` &
`BLENDER_USER_DATAFILES` all point elsewhere).

Resolve by adding environment variables:

- BLENDER_USER_RESOURCES
- BLENDER_SYSTEM_RESOURCES

These will be used for `bpy.utils.resource_path('USER')` &
`bpy.utils.resource_path('SYSTEM')`, as well as a basis for user &
system directories, unless those environment variables are
set (`BLENDER_USER_*` or `BLENDER_SYSTEM_*`).

Resolves issue raised by T101389.

Example usage & output:

{P3225}

Reviewed By: brecht

Ref D16111
2022-10-04 13:54:09 +11:00
868ef9ec37 Cleanup: remove unnecessary includes from sculpt_paint 2022-10-04 13:54:04 +11:00
5c51bf2ffe Cleanup: format 2022-10-04 13:54:02 +11:00
a9918e9c0e Cleanup: undeclared function warning 2022-10-04 13:54:01 +11:00
1d629a4403 Cleanup: correct argument size for plane in planeProjection 2022-10-04 13:53:59 +11:00
22c3db72ca Sculpt: Visibility bugfixes
* Unhide all is no longer part of face_set_change_visibility.
* Implemented a few visibility API methods for PBVH_BMESH
* Fixed bug with unhide all not freeing all multires grid_hidden
  bitmaps.
2022-10-03 17:19:50 -07:00
2cf21604c9 Sculpt: implement Reveal All for PBVH_BMESH 2022-10-03 17:19:50 -07:00
d42f882343 Cleanup: Fix sign conversion warning in BMesh log 2022-10-03 17:43:21 -05:00
97746129d5 Cleanup: replace UNUSED macro with commented args in C++ code
This is the conventional way of dealing with unused arguments in C++,
since it works on all compilers.

Regex find and replace: `UNUSED\((\w+)\)` -> `/*$1*/`
2022-10-03 17:38:16 -05:00
ed7f5713f8 Sculpt: Fix T101430: Blank stroke undo steps corrupt dyntopo
Blank brush strokes never have an oppurtunity to initialize
a sculpt undo step, which results in blank global undo steps.
These confuse DynTopo's internal BMLog undo stack.

Note: I tried having the stroke operator return OPERATOR_CANCELLED,
but this didn't prevent the undo push (which is done automatically
due to the presence of OPTYPE_UNDO in the operator flags).
I might investigate removing the flag, but that might cause other
problems.
2022-10-03 15:37:23 -07:00
416d1d0393 Sculpt: Add debug code to print sculpt undo stack. 2022-10-03 15:37:23 -07:00
4ddc5a936e Geometry Nodes: Add index input to Edge Vertices node
Previously the edge index was always determined by the field context,
and the node didn't work when the context was in any other domain.
Adding an index input makes it work much more nicely with the other
topology nodes. It's now in the topology submenu too.

I also reimplemented the edge positions input to use the field at index
node internally. That will probably make it slower for now, but we need
to optimize that to do nothing in some special cases anyway.

Differential Revision: https://developer.blender.org/D16105
2022-10-03 16:54:23 -05:00
99cbaced3b Fix: Incorrect field status in offset point in curve node
The input supports fields, the outputs are fields only if either of the
inputs are fields. Also, .hide_value() is redundant for implicit fields.
2022-10-03 16:44:09 -05:00
c3b6e37254 Geometry Nodes: Rename Control Point Neighbors Node
Rename the node to "Offset Point in Curve"

Since this was committed, more mesh and curve topology nodes have been
committed with a different naming scheme (482d431bb6). Change
the name of this node to match "Offset Corner in Face". Because the
node was only added recently, it's a full rename, including the ID,
so forward compatibility is broken.
2022-10-03 16:41:58 -05:00
248def7e48 Geometry Nodes: Change order of outputs in topology nodes
It's a bit more natural if the "Total" output come second, and it's
also consistent with the Accumulate Field node.
2022-10-03 16:27:09 -05:00
748fda32ed Geometry Nodes: Set Curve Normal
This node allows for curves to have their evaluated normal mode changed
between MINIMUM_TWIST and Z_UP. A selection input allows for choosing
which spline in the curves object will be affected.

Differential Revision: D16118
2022-10-03 15:50:21 -05:00
Phoenix Katsch
b475506cfb Cycles: add option to bake specular from active camera viewpoint
Previously it would bake viewed from above the surface. The new option can be
useful when the baked result is meant to be viewed from a fixed viewpoint or
with limited camera motion.

Some effort is made to give a continuous reflection on parts of the surface
invisible to the camera, but this is necessarily only a rough approximation.

Differential Revision: https://developer.blender.org/D15921
2022-10-03 21:59:31 +02:00
af51e4b41c Cleanup: fix source comment/documentation typos
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D16071
2022-10-03 21:59:31 +02:00
e2572bd89f Fix OpenEXR saving still outputting alpha when using RGB instead of RGBA mode
Contributed by linhsu0723.

Differential Revision: https://developer.blender.org/D15979
2022-10-03 21:59:31 +02:00
42f40657f1 Images: remove option to choose between BW/RGB/RGBA for multilayer EXR save
This was not properly respected, and in general with multiple passes and layers
it's unclear what this should do exactly without breaking some render passes.
Better to keep this image format for raw unmodified render results.
2022-10-03 21:59:20 +02:00
9b7c84f293 Image: improve Save As Render tooltip, hide option when saving render result 2022-10-03 21:00:55 +02:00
0c7458604d Cleanup: rename IMA_CHAN_FLAG_ALPHA to IMA_CHAN_FLAG_RGBA to match meaning 2022-10-03 20:45:06 +02:00
72ceb7dec1 Fix: crash when linked geometry node group is missing 2022-10-03 19:15:06 +02:00
13b3c408e3 Fix T101510: Incorrect context for running data unlink from template ID
There was already a fix for this, but it got broken again with c973d333da.
2022-10-03 18:20:59 +02:00
d20be55c1a Cleanup: in Cycles force inline transform_inverse_impl
We expect this to always happen.

Ref T100891
2022-10-03 17:58:34 +02:00
2f7234d3e1 Attribute Node: access geometry node instance attributes.
The Instancer mode of the node is intended for varying material
behavior between instances. Since Geometry Nodes support arbitrary
named instance attributes, this mode should include them in lookup.

To implement this it is sufficient to store references to Geometry
Node data in DupliObject, and check it during dupli attribute lookup.

In order to reduce the memory usage of DupliObject, only 4 array
entries are allocated, even though the current dupli recursion stack
limit is 8. This assumes that not every entry would be associated with
a GeometrySet instance. Hopefully, soon the whole system will be
rewritten to remove the hard limits altogether.

Differential Revision: https://developer.blender.org/D16114
2022-10-03 18:02:24 +03:00
a6083cdeef Cleanup: remove unnecessary braces 2022-10-03 16:28:21 +02:00
e65598b4fa Geometry Nodes: new Sample UV Surface node
This node allows sampling an attribute on a mesh surface based
on a UV coordinate. Internally, this has to do a "reverse uv lookup",
i.e. the node has to find the polygon that corresponds to the uv
coordinate. Therefore, the uv map of the mesh should not have
overlapping faces.

Differential Revision: https://developer.blender.org/D15440
2022-10-03 16:06:29 +02:00
31ae3a5012 Geometry Nodes: set viewer overlay opacity default to 1
This value worked better for artists.
2022-10-03 12:34:48 +02:00
83ebf6a811 Fix T101564: GPencil: Selecting imprecise if transforms are animated
The check was doing with the original point and
must be the evaluated point.
2022-10-03 11:18:08 +02:00
035c237d69 Fix T101548: GPencil new lines in Multiframe editing appear as Onion
The problem was the eval data update only occurs for the 
actual frame and in this case must be for all frames.
2022-10-03 10:38:00 +02:00
7029f11439 Fix T101487: New OBJ importer handles UVs incorrectly when some faces of an object don't have UVs
The UV data filling logic was incorrectly just skipping over loop
entries that don't have a UV coordinate, instead of assigning
the default zero UV for them. This was a problem only for meshes
where some faces did have UVs, but some other faces did not (T101487).
2022-10-03 11:07:50 +03:00
cbfd2aaeb7 Cleanup: sort cmake file lists 2022-10-03 12:13:01 +11:00
b1a672f541 CMake: add missing headers 2022-10-03 12:13:01 +11:00
7afee060d0 Cleanup: add license header 2022-10-03 12:04:41 +11:00
d4d40f3b69 DNA: reduce size of Base struct
Re-order members and remove pad members,
reducing it's size by 24 bytes on 64 bit systems.
2022-10-03 11:19:15 +11:00
d3ba8826b0 Cleanup: remove 2D region-relative coordinates from Base
Historically, caching these values may have had some advantages,
simplifying drawing object centers and selecting by object center.

Now the only uses of these values would calculate the projection
before use, so there is no reason to store run-time projection in DNA.

This also quiets a `-Wstring-overflow` warning.
2022-10-03 11:07:17 +11:00
ea2c41c730 Cleanup: spelling in comments
Also replace "dm" for evaluated mesh in some comments.
2022-10-03 11:03:46 +11:00
55387197a7 Cleanup: use function style casts for C++ 2022-10-03 11:03:46 +11:00
d762132a72 Cleanup: quiet undeclared function warning 2022-10-03 10:24:05 +11:00
15e6673ccd Cleanup: Move three modifier files to C++ 2022-10-02 11:17:40 -05:00
ed6764dede Fix: build issue with MSVC
Issue introduced by rB208b3a0472b3
which fixed a build issue on linux.

This fix is a band-aid at best but
reverting rB208b3a0472b3 is not
really an option since that would
break linux again.
2022-10-02 10:17:05 -06:00
5a982b0695 GPUTexture: Add GPU_texture_create_single_layer_view
This allows the creation of texture arrays from 1D/2D/Cube texture.
This is useful when the shader expect a texture array but the original
texture isn't.
2022-10-02 15:18:42 +02:00
208b3a0472 Fix build error on Linux after font thumbnail changes 2022-10-02 15:06:34 +02:00
9d30adb7eb Cleanup: Rename function gpencil_point_to_parent_space
gpencil_point_to_parent_space -> gpencil_point_to_world_space

The old name was not clear because it looked it was moving into
the object space, but really is doing the opposite.
2022-10-02 13:40:42 +02:00
8f1d3e14d9 Cleanup: Rename functions
gpencil_apply_parent->gpencil_world_to_object_space
gpencil_apply_parent_point->gpencil_world_to_object_space_point

The old name was not descriptive enough.
2022-10-02 13:40:42 +02:00
e0a261c653 Cleanup: Move more files using mesh runtime data to C++
In preparation for moving mesh runtime data out of DNA.
2022-10-01 22:13:19 -05:00
b14ad9114f Fix: Mix node did not set clamp result correctly in versioning code
Files were incorrectly loaded without the Clamp Result option set.

Reported in BA by CarlG
2022-10-02 00:04:30 +01:00
Jason Fielder
0fdb9cd650 GPU: Fix issue with GPU render boundaries being opened while a GPUBackend does not exist.
Fixes regression introduced by rBe8bcca4bdc94 (D15900)

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D16085
2022-10-02 00:08:52 +02:00
Pratik Borhade
ffd8390af7 Fix T101504: Crash when repeat value is zero
Crash triggers due to division by zero
fix is to increase minimum limit for `seg_repeat` to 1

Reviewed By: antoniov, frogstomp

Maniphest Tasks: T101504

Differential Revision: https://developer.blender.org/D16120
2022-10-01 16:28:29 +02:00
e5ccbfab09 Cleanup: simplify uv packing for non-square materials 2022-10-01 17:29:14 +13:00
206dead860 Sculpt: Fix T101467: Improper vertex count in pbvh draw 2022-09-30 15:40:50 -07:00
81f15a51aa Sculpt: Fix sculpt face set undo creating duplicate face set layers 2022-09-30 15:35:11 -07:00
991a35b844 Sculpt: fix crash in relax face sets brush 2022-09-30 15:32:01 -07:00
6b9f45c1d1 Sculpt: Fix T101430: Dyntopo undo crash 2022-09-30 15:28:26 -07:00
5b0485fd77 Sculpt: Upload white for color attributes in multires in sculpt
Even if multires in sculpt mode doesn't yet support color
attributes, we should at least upload white color to avoid
making everything black.

Also fixed a bug where multires PBVHs didn't have access to
their CustomData attribute layout, which PBVH draw needs.
2022-09-30 15:19:10 -07:00
1eba76d8ed Sculpt: Fix T101503: Memory corruption in multires faceset drawing 2022-09-30 15:02:50 -07:00
4cbafba04b Sculpt: Fix T101430: Curve shown improperly in mask from cavity redo 2022-09-30 14:56:06 -07:00
554afabf75 Attribute Node: refactor lookup to remove duplication between engines.
Currently lookup of Object and Instancer attributes is completely
duplicated between Cycles, Eevee and Eevee Next. This is bad design,
so this patch aims to deduplicate it by introducing a common API
in blenkernel.

In case of Cycles this requires certain hacks, but according to
Brecht it is planned to be rewritten later for more direct access
to internal Blender data anyway.

Differential Revision: https://developer.blender.org/D16117
2022-09-30 20:01:57 +03:00
42eda155df Cleanup: Move draw_manager_data.cc to C++
This will help with moving mesh runtime data to C++
2022-09-30 09:38:02 -05:00
8ba508d70b Fix missing Outliner updates when adding nodetrees
When e.g. grouping nodes into nodegroups, these would not show up
immediately in the Outliner (Blender File / Data API view).

Now send (unique combination, not used elsewhere) notifiers (and listen
for these in the Outliner).

Differential Revision: https://developer.blender.org/D16093
2022-09-30 11:53:03 +02:00
2004827bc9 Fix T101347: Curve draw fails to project to cursor depth in ortho views
ED_view3d_win_to_3d_on_plane with do_clip enabled wasn't working in
non-camera orthographic views as it didn't take into account the ray
origin being centered to the view.

Resolve by testing viewport clipping after the ray has been projected.
2022-09-30 18:29:26 +10:00
68ac737d48 Cleanup: format 2022-09-30 10:28:11 +02:00
6865aab133 Cleanup: quiet unused parameter warning in lambda function
Copy-paste error in rB039429faeb41.
2022-09-30 10:27:48 +02:00
dbc097d6b8 Fix error in blf_get_sample_text returning a pointer to stack memory
Copy-by-value was used when iterating over unicode_samples which
then referenced an array from the value.

Resolve by referencing a const pointer to the unicode_sample array.
2022-09-30 15:03:18 +10:00
8bdd4b4685 Cleanup: use function style casts for C++ 2022-09-30 14:51:49 +10:00
1c1dc5f844 Cleanup: Move files that use mesh runtime data to C++
In preparation for moving the mesh runtime struct out of DNA.
2022-09-29 18:32:44 -05:00
7db79feecd Cleanup: Move object_update.c to C++ 2022-09-29 17:11:20 -05:00
0ff485b6ba Cleanup: Move modifier.c to C++ 2022-09-29 16:43:09 -05:00
3059c0998a Fix T101118, T101471: Crash with bevel weight in solidify modifier
Just a missing null check for the original edge weight.
2022-09-29 16:40:13 -05:00
688c4f7e51 Sculpt: fix stroke-only attributes not being freed at stroke end 2022-09-29 13:45:17 -07:00
b063cfa9cf Sculpt: fix T101465, crash in cloth filter with new automasking modes 2022-09-29 13:38:16 -07:00
6a9b45995d Sculpt: Fix T101464: Crash in mask from cavity 2022-09-29 13:14:42 -07:00
f998fa2732 Sculpt: Fix T101463: Don't initialize automask to zero in
factor mode if topology or boundary modes are inactive

Factors mode (precomputing the automask) should initialize the
mask to 1.0 if no additive automasking modes are enabled, instead
of zero.
2022-09-29 13:06:55 -07:00
c938447ee2 Cleanup: Naming in edge vertices node
- Use `enum class`
- Use shorter names for field input classes for better line wrapping
- Use "Vert" instead of "Vertex"
2022-09-29 15:01:10 -05:00
912a1e2820 Fix: Order of node mixins in custom nodes python template
See T101259. This order makes the poll not work, even when called from
Python. The bundled template shouldn't be a source of errors for node
addons.
2022-09-29 11:59:02 -05:00
c007e84e9e Fix: Viewer node overlay alpha broken on NVidia GPUs
On NVidia GPUs, when the blue channel was between 0 and 0.1,
the overlay's alpha would increase, making it invisible.

With the `overlay_line_fb` frame buffer bound in `overlay_engine.cc`
there are two outputs to write to: the color and the line output, which
is used for making smooth antialiased lines. The overlay is in its
current position in the order of overlays so that it draws on top of
curve wire lines. Not writing to that second output is undefined
behavior, so fix it by writing zeros. In the future, the overlay
could be smoothed on curves using that second texture.

Thanks to Clément for the explanation of the issue!
2022-09-29 11:28:48 -05:00
520d111eca Cleanup: Simplify code and remove duplications
This commit simplify the previous fix for T101455

f6c2f1c65e
2022-09-29 15:03:23 +02:00
d2e576f34c GPencil: Remove Fill use_collide_only option
After a lot of testing, this option is not required and
now this is managed by stroke_collsion.

If the stroke_collision is enabled, only collide strokes 
are used.
2022-09-29 14:58:29 +02:00
10f1972ff7 GPencil: Fix missing Fill stroke cross detection
If the cross point was in the extreme of the stroke the
collision was not detected because it could be
outside of the bbox.

Removed the bbox check because now it is
not necessary.
2022-09-29 13:51:58 +02:00
f6c2f1c65e Fix T101455: GPencil Gizmo in wrong location when using Active Element
The gizmo was not set when this option was selected.

By design, in grease pencil the active element option uses
the object origin as pivot point.
2022-09-29 13:38:31 +02:00
b70b02ee42 Fix: Spline Parameter node produces NaN when curve is a single point
Issue found in file from T101256.
2022-09-29 13:32:03 +02:00
ffccdf069b Nodes: fix missing update when input of muted node changes 2022-09-29 13:09:00 +02:00
6757f81fab Viewport: Remove unnecassary assert 2022-09-29 04:05:03 -07:00
db0ef8b00d Fix T101410: ignore dangling reroute inputs
For consistency with other node systems in Blender and older
versions of geometry nodes, dangling reroute inputs should
not affect the output. When an input socket is linked to dangling
reroutes, its own value should be used instead.
2022-09-29 13:03:15 +02:00
5ffbabb24c Nodes: fix missing updates with muted nodes and reroutes
Muted nodes and reroutes can potentially affect the output when
they are linked to an input socket and don't have any inputs on
their own.

The issues was that previously "logically linked sockets" where used
which hide reroutes and muted nodes away. The solution is to work
with the directly linked sockets instead and handle reroutes etc
explicitly.
2022-09-29 12:43:43 +02:00
1494a22a90 Sculpt: Reset automask cache on non-color non-mask undo steps 2022-09-29 02:33:59 -07:00
f1990bd900 UI: Nodes typo in "distribute points in volume" node
Distribute Points In Volume →  Distribute Points in Volume.
2022-09-29 11:16:47 +02:00
fae975dd54 UI: Nodes re-organize the nodes in alphabetical order
This was a regression introduced after the 3.3 release.

This fix T101452
2022-09-29 11:13:27 +02:00
2fc136427d Fix T101451: curve attribute overlay disappears when origin is out of view
The core issue seems to be that `BKE_curve_minmax` does not create the
correct bounding box for `Curve` data passed to the render engine.
That's because this `Curve` object does not contain the legacy curve
data structure.

Fixing this will likely require some more consideration, so this fix just
avoids the culling check for now, which is actually also done in
`OVERLAY_extra_wire` using the same approach.
2022-09-29 11:12:05 +02:00
6d3da28676 Sculpt: fix draw face sets not updating on first stroke 2022-09-29 01:47:40 -07:00
Andrew Oates
4bdba62cb9 Fix T94441: fix crash parenting object to a bone
This crash occurs when the bone is newly created.  In certain
circumstances the depsgraph data for the armature is not updated,
causing `pchan_eval` to be NULL when the parent is updated.  This causes
a segfault in `ED_object_parent_set` when the flags are updated.

This change fixes the underlying depsgraph bug, and also adds both an
assertion and NULL pointer check to `ED_object_parent_set` to better
handle this scenario if it recurs via another path.

Maniphest Tasks: T94441

Differential Revision: https://developer.blender.org/D16065
2022-09-29 10:35:18 +02:00
039429faeb Sculpt: fix missing nullptr check in pbvh draw
This time it was face sets.
2022-09-29 01:25:47 -07:00
9be99bcb45 Cleanup: Address format-security warning 2022-09-29 10:02:04 +02:00
5dd48c50f0 Cleanup: Set but unused variable 2022-09-29 09:52:00 +02:00
46e0512d1e Cleanup; Warning about missing override for virtual function 2022-09-29 09:51:32 +02:00
eeb81c4a63 Cleanup: quiet warnings (unused arg & trailing fullstop) 2022-09-29 17:31:55 +10:00
a56da7b045 Fix bpy.utils.script_paths() ignoring environment variables
When check_all=True was passed,

- `os.path.join(bpy.utils.resource_path('USER'), "scripts")`
  was used instead of BLENDER_USER_SCRIPTS.
- `os.path.join(bpy.utils.resource_path('SYSTEM'), "scripts")`
  was used instead of BLENDER_SYSTEM_SCRIPTS.

Other minor changes:

- Simplify collecting paths.
- Don't add user-directories multiple times when check_all=True.
- Normalize paths before before checking duplicates to reduce the
  change the same path is added multiple times.

Found these issues while investigating T101389.
2022-09-29 17:31:55 +10:00
a66e584294 Cleanup: correct API usage for script access
In practice this didn't cause problems, but accessing scripts via
bpy.utils.resource_path('USER') ignores the BLENDER_USER_SCRIPTS
environment variable.
2022-09-29 17:22:32 +10:00
46076e4876 Cleanup: run clang-format in sculpt code 2022-09-28 23:41:53 -07:00
eab69d4930 Cleanup: Use c++-style unused paramter form in automasking code.
Also renamed shadowed variable in sculpt_filter_mesh.c
2022-09-28 23:38:48 -07:00
0de9081e89 Sculpt: fix missing nullptr check in pbvh draw
Check for nullptr when building mask vbos.
2022-09-28 23:33:02 -07:00
bbc69563d0 Sculpt: Normal-based automasking modes
Two new normal-based automasking modes.

The first mode, "brush", compares vertex normals with the initial
normal at the beginning of the brush stroke.

The second, "view", compares vertex normals with the view normal.
If "occlusion" is on then rays will be shot from each vertex to test
if it is occluded by other geometry (note: this can be very slow).\
Only geometry inside the sculpt mesh is considered.

Each mode has an associated angular limit and a falloff.

Reviewed by: Julien Kaspar and Jeroen Bakker
Differential Revision: https://developer.blender.org/D15297
Ref D15297
2022-09-28 23:21:56 -07:00
a4ff106c58 Cleanup: Remove more unused CustomData API functions
Due to increased usage of typed arrays in C++ and name/offset based
access for BMesh, these are unlikely to be used again, and haven't been
used in many years.
2022-09-28 23:13:58 -05:00
ff353842bd Cleanup: Deduplicate logic in CustomData access functions
Also remove comments that just restated what the next line
was doing, often incorrectly.
2022-09-28 23:13:58 -05:00
57620af33c Cleanup: Remove unused BMesh function 2022-09-28 23:13:58 -05:00
0c282c068f Cleanup: cmake indentation 2022-09-29 13:32:16 +10:00
f96020fb9a Cleanup: remove '.' from the end of descriptions
Quiet warnings at startup & build time.
2022-09-29 13:32:16 +10:00
91db47e914 Cleanup: simplify storage when uv island packing
Refactor ahead of upcoming packing changes.

Differential Revision: https://developer.blender.org/D16096
2022-09-29 15:48:53 +13:00
e2df195844 Fix wrong version bump to 3.4.1, we are still on 3.4.0
The patch levels are reserved for bugfix releases.
2022-09-29 03:57:30 +02:00
c64d3a692d Cleanup: use doxy-sections in anim_channels_edit.c 2022-09-29 10:28:56 +10:00
c1548938a4 Cleanup: spelling in comments 2022-09-29 10:28:39 +10:00
d459219307 Cleanup: quiet deprecated copy warning 2022-09-29 10:28:11 +10:00
ec8118a59e Cleanup: replace UNUSED() with commented arguments
This is the conventional way of dealing with unused arguments in C++.

Also quiet enum conversion warnings.
2022-09-29 10:26:10 +10:00
9cfa8b945a Cleanup: format 2022-09-29 10:11:42 +10:00
c087d09c16 Cleanup: fix unused variable warnings in draw_pbvh.cc 2022-09-28 16:39:21 -07:00
0156a677c7 Sculpt: New Cavity Automasking Mode
Add new cavity automasking mode based on local mesh
curvature.  Cavity masking is a great way to quickly add
detail in crevices and the like.  It's meant to be used
with the Paint brush in color attribute mode.  It does
work with other brushes but the results can be unpredictable.

{F13131497}

The old "dirty mask" operator has been replace with a new
"mask from cavity" operator that shares the same code with
cavity automasking.

Differences from the sculpt-dev implementation:
    * It uses the word "cavity."  When I first implemented
this I wasn't aware
      this feature existed in other software (and other
paint modes in Blender),
      and for reasons that escape me today I initially
decided to call it a concave or
      concavity mask.
    * The cavity factor works a bit differently.  It's
      no longer non-linear and functions as a simple
      scale around 0.5f.
    * Supports custom curves.
    * Supports blurring.

Reviewed By: Julian Kaspar, Jeroen Bakker and Campbell Barton
Differential Revision: https://developer.blender.org/D15122
Ref D15122
2022-09-28 16:22:34 -07:00
53ac3192ba Cleanup: remove duplicate declaration
Also got rid of ATTR_NO_OPT macro.
2022-09-28 15:50:09 -07:00
65900d88a8 Sculpt: Rewrite PBVH draw
Rewrite PBVH draw to allocate attributes into individual VBOs.
The old system tried to create a single VBO that could feed
every open viewport.  This required uploading every color and
UV attribute  to the viewport whether needed or not, often exceeding
the VBO limit.

This new system creates one VBO per attribute.  Each attribute layout is
given its own GPU batch which is cached inside the owning PBVH node.

Notes:

* This is a full C++ rewrite.  The old code is still there; ripping it out
can happen later.
* PBVH nodes now have a collection of batches, PBVHBatches, that keeps
track of all the batches inside the node.
* Batches are built exclusively from a list of attributes.
* Each attribute has its own VBO.
* Overlays, workbench and EEVEE can all have different attribute
  layouts, each of which will get its own batch.

Reviewed by: Clement Foucault
Differential Revision: https://developer.blender.org/D15428
Ref D15428
2022-09-28 14:51:23 -07:00
a790873d2a Cleanup: Typo in forward declaration 2022-09-28 16:32:59 -05:00
482d431bb6 Geometry Nodes: Curve and mesh topology access nodes
This patch contains an initial set of nodes to access basic
mesh topology information, as explored in T100020.

The nodes allow six direct topology mappings for meshes:
- **Corner -> Face** The face a corner is in, the index in the face
- **Vertex -> Edge** Choose an edge attached to the vertex
- **Vertex -> Corner** Choose a corner attached to the vertex
- **Corner -> Edge** The next and previous edge at each face corner
- **Corner -> Vertex** The vertex associated with a corner
- **Corner -> Corner** Offset a corner index within a face

And two new topology mappings for curves:
- **Curve -> Points** Choose a point within a curve
- **Point -> Curve** The curve a point is in, the index in the curve

The idea is that some of the 16 possible mesh mappings are more
important, and that this is a useful set of nodes to start exploring
this area. For mappings with an arbitrary number of connections, we
must sort them and use an index to choose a single element, because
geometry nodes does not support list fields. Note that the sort
index has repeating behavior as it goes over the "Total" number of
connections, and negative sort indices choose from the end.

Currently which of the "start" elements is used is determined by the
field context, so the "Field at Index" and "Interpolate Domain" nodes
will be quite important. Also, currently the "Sort Index" inputs are
clamped to the number of connections.

One important feature that isn't implemented here is using the winding
order for the output elements. This can be a separate mode for some
of these nodes. It will be optional because of the performance impact.

There are several todos for separate commits after this:
- Rename "Control Point Neighbors" to be consistent with this naming
- Version away the "Vertex Neighbors" node which is fully redundant now
- Implement a special case for when no weights are used for performance
- De-duplicating some of the sorting logic between the nodes
- Improve performance and memory use of topology mappings
- Look into caching some of the mappings on meshes

Differential Revision: https://developer.blender.org/D16029
2022-09-28 14:38:27 -05:00
25533dbe21 Mesh: Add C++ implementaiton of topology mappings
Because they are friendlier to use in C++ code than the existing mesh
mapping API, these mappings from one domain to another were often
reimplemented in separate files. This commit moves some basic
implementations to a `mesh_topology` namespace in the existing
mesh mapping header file. These is plenty of room for performance
improvement here, particularly by not using an array of Vectors, but
that can come later.

Split from D16029
2022-09-28 14:31:32 -05:00
878dea4e0f GPencil: Avoid infinite loop in Fill debug mode
If the internal flag is set to debug and the Ctrl key is used
the program keeps running endless.
2022-09-28 20:29:41 +02:00
6e9320d237 GPencil: Disable Fill visual aids if use Inverted
When the inverted mode is used, the visual aids must
not be displayed.
2022-09-28 20:23:49 +02:00
19955ef88e GPencil: Extend Fill lines when visual aids are disabled
When the visual aids are disabled, but the extend factor
is > 0, the lines must be extended, but not displayed.

Also, some variables renamed to clarify.
2022-09-28 20:07:20 +02:00
36096fe480 GPencil: Change property text for Fill Visual Aids 2022-09-28 19:42:03 +02:00
ad789c74df GPencil: Fix unreported memory leak in Fill inverse
There was a memory leak when use inverted fill.
2022-09-28 19:36:31 +02:00
c55d38f00b Geometry Nodes: viewport preview
This adds support for showing geometry passed to the Viewer in the 3d
viewport (instead of just in the spreadsheet). The "viewer geometry"
bypasses the group output. So it is not necessary to change the final
output of the node group to be able to see the intermediate geometry.

**Activation and deactivation of a viewer node**
* A viewer node is activated by clicking on it.
* Ctrl+shift+click on any node/socket connects it to the viewer and
  makes it active.
* Ctrl+shift+click in empty space deactivates the active viewer.
* When the active viewer is not visible anymore (e.g. another object
  is selected, or the current node group is exit), it is deactivated.
* Clicking on the icon in the header of the Viewer node toggles whether
  its active or not.

**Pinning**
* The spreadsheet still allows pinning the active viewer as before.
  When pinned, the spreadsheet still references the viewer node even
  when it becomes inactive.
* The viewport does not support pinning at the moment. It always shows
  the active viewer.

**Attribute**
* When a field is linked to the second input of the viewer node it is
  displayed as an overlay in the viewport.
* When possible the correct domain for the attribute is determined
  automatically. This does not work in all cases. It falls back to the
  face corner domain on meshes and the point domain on curves. When
  necessary, the domain can be picked manually.
* The spreadsheet now only shows the "Viewer" column for the domain
  that is selected in the Viewer node.
* Instance attributes are visualized as a constant color per instance.

**Viewport Options**
* The attribute overlay opacity can be controlled with the "Viewer Node"
  setting in the overlays popover.
* A viewport can be configured not to show intermediate viewer-geometry
  by disabling the "Viewer Node" option in the "View" menu.

**Implementation Details**
* The "spreadsheet context path" was generalized to a "viewer path" that
  is used in more places now.
* The viewer node itself determines the attribute domain, evaluates the
  field and stores the result in a `.viewer` attribute.
* A new "viewer attribute' overlay displays the data from the `.viewer`
  attribute.
* The ground truth for the active viewer node is stored in the workspace
  now. Node editors, spreadsheets and viewports retrieve the active
  viewer from there unless they are pinned.
* The depsgraph object iterator has a new "viewer path" setting. When set,
  the viewed geometry of the corresponding object is part of the iterator
  instead of the final evaluated geometry.
* To support the instance attribute overlay `DupliObject` was extended
  to contain the information necessary for drawing the overlay.
* The ctrl+shift+click operator has been refactored so that it can make
  existing links to viewers active again.
* The auto-domain-detection in the Viewer node works by checking the
  "preferred domain" for every field input. If there is not exactly one
  preferred domain, the fallback is used.

Known limitations:
* Loose edges of meshes don't have the attribute overlay. This could be
  added separately if necessary.
* Some attributes are hard to visualize as a color directly. For example,
  the values might have to be normalized or some should be drawn as arrays.
  For now, we encourage users to build node groups that generate appropriate
  viewer-geometry. We might include some of that functionality in future versions.
  Support for displaying attribute values as text in the viewport is planned as well.
* There seems to be an issue with the attribute overlay for pointclouds on
  nvidia gpus, to be investigated.

Differential Revision: https://developer.blender.org/D15954
2022-09-28 17:54:59 +02:00
2312915b96 Cleanup: Rename variables 2022-09-28 17:42:32 +02:00
8c95ab235f GPencil: Fix unreported bug for fill closing strokes
The extend lines were included in render by error
when the only collide option was ON.
2022-09-28 17:42:32 +02:00
1f493125e3 MSVC: promote C4033 to an error
C4033 'function' must return a value

is a MSVC level-1 warning, clang and GCC
treat this as an error however, this
change promotes it to an error as well
for MSVC to mimic the GCC behaviour.
2022-09-28 08:32:56 -06:00
3f55121a18 GPencil: Fix compiler warning 2022-09-28 16:10:54 +02:00
bb4e09ddc5 Fix compiler warnings with clang
This attribute only works on functions in clang, not function pointers.
2022-09-28 16:03:39 +02:00
fe19de5fcc GPencil: Fill Tool - Check if extensions collide with real strokes
This commit is an improvement in the previous fill tool
changes in order to improve how the extended strokes
are managed.

* Now, the algorithm checks if the extend cross a standard stroke, not only extend strokes.

* Option to enable or disable the stroke cross checking
because this can be slow in very complex scenes.

* Added `D` key to toggle stroke cross option.

* Option to use only collide strokes to be used as fill limit.

If the option to use only collide strokes is enabled, the
open extensions are in different color.

* Status text now shows mode and the actual extend factor.

This commits also contains a refactor of the loops
to use arrays as much as possible.

Reviewed By: mendio, pepeland

Differential Revision: https://developer.blender.org/D16052
2022-09-28 15:44:20 +02:00
e191cf89b2 Fix macOS cmake warning about missing OpenAL, after Python module changes 2022-09-28 14:39:25 +02:00
050b6498d3 Bump submodule versions 2022-09-28 13:45:22 +02:00
808b03da43 Cleanup: decentralize .blend I/O for space types
This adds callbacks to `SpaceType` to make each editor responsible to
manage their own .blend I/O, and moves relevant code from `screen.c`
to the editors files.

Differential Revision: D11069
2022-09-28 11:52:22 +02:00
5270ac5ed8 Fix GC tracking error for instances of mathutils types
Mathutils types were always GC tracked even when it wasn't intended.
Not having to track objects speeds up Python execution.

In an isolated benchmark created to stress test the GC
creating 4-million vectors (re-assigning them 100 times), this gives
an overall ~2.5x speedup, see: P3221.

Details:

Since [0] (which added support for sub-classed mathutils types)
tp_alloc was called which defaults to PyType_GenericAlloc which always
GC tracked the resulting object when Py_TPFLAGS_HAVE_GC was set.

Avoid using PyType_GenericAlloc unless the type is sub-classed,
in that case the object is un-tracked.

Add asserts that the tracked state is as expected before tracking &
un-tracking, to ensure changes to object creation don't cause objects
to be tracked unintentionally.

Also assign the PyTypeObject.tp_is_gc callback so types optionally GC
track objects only do so when an object is referenced.

[0]: fbd9364944
2022-09-28 17:53:30 +10:00
ada2b9f6e4 Fix T101341: make nodegroups active input/output non-animatable
Active UI list index is usually not animatable.
Here specifically, the active list index is oly used for operators acting
on a specific (active) socket.

Note other props here were already made non-animatable in
rB1d3b92bdeabc.

Maniphest Tasks: T101341

Differential Revision: https://developer.blender.org/D16077
2022-09-28 08:47:08 +02:00
788f3d72cf Fix Python module test failing with macOS + address sanitizer
Based on patch by Ankit Meel.

Ref D10877
2022-09-28 03:01:47 +02:00
5beaecb33e Fix T101414: in 3d viewport, smart uv project failed to pack
Regression from https://developer.blender.org/rBa5c696a0c2b9
2022-09-28 12:42:49 +13:00
6d1d1bf2b1 Cleanup: spelling in comments
Also add missing task ID.
2022-09-28 09:41:31 +10:00
72a7f107d8 Cleanup: format 2022-09-28 09:41:28 +10:00
6f9b84c5ce Cleanup: compiler warnings 2022-09-28 09:41:28 +10:00
552561d46e Correct sign conversion errors in convexhull_2d.c 2022-09-28 09:36:15 +10:00
5c93c37678 Cleanup: improve 2D convex hull
Improve correctness, API, comments, memory usage and performance
of the 2D convex hull calculation.

Pre-requisite for UV packing improvements.

Differential Revision: https://developer.blender.org/D16055
2022-09-28 12:24:16 +13:00
2ead05d738 Cycles: Add optional per-kernel performance statistics
When verbose level 4 is enabled, Blender prints kernel performance
data for Cycles on GPU backends (except Metal that doesn't use
debug_enqueue_* methods) for groups of kernels.
These changes introduce a new CYCLES_DEBUG_PER_KERNEL_PERFORMANCE
environment variable to allow getting timings for each kernels
separately and not grouped with others. This is done by adding
explicit synchronization after each kernel execution.

Differential Revision: https://developer.blender.org/D15971
2022-09-27 22:15:00 +02:00
b145cc9d36 Cleanup: Unused variable warning with path guiding turned off 2022-09-27 15:00:37 -05:00
f2bad0e49f Fix T101348: Sculpt smooth brush artifacts with hidden faces
The brush mixed up the vert and poly hide layers.
2022-09-27 14:50:07 -05:00
aa58f58e46 Fix: Assert in legacy mesh conversion
When setting the old face set custom data type, do it in the
"layers to write" vector instead of the mesh's poly custom
data layers, which weren't "prepared" yet. Otherwise this
could make the mesh's custom data typemap invalid.
2022-09-27 14:50:07 -05:00
2f0c40c7a2 Cleanup: Use signed integers for mesh vertex indices 2022-09-27 14:50:07 -05:00
b6ee599d92 Cleanup: Use variable and const for sculpt mesh vertex to poly maps 2022-09-27 14:50:07 -05:00
Pablo Vazquez
f69aaf71f8 WM: Support opening backup .blend files via drag-drop
Add support for opening Blender backup `.blend` files (`.blend1`, `.blend2`, etc) by dropping them into the window, just like regular .blend files.

{F13393482, size=full}

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D15700
2022-09-27 19:19:29 +02:00
447368b472 Fix: OpenPGL related build error on windows
Debug and Release libs are different libs on
Windows and will give linker errors when you
try to mix and match them.

This changes retrieves both libs and fills the
OPENPGL_LIBRARIES variable appropriately resolving
the linker error.
2022-09-27 10:48:09 -06:00
Michael Jones
2b88ee50fb Cycles: Tweak inlining policy on Metal
This patch optimises the Metal inlining policy. It gives a small speedup (2-3% on M1 Max) with no notable compilation slowdown vs what is already in master. Previously noted compilation slowdowns (as reported in T100102) were caused by forcing inlining for `ccl_device`, but we get better rendering perf by relying on compiler heuristics in these cases.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16081
2022-09-27 17:01:28 +01:00
fc604a0be3 Cycles: Disable binary archives on macOS < 13.0
An bug with binary archives was fixed in macOS 13.0 which stops some spurious kernel recompilations. In older macOS versions, falling back on the system shader cache will prevent recompilations in most instances (this is the same behaviour as in Blender 3.1.x and 3.2.x).

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16082
2022-09-27 16:58:21 +01:00
Aleš Jelovčan
b0d70a9c80 Gpencil: Time Offset modifier new Chain mode
This patch adds 5th mode to Time offset modifier, which should allow 
to create time segments list.

This will allow users to chain together multiple time ranges in 4 modes:

- Forward
- Backwards
- Pingpong
- Reverse  Pingpong

It also comes with additional Repeat parameter which specifies number 
of times particular segment should run.

The mechanic of it is transforming initial parameters into array of frames which 
are mapped to existing cfra (current frame) value.
Prototype : https://jsfiddle.net/ha2sjw8p/3/

This is also closely aligned to community request: 
https://blender.community/c/rightclickselect/Txhbbc/

This should allow creation of complex animations like dancing, 
which consists of repeating loops and transitions to the next.
One important side effect of this is dramatically reduced 
file sizes, as user no longer needs to copy paste keyframes.

Reviewed By: antoniov, mendio, pepeland

Differential Revision: https://developer.blender.org/D15052
2022-09-27 17:55:43 +02:00
12fdf9069a BLF: Editing Text with Combining Characters
Corrections for caret insertion & movement and deletion for text
strings that include non-precomposed diacritical marks (Unicode
combining characters).

See D15659 for more details and examples.

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

Reviewed by Campbell Barton
2022-09-27 08:40:36 -07:00
697e86a761 View3D: move view3d_draw.c to c++ 2022-09-27 17:38:23 +02:00
5f7259a001 GPencil: New Outline modifier
This modifier converts any stroke (no fill strokes) into perimeter
from camera view.  Also, it's possible to define an alternative 
material for the outline.

There is an option to include a target object to manipulate the start 
point of the strokes. The start point will be the nearest point 
to the target object.

Reviewed By: mendio, frogstomp

Maniphest Tasks: T100826

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

Note: Icon will be updated in T101155
2022-09-27 16:43:20 +02:00
Sebastian Herhoz
75a6d3abf7 Cycles: add Path Guiding on CPU through Intel OpenPGL
This adds path guiding features into Cycles by integrating Intel's Open Path
Guiding Library. It can be enabled in the Sampling > Path Guiding panel in the
render properties.

This feature helps reduce noise in scenes where finding a path to light is
difficult for regular path tracing.

The current implementation supports guiding directional sampling decisions on
surfaces, when the material contains a least one diffuse component, and in
volumes with isotropic and anisotropic Henyey-Greenstein phase functions.

On surfaces, the guided sampling decision is proportional to the product of
the incident radiance and the normal-oriented cosine lobe and in volumes it
is proportional to the product of the incident radiance and the phase function.

The incident radiance field of a scene is learned and updated during rendering
after each per-frame rendering iteration/progression.

At the moment, path guiding is only supported by the CPU backend. Support for
GPU backends will be added in future versions of OpenPGL.

Ref T92571

Differential Revision: https://developer.blender.org/D15286
2022-09-27 15:56:32 +02:00
6d19da0b2d Cycles: BSDF eval refactor to remove separate reflection/refraction methods
Simplifies code overall to do it inside the eval function, most of the BSDFs
already compute the dot product.

The refactoring in bsdf_principled_hair_eval() was needed to avoid a HIP
compiler bug. Cause is unclear, just changing the implementation enough
is meant to sidestep it.

Ref T92571, D15286
2022-09-27 15:56:28 +02:00
Sebastian Herhoz
bd249eb4f3 Cycles: BSDF changes in preparation of path guiding
* Return roughness and IOR for BSDF sampling
* Add functions to query IOR and label for given BSDF
* Default IOR to 1.0 instead of 0.0 for BSDFs that don't use it
* Ensure pdf >= 0.0 in case of numerical precision issues

Ref T92571, D15286
2022-09-27 15:47:03 +02:00
Germano Cavalcante
715c86d9e5 Fix T101231: Console flooded with warnings when fluid type is Domain
Although rB67e23b4b2967 turned the problem more recurrent, the warning
messages in the console always appear when `BKE_fluid_cache_free_all`
is called.

This is because of a bug in `BLI_filelist_dir_contents` as this function
calls `BLI_strdupcat` instead of `BLI_join_dirfile`

NOTE: Other places in Blender avoid this problem by making sure to add
a `SEP_STR` to the end of the directory.

Differential Revision: https://developer.blender.org/D16043
2022-09-27 10:17:29 -03:00
f3a46e2fd9 Deps: fix builing wayland-scanner
- fix the source package download URL
- patch the `meson.build` file to allow the CentOS 7 meson version to be
  used
- only build what we need (`wayland-scanner`), and not the libraries,
  documentation, and tests.

Ref: D16074

This also reverts commit f6664217b3
"Build: temporarily disable wayland dependency".
2022-09-27 15:11:57 +02:00
0084b8635f Fix T101398: Transfer Attribute node still defined in menu
Removing this item was missed in 837144b457.
2022-09-27 07:49:21 -05:00
ed28ba4e99 Fix T101393: Vertex Crease operator does not create vertex crease layer
Typo in rBa8a454287a27 (created layer on edge data instead of vertex
data).

Maniphest Tasks: T101393

Differential Revision: https://developer.blender.org/D16079
2022-09-27 14:38:48 +02:00
f6664217b3 Build: temporarily disable wayland dependency
This caused problems on centos7, see D16074 for details.
2022-09-27 22:28:55 +10:00
1cbfe04638 Fix: GPencil animated layer transforms evaluate wrong when identity
Due to (optimization) checks in in `BKE_gpencil_prepare_eval_data` &
`BKE_gpencil_update_layer_transforms`, updates were skipped if animation
reached exact identity transforms.

Now check if the matrix has changed additionally to gain proper updates.
Unsure if this is the cheapest way to check for the animated state of
layer transforms tbh, but I see similar checks elsewhere.

Fixes T101164.

Maniphest Tasks: T101164

Differential Revision: https://developer.blender.org/D16018
2022-09-27 12:29:07 +02:00
30113e54d2 Fix curves sculpting in deformed space when using Subdivide node
Needs a call to remember_deformed_curve_positions_if_necessary, missed
in rB1f94b56d7744.

Thx @JacquesLucke for the solution!

Differential Revision: https://developer.blender.org/D16078
2022-09-27 11:59:56 +02:00
4a60c4746d Fix T101272: Missing view layer updates handling collections via python.
Fixed by ensuring the view layer is up to date.
2022-09-27 11:57:34 +02:00
cbab734445 Build: add wayland to deps build
This is needed to ensure and up to date "wayland-scanner" is used,
as versions before 1.20.0 generate headers incompatible with
dynamic linking (WITH_GHOST_WAYLAND_DYNLOAD).

As the centos7 version of wayland is 1.15 so make this part of Blender's
dependencies on Linux.

We intend to enable Wayland for Blender 3.4 release, this is needed for
the build-bot.

Reviewed By: brecht

Ref D16074
2022-09-27 19:22:07 +10:00
5f6d66c1c5 Cleanup: Fix brace-scalar-init warning 2022-09-27 10:19:12 +02:00
b6a7541f87 GHOST: exit with an error when GHOST cannot be initialized
When the GHOST back-end Blender was built with isn't supported,
Blender would crash on startup without any useful information.
This could happen when building X11 only, then running on Wayland.

Now show a list of the GHOST back-ends that were attempted and exit
with an error code instead of crashing.
2022-09-27 17:14:32 +10:00
78952518e7 Cleanup: format 2022-09-27 16:36:27 +10:00
Iyad Ahmed
cd7ec0dac6 WM: batch rename action clips
Batch rename for action clips works in outliner and 3d view.

Reviewed By: campbellbarton

Ref D15819
2022-09-27 12:13:08 +10:00
2edb8ab739 Revert "Cleanup: remove redundant WITH_GHOST_WAYLAND check"
This reverts commit 7fa7c7ceda.

The check was not redundant, it accounted for wayland not being found.
2022-09-27 11:53:12 +10:00
4e1d32107b Build: add missing include for opencolorio
OpenColorIO failed to build on Linux+GCC-12.2 because of strlen() use.
2022-09-27 11:21:35 +10:00
7fa7c7ceda Cleanup: remove redundant WITH_GHOST_WAYLAND check 2022-09-27 09:14:24 +10:00
Iliya Katueshenock
8da253cfb6 Fix T101361: Collapsed multi-input sockets not collapsing noodles
Caused by 40d815dff6, which removed the check for "hidden" nodes.

Differential Revision: https://developer.blender.org/D16061
2022-09-26 18:10:27 -05:00
dcd909122f Scew Modifier: Remove eager normal calculation
The screw modifier calculated normals eagerly (whether or not the
next modifier actually used them). However, this was incorrect and
set invalid normals. It isn't necessary because they can be calculated
later anyway. The potential performance improvement isn't worth the
complexity or maintenance burden.

Fixes T101075

Differential Revision: https://developer.blender.org/D16073
2022-09-26 17:59:44 -05:00
722b850c38 GPU: Fix crash when rendering with compositor using CLI
The backend gets used before it is initialized again.

This is just a workaround for now as production schedule needs ir.
2022-09-27 00:53:56 +02:00
408a8edf89 Cleanup: remove unnecessary argument to else() in CMake
We have moved away from duplicating arguments in else() and endif()
commands.
2022-09-27 08:49:51 +10:00
b77ad0c82d Cleanup: correct indentation of harvest.cmake 2022-09-27 08:48:28 +10:00
cd1caa5853 GPU: Revert part of D16017 that was accidentally commited
This code slipped through the final review step surely caused by a faulty
merge.

Fixes T101372 Regression: World shader setup crashes Blender in rendered view

Regression introduced by rB697b447c2069bbbbaa9929aab0ea1f66ef8bf4d0
2022-09-27 00:00:28 +02:00
Sebastian Herhoz
66a863e301 Build: add OpenPGL as to deps builds
Ref T92571, D15286
2022-09-26 23:40:33 +02:00
bcb7b119ae Cleanup: remove workarounds and version checks for unsupported compilers
Match minimum supported versions from the WIKI [0] by raising them to:

- GCC 9.3.1
- CLANG 8.0
- MVCS 2019 (16.9.16 / 1928)

Details:

- Add CMake checks that ensure supported compiler versions early on.
- Previously GCC per-processor version checks served to exclude
  `__clang__`, in some cases this has been replaced by explicitly
  excluding `__clang__`. This was needed as CLANG treated some of these
  flags differently to GCC, causing the build to fail.
- Remove USE_APPLE_OMP_FIX GCC-4.2 OpenMP workaround.
- Remove linking error workaround for old MSVC versions.

[0]: https://wiki.blender.org/wiki/Building_Blender

Reviewed by: brecht, LazyDodo

Ref D16068
2022-09-27 07:05:13 +10:00
cd7e9a1ad5 Cleanup: use the system-handle arg for GHOST_SetMultitouchGestures
There was an unused argument warning, quiet by using the argument.
2022-09-27 07:05:13 +10:00
84ddb8b3cc UI: add preference to disable touchpad multitouch gestures
Available on Windows and macOS, where such gestures are supported.
For Windows, disabling this option restores touchpad behavior to
match Blender 3.2.

Ref T97925

Differential Revision: https://developer.blender.org/D16005
2022-09-26 22:59:35 +02:00
57ea827bfb Fix: Incorrect handling for crease layers
First, there can only be one crease layer, so remove the "default name",
since apparently that's how CustomData tests for that
(see `CustomData_layertype_is_singleton`).

Second, always propagate crease data because it can be used in arbitrary
situations by geometry nodes. That also has to be done for all generic
attribute layers.

Fixes T101340, T101373
2022-09-26 15:42:29 -05:00
8d49a4f36e Fix T101365: saving second view layer as (non-Multilayer) OpenEXR does not work 2022-09-26 22:24:39 +02:00
d4fc451b90 Fix T101354: Cycles crash with baking and adaptive sampling 2022-09-26 22:16:01 +02:00
ddf6f70049 Fix build errors and warnings after recent changes, when not using Unity build 2022-09-26 21:12:25 +02:00
c15a761524 Geometry Nodes: Miscellaneous changes in control point neighbors node
- Use const and whitespace more consistently
- Fix "Offset Valid" output only working on point domain
- Use the smallest output array that can contain the result.
- Consistent include ordering
- Use "data-block" term instead of "object" in tooltip
- Remove unnecessary call to set default output values
2022-09-26 13:23:07 -05:00
837144b457 Nodes: Use plain menus for geometry nodes add menu
At the cost of slightly more boilerplate code, we can avoid the `NodeItem`
and `NodeCategory` abstractions used to build the node add menu.
This makes the menus more flexible and more obvious, which will
make them easier to extend with assets.

The identifiers for the new menu types are inconsistent with regular
class naming for backwards compatibility with the old "category"
menu naming.

Also adds an item for the "Self Object" node missed in dd5131bd70.

Differential Revision: https://developer.blender.org/D15973
2022-09-26 13:10:42 -05:00
8a6dc0fac7 Geometry Nodes: Control Point Neighbors Node
This node allows access to the indices of neighboring control points
within a curve via an offset. This includes taking into consideration
curves that are cyclic.

Differential Revision: D13373
2022-09-26 13:03:28 -05:00
46cfd345e4 Fix typo and and incorrect property initialization
Error in rB236fda7faf58
2022-09-26 14:23:11 -03:00
236fda7faf Fix T101343: useless Snapping menu in transform operators
Changes:
- Use the "snap_elements" property only for operators that support snapping to geometry.
- Remove unused properties:
  - "use_snap_to_same_target",
  - "snap_face_nearest_steps").
- Fix property with wrong name "use_snap_selectable_only" -> "use_snap_selectable"
- Fix use of dependent property flags.
- Remove redundant initialization of variables
- Simplify `poll_propety`. Only the "use_snap_project" is not hidden.

>>! In rBc484599687ba it's said:
>  These options are needed for Python tools to control snapping without requiring the tool settings to be adjusted.
If that's the case, there doesn't seem to be any need to display them in the redo panel.  Therefore:
- Hide snapping properties in redo panel.

Many properties have been added that can be independent of ToolSettings. Therefore:
- Save snapping properties in the operator itself. For Redo.
2022-09-26 14:18:39 -03:00
125ac1f914 Cycles: increase min-supported driver version for Intel GPUs
Windows drivers 101.3430 fix an important GUI-related crash and it's
best to prevent users from running into it.
Linux drivers weren't affected but still had relevant gpu binary
compatibility fixes, so it makes sense to keep the min-supported version
aligned across OSes.
2022-09-26 07:41:47 -07:00
Angus Stanton
2522ca03d2 Asset Browser: Add slider UI to pose blending
Add the Slider UI to pose blending. This adds a slider with percentages,
and controls for precision control and incremental control.

Reviewed By: sybren

Maniphest Tasks: T90182

Differential Revision: https://developer.blender.org/D14984
2022-09-26 16:21:00 +02:00
2356afc7af Cleanup: format, ensure trailing newlines 2022-09-26 21:52:40 +10:00
03eac69c61 Cleanup: restore parenthesis removed in recent commit
Partial revert [0], removed by accident because the -fpermissive
flag was enabled with collada.

[0]: 34477bbfcd
2022-09-26 21:51:43 +10:00
b211540783 Fix: bump subversion to avoid corrupted files
Replacing the transfer node breaks forward compatibility, so a version
bump is necessary to get a warning in older versions.
2022-09-26 12:06:54 +02:00
fa1c214c5b Fix crash in Solidify modifier with Inner Crease
Since a8a454287a the simple case would crash:

- Add place
- Add Solidify modifier
- Set Inner Crease to something non-zero

Seems to be a mistake in the logic which was trying to access
existing custom data layer on a clean result while it is more
logical to create the layer.

Was initially reported by the studio who could not open
production files after the change.
2022-09-26 11:55:34 +02:00
530b9841ee Fix T101370: GPencil Grab Sculpt crash after bake transform animation
The problem was the duplicated strokes had wrong pointers 
to the original stroke.
2022-09-26 11:09:49 +02:00
333e41eac6 Cleanup: replace C-style casts with functional casts for numeric types
Use function style casts in C++ headers & source.
2022-09-26 17:58:36 +10:00
0210c4df17 GPU: Disable SSBO support from commandline.
In heavy scenes containing many hairs/curves and volumetrics
using SSBO can overwrite the binding information of the volumetric
resolve shader. This has been detected during project Heist and is
only reproducable on NVIDIA platform.

This patch adds an debug option to disable SSBOs from the command
line to replace the --debug-gpu-force-workarounds that has been
used as a workaround on the render farm. Reason is that
force workarounds will also add other limitations as well (number
of texture binds for example)
2022-09-26 09:41:50 +02:00
6075b04cf9 System info: Added GPU device type and feature support.
Adds more information to System info to help triaging/debugging.
2022-09-26 08:36:05 +02:00
267aee514a Python: Add platform feature support methods to gpu.capabilities module.
Depending on the actual platform, Blender will disable features that are
known to have a faulty implementation. Add-on developers or users don't
have the ability to check what is actually enabled.

This patch will add the ability to check for

* Compute shader support `gpu.capabilities.compute_shader_support_get()`.
* SSBO support `gpu.capabilities.shader_storage_buffer_objects_support_get()`.
* Image load/store `gpu.capabilities.shader_image_load_store_support_get()`.
2022-09-26 08:19:44 +02:00
b4605f6158 Console: Add gpu python module to list of internal modules.
The python GPU module was not mentioned in the list of internal
modules. Adding the GPU module to the list allows curious users
to find it.
2022-09-26 08:18:17 +02:00
34477bbfcd Cleanup: remove redundant parenthesis 2022-09-26 14:23:52 +10:00
6275541df7 Cleanup: use ELEM/STR_ELEM/STREQ macros 2022-09-26 14:12:38 +10:00
96d88e5614 CMake: remove workaround for GCC 4.5 as 9.3.1 is the minimum version
The -fpermissive flag is best avoided as it suppresses some important
warnings/errors.
2022-09-26 11:52:21 +10:00
20276191e5 Cleanup: fix warning in recent parenthesis removal
Regression in [0], this slipped through due to "-fpermissive"
being added to GCC flags, suppressing the error.

[0]: c9e35c2ced
2022-09-26 11:39:24 +10:00
3961d3493b Cleanup: use 'u' prefixed integer types for brevity in C code
This also simplifies using function style casts when moving to C++.
2022-09-26 11:33:22 +10:00
3a7dc572dc Cleanup: use 'u' prefixed unsigned types for GHOST 2022-09-26 10:52:52 +10:00
5b320e5a24 Fix undefined 'uint' for macOS/WIN32 2022-09-26 10:42:47 +10:00
8a68f4f808 Cleanup: replace unsigned with uint, use function style casts for C++ 2022-09-26 10:09:15 +10:00
15f3cf7f8f Cleanup: replace C-style casts with functional casts for numeric types
Some changes missed from f68cfd6bb0.
2022-09-26 09:53:49 +10:00
e746999aa9 Fix T101309: crash when executing geometry nodes without logger 2022-09-25 23:07:29 +02:00
b3714b1e85 BLF: Refactor of blf_font_boundbox_foreach_glyph
Refactor of `BLF_boundbox_foreach_glyph` and simplification of its
usage by only passing translated glyph bounds to callbacks.

See D15765 for more details.

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

Reviewed by Campbell Barton
2022-09-25 11:25:31 -07:00
c8ee70c962 Geometry Nodes: decentralize implicit input definitions
Previously, all implicit inputs where stored in a centralized place.
Now the information which nodes have which implicit inputs is
stored in the nodes directly.
2022-09-25 19:16:53 +02:00
2fd63efd0e BLI: simplify removing elements from containers with predicate
Previously removing elements based on a predicate was a bit cumbersome,
especially for hash tables. Now there is a new `remove_if` method in some
data structures which is similar to `std::erase_if`. We could consider adding
`blender::erase_if` in the future to more closely mimic the standard library,
but for now this is using the api design of the surrounding code is used.
2022-09-25 17:57:49 +02:00
c6e70e7bac Cleanup: follow C++ type cast style guide in some files
https://wiki.blender.org/wiki/Style_Guide/C_Cpp#C.2B.2B_Type_Cast

This was discussed in https://devtalk.blender.org/t/rfc-style-guide-for-type-casts-in-c-code/25907.
2022-09-25 17:39:45 +02:00
0419ee871f Cleanup: remove redundant parenthesis (especially with macros) 2022-09-25 22:41:22 +10:00
21d77a417e Cleanup: replace C-style casts with functional casts for numeric types
Some changes missed from f68cfd6bb0.
2022-09-25 22:31:31 +10:00
d35a10134c Cleanup: Remove commented lines 2022-09-25 12:31:05 +02:00
b6adca3280 Fix T101317: GPencil separate Active layer freezes blender
The error occurs only when the layer is empty.
2022-09-25 12:26:59 +02:00
f68cfd6bb0 Cleanup: replace C-style casts with functional casts for numeric types 2022-09-25 20:17:08 +10:00
c7b247a118 Cleanup: replace static_casts with functional casts for numeric types 2022-09-25 18:31:10 +10:00
891949cbb4 Cleanup: use 'u' prefixed integer types for brevity & cast style
To use function style cast '(unsigned char)x' can't be replaced by
'unsigned char(x)'.
2022-09-25 18:26:27 +10:00
c9e35c2ced Cleanup: remove redundant double parenthesis 2022-09-25 15:34:32 +10:00
865894481c Cleanup: quiet compiler warning 2022-09-25 15:26:30 +10:00
26f330ea4c Cleanup: format, spelling in comments 2022-09-25 15:24:37 +10:00
4e7983e073 UI: Improved Font Thumbnails
Thumbnails of fonts that better show design, shapes, contents, intent,
and intended language. Previews almost every known language - living
and dead - and symbol, specialty fonts, etc.

See D12032 for more details and samples.

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

Reviewed by Campbell Barton
2022-09-24 10:57:34 -07:00
2ff5d42cd3 Sculpt: Fix bug with allocating duplicate attribute layers
Sculpt attribute API was incorrectly allocating duplicate
attribute layers.
2022-09-24 10:04:28 -07:00
72933ebe96 BLF: Correctly Set Default Font Size
Commit cd1631b17d fails to scale the global_font_size by UI scale in
BLF_set_default. Generally used for simple text output like statistics.

See D16053 for more details.

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

Own Code
2022-09-24 08:23:36 -07:00
1b46d57f67 Fix: Invalid CustomData type map created for legacy mesh conversion
Caused by 060a534141.
2022-09-24 09:37:30 -05:00
535f50e5a6 Curves: Use early out when apapting domain of single value
When adapting the domain of a single value virtual array, skip
allocating an array for the result and just return another single
value. Among other cases, this can help when everything is selected
in sculpt mode, moving domain interpolation from 5% of perf samples
to 0% when sculpting.
2022-09-24 09:31:15 -05:00
c25df02ac3 Cleanup: simplify accessing mesh looptris 2022-09-24 11:41:08 +02:00
8422da13c9 GPencil: Exist early from loop for Fill extensions
It does not need follow in the loop if a collision was found.
2022-09-24 11:18:39 +02:00
f416a76bcd Cleanup: typo in static node type 2022-09-24 10:33:17 +02:00
cd1631b17d BLF: Refactor of DPI
Correction of U.dpi to hold actual monitor DPI. Simplify font sizing by
omitting DPI as API argument, always using 72 internally.

See D15961 for more details.

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

Reviewed by Campbell Barton
2022-09-23 17:36:49 -07:00
88a602bc64 Fix build error in blenloader on macOS after recent changes 2022-09-24 01:21:26 +02:00
ff27b68f41 Fix T101295: Allow Large Windows Thumbnails
Allow our Windows Thumbnail Handler to supply thumbnails up to the
maximum 256x256 size.

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

Reviewed by Ray Molenkamp
2022-09-23 14:49:36 -07:00
ce63fea080 Cleanup: Remove unused data transfer function 2022-09-23 16:30:25 -05:00
1b5c94630e GPU: Disable static compilation for geometry shaders workaround
These shaders are only supported by the Metal backed.
Regression introduced by 1514e1a5b7
2022-09-23 23:27:42 +02:00
fd2668a368 Overlay: Fix overlay image shaders
Regression introduced in 18b45aabf9.
Caused by a bad merge.
2022-09-23 23:27:42 +02:00
c2a21dfb77 Sculpt: fix memory corruption in new attribute api 2022-09-23 14:16:11 -07:00
7e980f2b8c Fix T101249: Node groups don't show in node search
bdb5754147 neglected to add search items for node groups.
Luckily adding them is quite simple. However, if the node group is also
an asset, it will show up duplicated in the list. To resolve this we
avoid adding node groups to the list if they have already been
added as assets.
2022-09-23 14:25:25 -05:00
dedc679eca Geometry Nodes: Split transfer attribute node
This patch replaces the existing transfer attribute node with three
nodes, "Sample Nearest Surface", "Sample Index", and "Sample Nearest".
This follows the design in T100010, allowing for new nodes like UV
sampling in the future. There is versioning so the new nodes replace
the old ones and are relinked as necessary.

The "Sample Nearest Surface" node is meant for the more complex
sampling algorithms that only work on meshes and interpolate
values inside of faces.

The new "Sample Index" just retrieves attributes from a geometry at
specific indices. It doesn't have implicit behavior like the old
transfer mode, which should make it more predictable. In order to not
change the behavior from existing files, the node has a has a "Clamp",
which is off by default for consistency with the "Field at Index" node.

The "Sample Nearest" node returns the index of the nearest element
on a geometry. It can be combined with the "Sample Index" node for
the same functionality as the old transfer node. This node can support
curves in the future.

Backwards compatibility is handled by versioning, but old versions can
not understand these nodes. The warning from 680fa8a523 should make
this explicit in 3.3 and earlier.

Differential Revision: https://developer.blender.org/D15909
2022-09-23 13:56:35 -05:00
d5554cdc7c Fix T100741: Update FFMPEG Dimensions
Update the animation's dimensions within ffmpeg_fetchibuf in case it
has changed because of dynamic resolution (possible with WebM).

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

Reviewed by Richard Antalik
2022-09-23 10:50:05 -07:00
d12f0d3f70 Fix: Crash with empty vertex group in mask modifier
The C++ vertex group data accessor returned a span with null data that
wasn't empty. Instead of adding a null check as well as the size check,
just return an empty span when there is no vertex group data.
2022-09-23 12:32:08 -05:00
392855ce50 GPencil: Improve Fill Tool Extend lines
* Improve how the extend lines collision is calculated.
* Added `S` key to switch between modes.
*  Now extend factor does not disable visual aids (thi sis done with checkbox).
* Reduce the use of linked list and now memory array is used.
* Refactor Radius functions.
* Fixed bug of Radius mode when object is rotated.
* Cleanup code.

Differential Revision: https://developer.blender.org/D16022
2022-09-23 19:29:02 +02:00
2d8eadacf9 Fix: Missing DNA rename for recent mesh refactor
12becbf0df changed to `flag_legacy` but didn't use a rename.
2022-09-23 12:13:25 -05:00
67308d73a4 Node Editor: Adjust node link curving
Clamp node link curving when the link is close to horizontal to prevent
overshooting at the ends.

Reviewed By: Pablo Vazquez, Hans Goudey

Differential Revision: http://developer.blender.org/D16041
2022-09-23 18:13:45 +02:00
2438f76d6f Fix: Assert calculating mesh triangulation
The condition from 0d7d8c73cf was reversed.
2022-09-23 10:45:07 -05:00
12becbf0df Mesh: Move selection flags to generic attributes
Using the attribute name semantics from T97452, this patch moves the
selection status of mesh elements from the `SELECT` of vertices, and
edges, and the `ME_FACE_SEL` of faces to generic boolean attribute
Storing this data as generic attributes can significantly simplify and
improve code, as described in T95965.

The attributes are called `.select_vert`, `.select_edge`, and
`.select_poly`. The `.` prefix means they are "UI attributes",so they
still contain original data edited by users, but they aren't meant to
be accessed procedurally by the user in arbitrary situations. They are
also be hidden in the spreadsheet and the attribute list.

Until 4.0, the attributes are still written to and read from the mesh
in the old way, so neither forward nor backward compatibility are
affected. This means memory requirements will be increased by one byte
per element when selection is used. When the flags are removed
completely, requirements will decrease.

Further notes:
* The `MVert` flag is empty at runtime now, so it can be ignored.
* `BMesh` is unchanged, otherwise the change would be much larger.
* Many tests have slightly different results, since the selection
  attribute uses more generic propagation. Previously you couldn't
  really rely on edit mode selections being propagated procedurally.
  Now it mostly works as expected.

Similar to 2480b55f21
Ref T95965

Differential Revision: https://developer.blender.org/D15795
2022-09-23 10:45:07 -05:00
e345686cb7 View3d: move space_view3d.c to c++ 2022-09-23 16:51:29 +02:00
63bdd89108 Cleanup: use depsgraph iterator settings in rna
Somehow missed this as part of rBb197cd5821f1dfaa5168d31984dd8014f5252456.
2022-09-23 16:12:59 +02:00
a8a454287a Mesh: Move edge crease out of MEdge
This is very similar to D14077. There are two differences though.
First is that vertex creases are already stored in a separate layer,
and second is that we can now completely remove use of `Mesh.cd_flag`,
since that information is now inherent to whether the layers exist.

There are two functional differences here:
 * Operators are used to add and remove layers instead of a property.
 * The "crease" attribute can be created and removed by geometry nodes.

The second change should make various geometry nodes slightly faster,
since the "crease" attribute was always processed before. Creases are
now interpolated generically in the CustomData API too, which should
help maintain the values across edits better.

Meshes get an `edge_creases` RNA property like the existing vertex
property, to provide more efficient access to the data in Cycles.

One test failure is expected, where different rounding between float
the old char storage means that 5 additional points are scattered in
a geometry nodes test.

Differential Revision: https://developer.blender.org/D15927
2022-09-23 09:02:28 -05:00
b197cd5821 Cleanup: use depsgraph iterator settings in rna
This was missing in rBe5d4afd5bac71e29ba71ecf091feaa0d70b70260.
2022-09-23 15:49:12 +02:00
0d7d8c73cf Mesh: Use cached looptris in draw cache extraction
The mesh's triangulation cache is often created for other operations
besides the drawing code, but during the mesh draw cache extraction
it is recalculated on every single time. It is simpler and faster to use
the existing MLoopTri array. It can also save memory if the cache
already exists by avoiding allocating a duplicate array. For a 4 million
face quad mesh, that is already 128 MB.

Also use face normals for mesh triangulation if they aren't dirty,
which should provide a general speedup when they're both necessary.

Recently 54182e4925 made this more reliable, since the triangulation
cache is invalidated properly when the mesh is deformed.

Fixes T98073

Differential Revision: https://developer.blender.org/D15550
2022-09-23 08:23:35 -05:00
060a534141 Mesh: Move sculpt face sets to a generic attribute
Similar to the other refactors from T95965, this commit moves sculpt
face sets to use a generic integer attribute named `".sculpt_face_set"`.
This makes face sets accessible in the Python API.

The attribute is not visible in the attributes list or the spreadsheet
because it is meant for internal use, though that could be an option
in the future along with other similar attributes. Currently the change
is small, but in the future this could simplify code by allowing use
of more generic attribute APIs.

Differential Revision: https://developer.blender.org/D16045
2022-09-23 08:19:40 -05:00
35375380d7 Cleanup: Grammar fix in lazy function 2022-09-23 08:05:44 -05:00
998fc4f8f6 Cleanup: fix compiler errors 2022-09-23 14:45:25 +02:00
f2b5fd0a0e Cleanup: give anonymous enum a name 2022-09-23 12:48:22 +02:00
e5d4afd5ba Depsgraph: generalize passing parameters to depsgraph object iterator
This makes it easier to pass more parameters to the iterator in the future.

Differential Revision: https://developer.blender.org/D16047
2022-09-23 12:41:22 +02:00
eb54502d9d Fix T101109: Animation on nodes problems when dealing with Node Groups
Whenever animation on nodes was transfered to/from nodegroups (grouping/
ungrouping/separating) via BKE_animdata_transfer_by_basepath, it was
possible to create new nodes with the same name (in the formerly same
path -- see report for an example of this) and animation from the
original node was still performed on them. Issue went away after save/
reload.

In order to fully update the action, a depsgraph is now performed on the
action (similar to what is done when renaming for example).

Maniphest Tasks: T101109

Differential Revision: https://developer.blender.org/D15987
2022-09-23 12:06:32 +02:00
c350d97a2f Fix T101046: missing DEG update changing bone layers in editmode
Following {T54811} (and {rBbb92edd1c802}), DEG updates have been added
to the various operators. This has also been done for the layers
operators (see {rBf998bad211ae}, `ARMATURE_OT_bone_layers` has been
marked done in T54811). However, instead of `ARMATURE_OT_bone_layers`,
the update tagging actually happened for `POSE_OT_bone_layers`.

Now do this for `ARMATURE_OT_bone_layers` as well (keep it for
`POSE_OT_bone_layers`, dont think this is wrong there either).

Maniphest Tasks: T101046

Differential Revision: https://developer.blender.org/D15969
2022-09-23 12:06:02 +02:00
fbd78a8d78 Cleanup: use ELEM macro 2022-09-23 15:29:21 +10:00
c655bdfa31 Cleanup: add string utility macros to GHOST/Wayland
Use STREQ for readability.
2022-09-23 15:28:48 +10:00
77ed4651ee Cleanup: float literals 2022-09-23 15:28:48 +10:00
0f6d5c9a9d Docs: minor improvements to info_advanced_blender_as_bpy wording 2022-09-23 15:04:02 +10:00
c172522060 Fix T100141: Header Alignment of New Editors
Revert part of [0] which changed logic for scaling 2D regions
when the window resize. This re-introduces T72392 which can be
fixed separately.

[0]: 6243972319
2022-09-23 14:33:51 +10:00
0e94d24080 Cleanup: replace int return value with bool 2022-09-23 14:33:47 +10:00
187d8ba362 Cleanup: avoid unnecessary access to context.space_data 2022-09-23 14:33:46 +10:00
998ace3463 Cleanup: use lowercase function calls & macros in for CMake
This is already the case for most CMake usage.
Although some find modules are an exception to this, as they were
originally maintained externally they use some different conventions.

Also corrected bad indentation in: intern/cycles/CMakeLists.txt
2022-09-23 14:33:44 +10:00
add1b6ab3c Cleanup: spelling in comments 2022-09-23 14:33:43 +10:00
3edd87f009 Cleanup: format 2022-09-23 14:33:42 +10:00
cda2dc721d Cleanup: compiler warnings 2022-09-23 14:33:40 +10:00
e9344d329f Fix: Add missing drag link search item for store named attribute node
The search didn't add an item for the geometry output socket.
2022-09-22 16:54:23 -05:00
319ee296fd Curves editmode: show point selection
Points cannot be selected atm in editmode, this patch just shows the
selection from sculptmode in editmode.

Since the selection in sculptmode is a float, a point is considered
selected as soon as the float selection is above 0.0f.

Implementation: this piggy-back on the existing drawing via
overlay_edit_curve_point.glsl which requires a "data" VBO which holds
flags for selection (next to others such as "active" - which we also
have to take care of later).

Differential Revision: https://developer.blender.org/D16021
2022-09-22 20:23:13 +02:00
Charlie Jolly
680fa8a523 Fix T100846: Bump blender file min version for forward compatibility warning
Also reported in blender.chat.

Corrupted files were reported after opening files with the new Mix node (rBbfa0ee13d539).

Files saved in 3.4 will not be compatible with older versions of Blender.

Opening these files in previous versions will exhibit a red undefined node.

Reviewed By: HooglyBoogly, brecht

Differential Revision: https://developer.blender.org/D16025
2022-09-22 17:08:50 +01:00
Jason Fielder
e8bcca4bdc GPU: Ensure rendering operations occur within GPU render boundaries.
This is required by the Metal backend to perform flushing of temporary objective-C resources. This is implemented as a global autoreleasepool, and is to ensure consistency such that all rendering operations, whether called via events, or via main loop will be within an autoreleasepool.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D15900
2022-09-22 18:05:59 +02:00
Jason Fielder
18b45aabf9 Metal: GLSL shader compatibility changes for global uniform and interface name collision.
For the Metal shader translation support for shader-global uniforms are remapped via macro's, and in such cases where a uniform name matches a vertex attribute name, compilation errors will occur due to this injected syntax being incompatible with the immediate code.

Also adding source-level function interface alternatives where sized arrays are passed in. These are not supported directly in Metal shading language and are instead handled as pointers. These pointers require explicit address-space qualifiers in some cases, if device/constant address space memory is passed into the function.

Ref T96261

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D15898
2022-09-22 17:53:56 +02:00
Jason Fielder
1514e1a5b7 Metal: First set of Geometry Shader alternative implementations using SSBO vertex shader fetch.
These implementations remove dependency on the Geometry pass by instead invoking one vertex shader instance for each expected output vertex, matching what a geometry shader would emit. Each vertex shader instance is then responsible for calculating the same output position based on its vertex_id as the logic would in the geometry shader version.

SSBO Vertex fetch enables full random-access into a vertex buffer by binding it as a read-only SSBO. This enables each instance to read neighbouring vertex data to perform contextual calculations as a geometry shader would, for cases where attribute Multiload is not supported.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D15901
2022-09-22 17:43:04 +02:00
Thomas Dinges
697b447c20 Metal: MTLContext implementation and immediate mode rendering support.
MTLContext provides functionality for command encoding, binding management and graphics device management. MTLImmediate provides simple draw enablement with dynamically encoded data. These draws utilise temporary scratch buffer memory to provide minimal bandwidth overhead during workload submission.

This patch also contains empty placeholders for MTLBatch and MTLDrawList to enable testing of first pixels on-screen without failure.

The Metal API also requires access to the GHOST_Context to ensure the same pre-initialized Metal GPU device is used by the viewport. Given the explicit nature of Metal, explicit control is also needed over presentation, to ensure correct work scheduling and rendering pipeline state.

Authored by Apple: Michael Parkin-White

Ref T96261

(The diff is based on 043f59cb3b)

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D15953
2022-09-22 17:32:43 +02:00
Thomas Dinges
bb63b98d1f Metal: MTLVertBuf implementation and support for texture creation from vertex buffers.
Metal: MTLVertBuf implementation and support for texture creation from vertex buffers.

Authored by Apple: Michael Parkin-White

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D15452
2022-09-22 17:16:22 +02:00
dd5131bd70 Geometry Nodes: Add Self Object Node
From the nodes' description: "Retrieve the object that contains
the geometry nodes modifier currently being executed". This was
discussed in the most recent geometry nodes module meeting.

Because the node allows you to retrieve the position of the modifier
object, it has to add a depsgraph relation to object transform.
Expect that modifiers will be reevaluated when moving the object.
In the future, better static analysis of node trees could make this
check smarter.

Differential Revision: https://developer.blender.org/D16037
2022-09-22 08:15:03 -05:00
dc06bf2cb6 Fix crash loading fonts that fail to be read
Null pointer dereference since [0] when font's can't be read.

[0]: d39abb74a0
2022-09-22 22:11:09 +10:00
Werner, Stefan
0c824837ab Cycles: Cleanup in oneAPI math includes and definitions
Now explicitly including math.h first before #defining funcitons.
This avoids undefined behavior and improves compatibility with
different SYCL compilers and backends.
2022-09-22 11:33:57 +02:00
75d984a712 Refactor: const-correctness in bmesh conversion assert 2022-09-22 10:33:12 +02:00
c50335b359 UV: add toggle to show the grid over the image
In UV editor, previously unable to see grid and image at same time.

Maniphest Tasks: T78391

Differential Revision: https://developer.blender.org/D16038
2022-09-22 17:20:11 +12:00
3185c3bc74 Cleanup: use an array of modifier keys for GHOST/Wayland
Support iterating over modifiers, instead of using macros.
2022-09-22 13:47:17 +10:00
ef06375159 GHOST: assert when unknown keys are passed to the ModifierKeys API 2022-09-22 13:47:17 +10:00
7ce09ef48f Cleanup: remove unused modifier state checks from getModifierKeys
Also remove unused numpad & caplock key index storage.
2022-09-22 13:47:17 +10:00
967fe75bb6 Cleanup: remove redundant includes from GHOST_SystemPathsUnix 2022-09-22 13:47:17 +10:00
62ffbc7d7f PyGPU: Allow single bool in 'GPUShader.uniform_bool' method
As with the other uniform methods, a single value is expected.
2022-09-21 22:30:57 -03:00
20dc839319 Fix T101262: Crash in spreadsheet selection filter with empty domain
The BMesh selection virtual array was empty. There are a few different
places we could add an "empty" check here, but at the top of the
function is the simplest for now.
2022-09-21 17:34:30 -05:00
77dcfac8a3 Fix: Use correct node group for add node search
Similar to e5a7470638, the tree currently being edited should be
used for polling and other tests, rather than the node tree at the root
of the node editor's path.
2022-09-21 17:12:53 -05:00
3676d6b88d Cleanup: Use const arguments for node group poll function
Also make the disabled hint argument optional.
2022-09-21 17:12:53 -05:00
f42569bb71 Fix EEVEE: Screen Space Refraction Artefacts caused by viewport aspect ratio
This was caused by the vertical/horizontal clasification being done in
NDC space which wasn't respecting the Aspect ratio.

Multiplying the test vector by the target size fixes the issue.
2022-09-21 21:48:23 +02:00
91dd29fd45 Attributes: Allow calling "finish" on empty accessors
This removes some boilerplate when creating many optional attributes.
2022-09-21 13:17:05 -05:00
600c069e0e Attributes: Correct implementation of typed "write_only" method
The typed "lookup_or_add_for_write_only" function is meant to do the
same thing as the non-typed version of the function. Instead, it still
initialized values of new attribute arrays, which isn't meant to happen.

Missed in 4c91c24bc7.

I also had to correct one place that used the "write_only"
function but didn't intialize all values.
2022-09-21 13:10:03 -05:00
a82e52102b Mesh: Avoid uninitialized values when converting BMesh to Mesh
I didn't observe this issue in practice, but since the write_only
version of the attribute API isn't meant to initialize trivial types,
theoretically this could be a problem if the attribute is created
halfway through converting the BMesh to a Mesh.
2022-09-21 12:06:53 -05:00
c1f622e63e Cleanup: Miscellaneous cleanup in distribute points in volume node
- Fix unused variable warning
- Change whitespace
- Use standard variable names
- Use standard method to remove non-pointcloud components
2022-09-21 11:24:37 -05:00
a2966f6477 Fix race condition in memory freeing in edit mesh wrapper to mesh
The BM_mesh_bm_to_me_for_eval() cal be called on the same BMesh
from multiple threads. This adds a restriction that this function
should not modify the BMesh. This started to be violated quite
madly during the generic attributes changes.

This change makes it so that the BMesh is not modified.
The code looks less functional-like, but it solves the threading
conflict.

Ideally the BMesh will be const in the function but doing it now
is a bit tricky due to the other APIs.

The repro case for the crash is a bit tricky to reproduce from
scratch. For those who has access to the Heis production repo
/pro/lib/char/pack_bot/pack_bot.blend file can be used. Simply
add loop to "GEO-leg.R" object and use bevel operator on the
new loop.

There is still some write of the element indices happening in
this function. In theory those could be removed (together with
the dirty index tag clear) but it leads to obscure crashes in
area far away from this one. I've left it unchanged for now as
on 64bit platforms those assignments should not be causing real
issues.

Differential Revision: https://developer.blender.org/D16023
2022-09-21 17:36:42 +02:00
8bffadcdc4 Refactor: Simplify transfer of tags in the depsgraph builder
Base it in an existing building blocks rather than having dedicated
structure for it.

No functional changes is expected, just preparing to make the code
more reusable.
2022-09-21 16:48:48 +02:00
cd3a19f20c Fix inconsistent node name handling in dependency graph
The ID nodes will use the provided component name to maintain
the map-based storage, while the component node itself could
override the empty name with a type name.

This lead to situations when it is not possible to lookup
the operation from its owner parameters.
2022-09-21 16:48:48 +02:00
0ca9b637c5 Refactor: More const-correctness in node builder
Make it so find type of methods receive const pointers and do not
modify graph topology.

The latter was violated in the find_operation() which could have
created an empty component. This is not intended behavior.

No functional changes is expected.
2022-09-21 16:48:48 +02:00
f948ffaa9f Refactor: Move depsgraph node keys to own file
They are not specific to the relations builder and could be
used outside of it.
2022-09-21 16:48:48 +02:00
78b7a1c3a8 PyAPI: disable IMB color management methods for stand-alone mathutils
Allow building a standalone mathutils without including imbuf.
2022-09-21 23:53:38 +10:00
1b95784aad Fix compile error on (designated initializers in C++) 2022-09-21 14:36:55 +02:00
efa6525bf1 Cleanup: Move file browser history handing to own file
Was placed in filelist.cc, which didn't make much sense since they deal
with quite different things.
2022-09-21 14:32:08 +02:00
cd84d3f3da Refactor: Move file browser filelist.c to C++
I'm adding some asset APIs/types in C++ that the file-listing code would
use. I prefer porting this code to C++ over adding a C-API for the asset
code.

Includes some minor cleanups that shouldn't change behavior, like using
`MEM_new()`/`MEM_cnew()`, C++ style C-library includes,
`LISTBASE_FOREACH()`, removing unnecessary typedefs, etc.
2022-09-21 12:39:26 +02:00
Alaska
6adb481fb5 Add oneAPI to the 'cycles_device' command line argument help text
Differential Revision: https://developer.blender.org/D16027
2022-09-21 12:04:27 +02:00
78bfaf1a4f File Browser: Manual auto-increase name support for output filepaths
This functionality was present until Blender 2.80.  Basically it adds back the
"+" and "-" buttons in the file browser when it stores an output filepath.

This is useful for someone rendering multiple versions of an animation (or a
composition) to compare.

At the moment this is used for the render output, and the File Output node in
the compositor.

Differential Revision: https://developer.blender.org/D15968
2022-09-21 11:06:44 +02:00
15593299f3 Revert "Cleanup: Fix warning unused variable 'mode' when doing make lite"
Sorry, this was working before I rebased. I believe the warning was
fixed and the rebase still applied.

The commit as it was introduced building problems

This reverts commit ae21319d7f.
2022-09-21 11:05:35 +02:00
ae21319d7f Cleanup: Fix warning unused variable 'mode' when doing make lite 2022-09-21 10:57:11 +02:00
bc88f2006d Cleanup: remove vector adaptor data structure
This was used in early node based particle system development
but is not used anymore. The code also didn't match the standards
of other data structures in blenlib.
2022-09-21 10:39:07 +02:00
ea79dab062 Docs: add notes about wmWindow.eventstate & modifier key checks
There were undocumented limitations in the current modifier handling
that came to my attention while investigating related issues.
2022-09-21 16:46:41 +10:00
f97728248e Fix module search path for Python on initialization
Initializing the sys.path on startup attempted to add subdirectories
of {BLENDER_SYSTEM_SCRIPTS}:

- ./modules/modules
- ./modules/startup

As the directories aren't expected to exist there is no need to add them.

Also improved comments for path searching logic.
2022-09-21 12:01:49 +10:00
5517c848bd Cleanup: spelling in comments 2022-09-21 12:00:01 +10:00
e9bdf8ebc3 Cleanup: unused variable warning 2022-09-21 11:55:56 +10:00
6f15141f27 Fix T101188: Fluid modifier doesn't work
05952aa94d modified this area incorrectly, transforming
vertices outside of the mesh. That would have been fine, but the mesh
is used to retrieve the bounding box. Instead just avoid duplicating the
positions and normals completely, and avoid using referenced layers
just to be extra safe.
2022-09-20 18:38:20 -05:00
cbbed90486 Cleanup: Remove BKE_ prefix for local functions 2022-09-20 18:38:20 -05:00
7f284f5134 Fix T101138: remove console spam when hovering over toolbar in uv editor
Reviewers: Campbell Barton <ideasman42>, Ryan Inch <Imaginer>

Differential Revision: https://developer.blender.org/D16015
2022-09-21 09:44:59 +12:00
1df58ec540 Fix T101220: UV proportional editing not working correctly with UV Sync Selection
Regression introduced in rb2ba1cf4b40fc.

The `MLOOPUV_VERTSEL` flag only indicates UV selection without sync.
2022-09-20 17:29:44 -03:00
90999a0694 Fix T101208: Missing original index handling in extrude node
The extrude node must set the original indices for new faces to "None"
in edge mode as well. Same for new edges in vertex mode.
2022-09-20 14:36:20 -05:00
01ed08690a Fix: BMesh to Mesh conversion does not create all necessary layers
Even meshes without any faces must have MPoly and MLoop layers, etc.
This caused a crash in the extrude node when the edit mesh had no faces
(see T101208). Issue with f94130c94b.
2022-09-20 14:34:12 -05:00
9df0d20957 Cycles: don't allow negative BSDF weights
This doesn't work with path guiding, and likely other features.
2022-09-20 21:07:29 +02:00
ed6c8d82b8 Fix T101196: constraint plane failing in side orthographic views
Caused due to an inaccuracy when the values of `in` and `out` are too
close.

The solution is to project the value of `in` directly onto the plane.
2022-09-20 14:29:37 -03:00
1b4cf3af4b Cleanup: Improve consistency when nodes run without OpenVDB
Use a consistent order of expressions and formatting.
Also use consistent error message text.
2022-09-20 12:27:36 -05:00
Miguel Porces
01a4d38606 Fix: Group input and output always show in node add menu
In D10241, both NodeItems for NodeGroupInput and NodeGroupOutput in the
were moved from their categories into the 'node_group_items' generator.

As the NodeItem.poll() is called by the NodeCategory class and not by
the NodeItem class, the poll functions associated with those NodeItems
were never called. This should correct that.

Differential Revision: https://developer.blender.org/D16013
2022-09-20 12:07:59 -05:00
32b766223a Sculpt: Fix T100479: Boundary expand crash
Face sets were not being initialized.  I had also
forgotten to remove a dead struct member from
SculptBoundary which was being accessed.
2022-09-20 10:03:28 -07:00
bf14757709 Sculpt: Fix memory corruption with reading masks from PBVH_BMESH
Feeding -1 to BM_ELEM_CD_GET_VOID_P will not return NULL.
2022-09-20 10:03:27 -07:00
5c33704ffa GPencil: Add offset parameter to reproject operator Redo Panel
Now it's possible to set an offset in the surface reprojection.
Before, this was only possible while drawing, but not in the
reproject operator.

Differential Revision: https://developer.blender.org/D15610
2022-09-20 17:32:09 +02:00
afe91903af Cleanup: Strict compiler warning
Resolves -Wunneeded-internal-declaration warning generated by Clang.
2022-09-20 15:39:29 +02:00
RedMser
3132d2751e Animation: Fix operator properties for redo panel
After the redo panel is added to animation editors in D14960, many
operators have now been adjusted to appear and function correctly.

A full list of changes is tracked in T98195.

This patch only includes actual usability fixes. It does not do any
changes for the user's convenience, like adding other helpful properties
to operators. This can be done in a follow-up patch.

Reviewed By: sybren

Maniphest Tasks: T98195

Differential Revision: https://developer.blender.org/D14977
2022-09-20 14:57:00 +02:00
RedMser
1f828a5a06 Animation: Add redo panel to Dopesheet and NLA
Add the Redo panel to the dopesheet & NLA editors. This also implicitly
adds it to the timeline editor, since it's a kind of action editor
internally.

This feature is needed for changing advanced properties of animation
operators, such as select grouped (see D14811). But it can also be
useful for existing operators, like precise keyframe position tweaking.

Changes are basically the same as in D6286 (which added the redo panel
for Graph Editor).

Some operators have internal properties that should be hidden. A full
list can be found in T98195. These will be fixed in a follow-up patch.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D14960
2022-09-20 14:37:16 +02:00
9396437417 Move workspace.c to C++
Differential Revision: https://developer.blender.org/D16020
2022-09-20 13:22:55 +02:00
2b4cb893e7 Fix T101214: hidden link can cause cycle in node tree
Links that are linked to unavailable sockets should be ignored.
2022-09-20 13:21:16 +02:00
22efaa2e7b Fix T101201: Missing filter from outliner header
This was missing in Blender File & Orphan Data view.

Typo in rBb5fc8f611e39.

Maniphest Tasks: T101201

Differential Revision: https://developer.blender.org/D16016
2022-09-20 12:20:14 +02:00
5c81d3bd46 Geometry Nodes: improve evaluator with lazy threading
In large node setup the threading overhead was sometimes very significant.
That's especially true when most nodes do very little work.

This commit improves the scheduling by not using multi-threading in many
cases unless it's likely that it will be worth it. For more details see the comments
in `BLI_lazy_threading.hh`.

Differential Revision: https://developer.blender.org/D15976
2022-09-20 11:08:05 +02:00
7a239812ca Fix misleading operator name in the dope-sheet and action editor
The operator did not set the any extrapolation mode of the individual
keyframes, it sets it for the whole f-curve. Change the operator name to
reflect that.
2022-09-20 10:52:35 +02:00
c8a18fd239 Cleanup: add hint that typedef is used as compiler bug workaround
https://developercommunity.visualstudio.com/t/Alias-template-inside-fold-expression-fa/10040507
2022-09-20 10:42:25 +02:00
41935b9285 Cleanup: quite compiler warning
Warning: P3204.
2022-09-20 10:37:46 +02:00
22b69ed08f Fix T101001: crash setting texture node active in certain cases
Code from {rBb0cb0a785475} assumed a texture node `node->id` would
always be an image.
That is not true though:
 - could be an object (as reported here with the Point Density node)
 - could be a textblock (as in the IES Texture node)

Acting on these would crash when doing `BKE_image_signal` on them.

Now check node id is an image and do nothing otherwise.
Also check if an image is actually set in these nodes (if none is, the
Image Editor is now also untouched, previously the image in the Image
Editor was "cleared" here [set to NULL] -- which does not seems very
beneficial)

Maniphest Tasks: T101001

Differential Revision: https://developer.blender.org/D15943
2022-09-20 09:19:49 +02:00
e00f76c6a8 ViewLayer: fix missing sync in object APIs (fixes T101128, T101204)
Since D15885, most (all?) python based importers are failing with an
error like RuntimeError: Error: Object 'Cube' can't be selected
because it is not in View Layer, whenever they try to mark
just-created objects selected via obj.select_set(True). Happens at
least in FBX and (legacy) OBJ importers -- effectively they end up
creating just the first imported object before failing with this
exception.

Looks like BKE_view_layer_synced_ensure calls were missing before
BKE_view_layer_base_find in rna_object_api.c.

Reviewed By: Campbell Barton
Differential Revision: https://developer.blender.org/D16004
2022-09-20 09:45:27 +03:00
b950a8fb79 Painting: Don't calculate rake rotation when texture is not set.
Currently the rake rotation is calculated when the angle mode is set. Even when the texture isn't valid.
This change will only calculate the rake rotation when the texture is valid and the angle mode is set.
2022-09-20 08:28:35 +02:00
c279a0d931 GHOST/Wayland: refactor modifier handling on window activation
GHOST_SystemWayland::getModifierKeys() now returns the correct
modifier keys held instead of guessing that both left/right modifiers
were held.
2022-09-20 16:02:34 +10:00
09308c4b6a CMake: fail to build with unsupported versions of wayland-scanner
When WITH_GHOST_WAYLAND_DYNLOAD is enabled.
2022-09-20 12:53:06 +10:00
9c35f103c0 Cleanup: quiet warning 2022-09-20 12:53:05 +10:00
710b8b7929 GNUmakefile: fix error showing final message with the 'dash' shell
The bpy module check wasn't working with dash,
use posix compliant check for empty string.
2022-09-20 12:53:03 +10:00
3d5e0c8b9d Cleanup: Move mesh_mapping.c to C++ 2022-09-19 18:45:11 -05:00
a24fc6bbc1 UV: extend custom grid sizes to set each axis separately
For example, allows a custom UV grid size of 4 x 12.

TODO: Fix snapping with custom UV grid sizes.

Manifest Tasks: T78391

Differential Revision: https://developer.blender.org/D16000
2022-09-20 10:00:41 +12:00
7a67d69ca4 Cleanup: spelling 2022-09-20 09:20:55 +12:00
bdb5754147 Nodes: Add node group assets to search menus
Currently node group assets are supported, but using them by dragging
from the asset browser is cumbersome. This patch adds all node group
assets from user asset libraries and the current file libraries to the
add node search menu and the link drag search menu.

Node groups added through the search will have their "options" hidden,
meaning the data-block selector is displayed. This helps keep the UI
clean, and the selector shouldn't be necessary anyway.

To make that possible, metadata like the node tree type and its inputs
and outputs has to be saved in the file. This requires re-saving the
files that contain the assets with the patch applied.

The node add search operator is moved from Python to C++ to ease
development and allow more flexibility. It supports a tooltip that
gives the description of assets.

Currently the node groups are added with the asset system's existing
"Append & Reuse" behavior. It's likely that linking should be possible
in the future too, but for now the idea is to use the more foolproof
option that doesn't create dependencies between files.

Because loading assets can potentially take a long time, the search
menu refreshes its items as new assets are loaded. However, changing
the search field is necessary to see the update.

Differential Revision: https://developer.blender.org/D15568
2022-09-19 11:57:10 -05:00
862de9187f Cleanup: Move versioning_300.c to C++ 2022-09-19 11:06:21 -05:00
Iyad Ahmed
b6e26a410c Geometry Nodes: Distribute Points in Volume
This commit adds a node to distribute points inside of volume grids.
The "Random" mode usese OpenVDB's "point scatter" implementation, and
there is also a "Grid" mode for uniform distributions. Both methods
operate on all of the float grids in the volume, using every voxel with
a value higher than the threshold. The random method is not stable as
the input volume deforms.

Based on a patch by Angus Stanton (@abstanton), which was based on a
patch by Kenzie (@kenziemac130).

Differential Revision: https://developer.blender.org/D15375
2022-09-19 10:14:08 -05:00
0e6a8df6df GPencil: Make format
Missing in previous commit
2022-09-19 16:31:00 +02:00
5c13c7cd30 GPencil: Cut Extended lines in Fill tool when collide
Before, the lines could be extended endless, but this added too noise. 
Now, the lines are not extended more if collide.

Before:

{F13504186}

After:

{F13504187}

Reviewed By: mendio, frogstomp

Differential Revision: https://developer.blender.org/D15992
2022-09-19 16:03:53 +02:00
be863506b8 Cleanup: Improve comment for curve component legacy curves 2022-09-19 08:46:28 -05:00
2ce8b01c59 PyGPU: call 'GPU_shader_bind' in 'GPUShader.uniform_' methods
This simplifies python code.

When we call a method like shader.uniform_float("color", (1,1,1,1)),
we expect the shader's uniform to be updated regardless of whether the
shader is bound or not.

And `batch.draw()` already calls `GPU_shader_bind` inside.

Differential Revision: https://developer.blender.org/D15929
2022-09-19 09:40:20 -03:00
2fffd7d7a8 Move overlay engine to C++
This just makes the minimum changes to make the files compile.
2022-09-19 14:29:58 +02:00
327802b86f DNA: Remove unnecessary studio light & light probe struct paddings 2022-09-19 12:16:30 +02:00
2c407cfb8f GHOST/Wayland: correct flag for checking pressed keys
Check modifier keys using XKB_STATE_MODS_DEPRESSED which is used
to check if modifiers are physically held. In practice it's unlikely
this would have caused an error for key-maps in common use.
2022-09-19 16:29:29 +10:00
ea35c237fc Fix T101180: console HOME key doesn't work
Regression in [0], re-order the key-map so the home key
can be used for cursor motion.

[0]: 82fc52ffc8
2022-09-19 15:52:21 +10:00
6b8b2c8e7f Cleanup: use doxy sections 2022-09-19 14:52:27 +10:00
6424fbca94 Cleanup: spelling 2022-09-19 14:52:27 +10:00
4baa6e57bd Cleanup: prefer 'arg' over 'params' for sphinx documentation
While both are supported, 'arg' is in more common use so prefer it.
2022-09-19 14:24:31 +10:00
Wannes Malfait
8a9f6a2e0a Fix T101137: Crash with Transform Node
In `BKE_mesh_tag_coords_changed_uniformly` the checks for dirty vertex
and dirty poly normals were swapped around, causing an assert to be
triggered.

Differential Revision: https://developer.blender.org/D16002
2022-09-18 22:58:51 -05:00
a45b408422 Cleanup: Fix grammar in IndexRange header
Also make it more clear by avoiding repeating the name of the function.
2022-09-18 22:57:46 -05:00
ecf3435362 Curves: Remove CurveEval and old Spline types
`CurveEval` was added for the first iteration of geometry nodes curve
support. Since then, it has been replaced by the new `Curves` type
which is designed to be much faster for many curves and better
integrated with the rest of Blender. Now that all curve nodes have
been moved to use `Curves` (T95443), the type can be removed,
along with the corresponding geometry component.
2022-09-18 15:10:04 -05:00
7536abbe16 Curves: Port Curve to Points node to the new data-block
This is the last node to use the `CurveEval` type. Since the curve to
points node is basically the same as the resample node, now it just
reuses the resample code and moves the curve point `CustomData` to a
new point cloud at the end. I had to add support for sampling tangents
and normals to the resampling.

There is one behavior change: If the radius attribute doesn't exist,
the node won't set the radius to 1 for the output point cloud anymore.
Instead, the default radius for point clouds will be used.
That issue was similar to T99814.

Differential Revision: https://developer.blender.org/D16008
2022-09-18 14:56:24 -05:00
cf56b8be37 Fix T101166: crash when creating group input socket
The issue was that not all Group Input nodes were updated when
the node group interface changed.
2022-09-18 21:07:23 +02:00
53c92efd5a Fix: Prevent clipping of node drop shadow
Fix clipping artifacts of node drop shadows that could occur
on hidden nodes, when using higher UI scaling.

Reviewed By: Hans Goudey

Differential Revision: http://developer.blender.org/D16007
2022-09-18 20:39:14 +02:00
998ffcbf09 Fix: Make node position consistent when added through link drag search
The node position is specified in the coordinate space of the node
editor. The cursor position has to be divided by `UI_DPI_FAC` since it's
in view space but the offset is independent of any ui scaling.

Reviewed By: Hans Goudey

Differential Revision: http://developer.blender.org/D16006
2022-09-18 20:18:50 +02:00
fd1bc90679 Cycles: sync changes from standalone repository
* Windows build fixes
* Workaround for Hydra + OpenColorIO link issue
* Bump version
2022-09-18 17:34:23 +02:00
0ffd288fab Build: fix gtest build flags affecting actual library
Switch to target_ functions to avoid this.
2022-09-18 11:26:34 +02:00
6bf5cc62e0 Build: limit Py_ENABLE_SHARED to modules using Python headers
And remove Python flags from nodes, no longer needed.
2022-09-18 11:26:33 +02:00
892a5f8176 Build: disable gtests entirely for Python module
To avoid test failure on Windows.
2022-09-18 11:26:23 +02:00
Wannes Malfait
3ff15a9e23 Geometry Nodes: New Face Set Boundaries node
With the recent addition of the UV unwrapping node, there is a need to
be able to create seams easily. This node does that by outputting a
selection of the boundaries between different input face sets. In the
context of UV mapping, one inputs the "patches" you want, and the node
gives you the seams needed to make those patches.

Differential Revision: https://developer.blender.org/D15423
2022-09-17 22:18:52 -05:00
Mattias Fredriksson
ce54f48556 BLI: Add generic utlity for gathering values with indices
Add new functions to `array_utils` namespace called `gather(..)`.
Versions of `GVArray::materialize_compressed_to_uninitialized(..)` with
threading have been reimplemented locally in multiple geometry node
contexts. The purpose of this patch is therefore to:
 * Assemble these implementations in a single file.
 * Provide a naming convention that is easier to recognize.

Differential Revision: https://developer.blender.org/D15786
2022-09-17 22:12:02 -05:00
Mattias Fredriksson
095516403c Curves: Correct and improve Catmull Rom interpolation
Correct interpolation of integer POD types for Catmull Rom
interpolation as implemented in eaf416693d.

**Problem description**
`attribute_math::DefaultMixer<T>::mix_in()` assumes/asserts positive
weights but the basis function for Catmull-Rom splines generates
negative weights (see image in revision). Passing negative weights will
yield correct result as sum(weights) = 1 (after multiplication by 0.5)
but the assert is still triggered in debug builds. This patch adjusts
the behavior by extending the mix functions with mix4(). The benefit
of using mix#() over a DefaultMixer is that the result no longer needs
to be divided by the weight sum, instead utilizing that the basis weight
sum is constant (see plot).

**Changes**
 * Added mix4() and updated catmull_rom::interpolate() to use it.
 * Removed TODOs from catmull_rom functions.
 * Moved mix definitions to be ordered as 2, 3, 4 in the header.

**Implementation specifics**
`catmull_rom::interpolate()` uses a constexpr to differentiate between
POD types which multiplies the result with 0.5 after weighting the
values, this reduces the number of multiplications for 1D, 2D, 3D
vectors (https://godbolt.org/z/8M1z9Pxx6). While this could be
considered unnecessary, I didn't want to change the original behavior
as it could influence performance (did not measure performance here
as this should ensure the logic is ~identical for FP types).

Differential Revision: https://developer.blender.org/D15997
2022-09-17 21:53:58 -05:00
641bbc820f Curves: Don't allow resolutions less than 1
While this worked, the result for curves with a resolution of zero was
just a single evaluated point, which isn't useful or intuitive. Using
the attribute validation from 8934f00ac5, make sure users
can't set values 0 or less.
2022-09-17 21:12:25 -05:00
0bdb5239c1 LineArt: Force intersection option.
This option allows easier setup of intersection overrides on more
complex scene structures. Setting force intersection would allow objects
to always produce intersection lines even against no-intersection ones.

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

Differential Revision: https://developer.blender.org/D15978
2022-09-18 09:46:21 +08:00
4f284873d0 Fix: Crash after recent attributes commit
Fixes test failures from 8934f00ac5.
2022-09-17 20:27:50 -05:00
8c878ddd34 Fix OS-key events repeating on GHOST/Win32
Holding the OS (Windows) key on Win32 used key-repeat behavior.
While as far as I know it didn't cause user visible errors - sending
repeated modifier events isn't expected behavior and doesn't happen
on other platforms (or for other modifier keys).
2022-09-18 11:16:24 +10:00
0950e6fae6 GHOST: support left/right OS-key
Handling the OS key now match other modifiers in GHOST which detect
each key separately, making the behavior simpler to reason about since
mapping a single key to a modifier state is simpler, avoiding handling
that only applied to the OS-Key.

This means simulating key up/down events can use the correct modifier.

In the window-manager this is still only accessed accessed via KM_OSKEY.
2022-09-18 10:31:14 +10:00
8934f00ac5 Attributes: Validate some builtin attributes for untrusted inputs
We expect some builtin attributes to have positive values or values
within a certain range, but currently there some cases where users
can set attributes to arbitrary values: the store named attribute node,
and the output attributes of the geometry nodes modifier. The set
material index node also needs validation.

This patch adds an `AttributeValidator` to the attribute API, which
can be used to correct values from these untrusted inputs if necessary.
As an alternative to D15548, this approach makes it much easier to
understand when validation is being applied, without the need to add
arguments to every attribute API method or complicate the virtual
array system.

Currently validation is provided with a multi-function. That integrates
well with the field evaluations that set these values now, but it could
be wrapped to be friendlier to other areas of Blender in the future.

The Python API is not handled here either. Currently I would prefer to
wait until we can integrate the C++ and C attribute APIs better before
addressing that.

Fixes T100952

Differential Revision: https://developer.blender.org/D15990
2022-09-17 14:38:30 -05:00
6069cab442 Mikktspace: Fix triangle reordering predicate
This only affected meshes containing degenerate triangles.
2022-09-17 21:18:12 +02:00
114815816b Fix: lite build on windows
writefile.cc includes BLI_winstuff.h which
includes Windows.h which supplies definitions
of min/max that conflict with the c++ headers

previously windows.h was only included when TBB was
enabled, the inclusion of BLI_winstuff.h now
makes this define mandatory for all configurations
2022-09-17 09:36:14 -06:00
44272fdd23 WM: send a modifier press when activating a window with modifier held
Previously the a simulated event was sent for releasing modifiers
on activation but pressing only set the eventstate flag.

Prefer the simulated events since press/release events are used in some
modal key-maps.
2022-09-18 00:39:13 +10:00
d74c16ba81 WM: refactor modifier hold/release logic when activating a window
Initial support for matching left/right modifier keys for simulated
events - no functional changes.
2022-09-18 00:39:13 +10:00
57e4b6aefb PyDoc: correct parameter doc-strings & exception message 2022-09-18 00:39:13 +10:00
f8a3ec48e4 Fix T100330: Remove Render Slot not working for first slot
This bug was caused by the weird ownership logic for render results.
Basically, the most recent render result is owned by the Render, while
all others are owned by the RenderSlots.
When a new render is started, the previous Render is handed over to its
slot, and the new slot is cleared. So far, so good.

However, when a slot is removed and happens to be the one with the most
recent render, this causes a complication.
The code handles this by making another slot the most recent one, along
with moving its result back to the Render, as if that had always been
the most recent one.

That works, unless there is no most recent render because you haven't
rendered anything yet. Unfortunately, there is no way to store "there
hasn't been a render yet", so the code still tries to perform this
handover but can't.
Previously, the code handled that case by just refusing to delete the
slot. However, this blocks users from deleting this slot.

But of course, if there hasn't been a render yet, the slots will not
contain anything yet, so this entire maneuver is pointless.
Therefore, the fix for the bug is to just skip it altogether if there
is no Render instead of failing the operation.

Technically, there is a weird corner case remaining, because Renders
are per-scene. Therefore, if a user renders images in one scene,
switches to a different scene, deletes a slot there and then switches
back, in some situations the result in the deleted slot might end up
in the next slot.
Unfortunately this is just a limitation of the weird split ownership
logic and can't just be worked around. The proper fix for this
probably would be to hand over ownership of the result from the Render
to the RenderSlot once the render is done, but this is quite complex.

Also fixes a crash when iuser->scene is NULL.
2022-09-17 16:21:44 +02:00
bdbf24772a GPencil: Remove Leak Size
This value was used to close gaps, but now with the new system is not needed.

Internally, still we need to keep a small leak size, but after doing a lot of test a 
value of 3 is perfect, so it's harcoded.
2022-09-17 12:30:13 +02:00
742268c50b GPencil: Move Gap Closure option to separated subpanel
Also removed leak size
2022-09-17 12:30:13 +02:00
0621d162f0 GPencil: Change prop text to Closure Mode 2022-09-17 12:30:13 +02:00
dd0ef74887 GPencil: Hide the help Circles for gaps when gap is closed
To avoid too much noise, the help circles are only visible if the
the gap is still open. When the gap is closed, the circles are hidden.

Hiding the circles makes it easier to focus on what is problematic.
instead, to see many circles that are already resolved.
2022-09-17 12:30:13 +02:00
172b0ebe6a GPencil: Rename Fill closure methods
The new names are:

* Radius
* Extend

The mode Radius + Extend has been removed.

Also, some code cleanup and format.
2022-09-17 12:30:13 +02:00
Dave Pagurek
468f2ccc0e GPencil: Add more types of stroke extensions when filling
The motivation for this change: while working on an animation recently, I found that there are some gaps that won't close easily via stroke extension or leak size checking. In D14698, I attempted to address this by changing the algorithm of the raster-space flood fill. This patch attempts to address the same issue in vector space by adding two new cases where stroke extensions are added, as suggested by @frogstomp:

  # **Points of high curvature:** when the curvature at a point is high enough that it's hard to visually distinguish between it and an endpoint, add a stroke extension out along the normal (pointing in the opposite direction of the stroke's acceleration.) This addresses cases where technically the endpoint points up, but there's a sharp corner right below it that should extend to connect.

  # **Stroke endpoints within a radius**: when two endpoints are close together, regardless of the angle they make, connect them if they are within a radius. This addresses cases like where the two endpoints have effectively parallel tangents, so extensions won't close the gap.

Reviewed By: antoniov, mendio, frogstomp

Differential Revision: https://developer.blender.org/D14809
2022-09-17 12:30:13 +02:00
a4027658ee IndexRange: Add new intersect method
Returns a new range, that contains the intersection of the current one
with the given range.

This is helpful to select a portion of a range without having to deal with
all the asserts of other functions. The resulting range being always a
valid subrange, it can be used to iterate or copy a part of a vector.
2022-09-17 12:27:00 +02:00
9dcce5be90 DRW: Debug: Fix row / column counters not being reset on init
This fixes the issues with CPU debug print not being in the right order.
2022-09-17 12:27:00 +02:00
a1aafddcbe DRW: GPU wrapper: Add new StorageVectorBuffer
Same as `StorageArrayBuffer` but has a length counter and act like a
`blender::Vector` you can clear and append to.
2022-09-17 12:27:00 +02:00
7549e0c5ae Geometry Nodes: use stringref instead of string in logger
This reduces logging overhead. The performance difference is only
significant when there are many fast nodes. In my test file with many
math nodes, the performance improved from 720ms to 630ms.
2022-09-17 12:08:57 +02:00
1810b1e4c8 GL: Framebuffer: Add support for empty framebuffer (no attachments)
This allows to reduce the memory footprint of very large framebuffers if
there is no need for any attachment.
2022-09-17 10:17:47 +02:00
b37954d03c Cleanup: format 2022-09-17 15:12:56 +10:00
34a6952067 Cleanup: compiler warnings 2022-09-17 15:12:42 +10:00
d9930d5fd0 Cleanup: spelling, punctuation & repeated words in comments 2022-09-17 15:08:40 +10:00
5f6f2e106c Cleanup: Use dedicated function to offset VSE strip handles 2022-09-17 05:23:34 +02:00
d4a763d363 Fix T101098: Moving meta strip can change its length
Caused by clamping handle translation to strip bounds in functions
`SEQ_time_*_handle_frame_set()` to prevent strip ending in invalid
state. Issue happens when meta strip is moved so quickly, such that
immediate offset is greater than strip length.

Currently meta strip bounds are updated when any contained strip changes
its position, but this update always preserves meta strip position.
Transforming meta strip is not possible directly and all contained
strips are moved instead. Therefore this is 2-step process and fix needs
to be applied on update function and on translation function.

Inline offset handling without clamping in function
`SEQ_time_update_meta_strip_range()`.
Add new function `seq_time_translate_handles()` to move both handles at
once in `SEQ_transform_translate_sequence()`.
2022-09-17 04:21:56 +02:00
e108d67635 Sculpt: add .sculpt to allow_procedural_attribute_access
Also cleaned up a comment.
2022-09-16 13:05:04 -07:00
9c35a5a524 Sculpt: Improve performance when initializing face sets
Avoid conversion to `BMesh` for basic topology operations and data access.
Instead use a mesh map to retrieve the faces connected to each edge.
I observed performance improvements of 5x (600ms to 100ms) to 10x
(15s to 1s), with bigger changes for large meshes with more data layers
Switching to `std::queue` over Blender's `GSQueue` gave another
25% improvement.

Differential Revision: https://developer.blender.org/D15988
2022-09-16 14:31:30 -05:00
8fdaf2bddc Fix: Missing updates for multires sculpting
Caused by ee23f0f3fb, which removed the update tag when entering
sculpt mode, and by b5f7af31d6, which made these layers lazily
created, so they weren't always available at the start of a stroke. Now
update the evaluated mesh/multires CCG as necessary. Some updates
could potentially avoided when switching modes in the future, but for
now do it all the time.

Fixes T101116
Also fixes a crash when painting multires mask for the first time
2022-09-16 14:31:30 -05:00
02575bcbd0 Sculpt: New attribute API
New unified attribute API for sculpt code.

= Basic Design =

The sculpt attribute API can create temporary or permanent attributes (only supported in `PBVH_FACES` mode).  Attributes are created via `BKE_sculpt_attribute_ensure.`

Attributes can be explicit CustomData attributes or simple array-based pseudo-attributes (this is useful for PBVH_GRIDS and PBVH_BMESH).

== `SculptAttributePointers` ==

There is a structure in `SculptSession` for convenience attribute pointers, `ss->attrs`.  Standard attributes should assign these; the attribute API will automatically clear them when the associated attributes are released.  For example, the automasking code stores its factor attribute layer in `ss->attrs.automasking_factor`.

== Naming ==

Temporary attributes should use the SCULPT_ATTRIBUTE_NAME macro for naming, it takes an entry in `SculptAttributePointers` and builds a layer name.

== `SculptAttribute` ==

Attributes are referenced by a special `SculptAttribute` structure, which holds
all the info needed to look up elements of an attribute at run time.

All of these structures live in a preallocated flat array in `SculptSession`, `ss->temp_attributes`.  This is extremely important.  Since any change to the `CustomData` layout can in principle invalidate every extant `SculptAttribute`, having them all in one block of memory whose location doesn't change allows us to update them transparently.

This makes for much simpler code and eliminates bugs.  To see why this is tricky to get right, imagine we want to create three attributes in PBVH_BMESH mode and we provide our own `SculptAttribute` structs for the API to fill in.  Each new layer will invalidate the `CustomData` block offsets in the prior one, leading to memory corruption.

Reviewed by: Brecht Van Lommel
Differential Revision: https://developer.blender.org/D15496
Ref D15496
2022-09-16 12:20:28 -07:00
4cea4f4c5f Fix: Geometry nodes crash with undefined node
The new evaluator crashes for multi-input sockets coming from undefined
nodes. The multi-input socket lazy node tries to retrieve the default
value since the undefined node never created output values. But there
is no default value stored because the socket is linked.

Differential Revision: https://developer.blender.org/D15980
2022-09-16 12:54:46 -05:00
3d93525069 Cleanup: Remove unused member variable in lazy function graph 2022-09-16 12:53:18 -05:00
9ca1abe042 Fix T101100: missing smooth shading with linked subdivision surface in editmode
Smooth flag should come from the evaluated mesh, only selection and hidding
state should be mapped to the original bmesh.

Pre-existing issue revealed by refactor in b247588dc0.
2022-09-16 16:50:43 +02:00
4d67a995d9 Fix: crash when evaluating geometry nodes after deleting an unlinked node
This was essentially a use-after-free issue. When a geometry nodes
group changes it has to be preprocessed again before it can be evaluated.
This part was working, the issue was that parent node groups have to be
preprocessed as well, which was missing. The lazy-function graph cached
on the parent node group was still referencing data that was freed when
the child group changed.

Now the depsgraph makes sure that all relevant geometry node groups are
preprocessed again after a change.

This issue was found by Simon Thommes.
2022-09-16 16:03:50 +02:00
7042f4e4b2 Fix Linux bpy wheel failing to install due to wrong ABI flags 2022-09-16 15:53:37 +02:00
c8b9ede4b1 Sculpt: Move sculpt_face_set.c to C++ 2022-09-16 08:17:54 -05:00
Lukas Stockner
44aaa9893b Eevee: Add support for Nishita sky texture
Sun Disc is currently not supported because it'll need special handling - on the one hand, I'm not sure if Eevee would handle a 1e6 coming out of a background shader without issues, and on the other hand it won't actually cast sharp shadows anyways.
I guess we'd want to internally add a sun to the lamps if Sun Disc is enabled, but getting that right is tricky since the user could e.g. swap RGB channels in the node tree and the lamp wouldn't match that.
Anyways, that can be handled later, the sky itself is already a start.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D13522
2022-09-16 15:10:09 +02:00
2eb19eeb19 Fix 101000: color picker colors drift above 1 for some OCIO configurations
Increase threshold to avoid float precision issues.
2022-09-16 15:00:39 +02:00
bf05b998b6 Revert "EEVEE: Fix volumetric resolve in large scenes."
This reverts commit 34051fcc12.
Although for normal use this doesn't make a difference. But when working with
huge scenes and volumetrics + NVIDIA it made a work-around not possible anymore.

For the heist production we added a fix on the render-farm (enable GPU workarounds).
{rB34051fcc12f388375697dcfc6da53e9909058fe1} made another work-around not
accessible anymore and it and was requested to revert this change.
2022-09-16 14:55:04 +02:00
Germano Cavalcante
4b326d5a78 Fix T101040: Blender Crashes When snap roll a bone in armature
The modes that don't support individual projection shouldn't support
FACE_NEAREST either.

Differential Revision: https://developer.blender.org/D15970
2022-09-16 09:05:33 -03:00
13c4af66fc Cleanup: format 2022-09-16 18:14:33 +10:00
95f05a6a4b Cleanup: spelling in comments 2022-09-16 18:14:33 +10:00
48d7ff68f0 Make File Select dialog update operator's file & path properties
When an operator is attached to a file select dialog, the update
callback function for the operator's directory, filename and filepath
properties will be called as the user navigates through the dialog.

This will allow add-on authors to make more interactive import
operators.

Differential Revision: https://developer.blender.org/D15543
2022-09-16 00:27:59 -07:00
8bf0714d50 make_source_archive: exclude hidden git files 2022-09-16 15:34:53 +10:00
ac76da2944 Revert "UI: Use full word for face set operator name, tweak description"
This reverts commit 15d85c54c3.
Included a separate change/new file by mistake. Sorry for the noise.
2022-09-15 23:06:04 -05:00
15d85c54c3 UI: Use full word for face set operator name, tweak description
"Init" shouldn't be used in the UI, and avoid repeating the operator
name in its description.
2022-09-15 23:04:55 -05:00
a231637fae Sculpt: Respect hiding when creating face sets from loose parts
Different areas of the mesh can be "loose parts" visually when separated
by hidden areas. This is consistent with other areas of sculpt mode that
also treat hidden areas differently.
2022-09-15 22:54:51 -05:00
72253f427d Docs: Update sphinx 2022-09-15 22:30:47 -04:00
d255c8e9f7 Cleanup: format 2022-09-16 11:53:40 +10:00
a8eeec7b35 Cleanup: typos in 427d669f62 2022-09-16 11:39:48 +10:00
427d669f62 make_bpy_wheel: various minor improvements
- Add doc-string with example usage shown in the --help message.
- Add help text for command line arguments.
- Only search for the CMakeCache.txt file when the `--build-dir`
  is omitted.
- Write fatal errors to the stderr.
2022-09-16 11:27:13 +10:00
8342564796 Cleanup: suppress type warnings for make_bpy_wheel & make_utils
'make check_mypy' now runs without warnings.
2022-09-16 10:52:20 +10:00
d5df23d758 Cleanup: Rename attribute required functions
Avoid "customdata" in the name, since that's an implementation detail
in this context.
2022-09-15 13:14:31 -05:00
0945ae338b Fix: Merging mesh and non-empty BMesh creates "flag" attributes
We need to use the custom data copy function that skips mesh-only
attributes like the hide status attributes, the generic material index
attribute, etc. Otherwise the BMesh has those attributes which
conflict with their builtin counterparts.
2022-09-15 12:52:18 -05:00
8b26349d57 BLO: move blenloader to C++
Differential Revision: https://developer.blender.org/D15965
2022-09-15 19:13:13 +02:00
Brecht Van Lommel
9f76d0c8e6 Python: script for packing bpy module as wheel
The buildbot will call this script to create a binary .whl file that can be
easily installed through pip.

This wheel will only work with the same Python version used for Blender.
Other minimum system requirements are the same as regular Blender builds.

Includes contributions by Campbell Barton.

Differential Revision: https://developer.blender.org/D15957
2022-09-15 18:27:03 +02:00
f70fac6382 Python: fix failing bpy build with full release config on Windows
* Fix issue with different build and install paths.
* Fix issue with oneAPI kernel build.

Ref D15957
2022-09-15 18:27:02 +02:00
5228b0b74f Python: fix failing tests when building bpy module
* Use Python executable from lib folder since it's not installed.
* Make bpy module test work for portable install.
* Disable gtests which don't work with different Python link flags
  and shared library locations.

Ref D15957
2022-09-15 18:27:01 +02:00
335a6c0c87 Cleanup: move Blender version parsing to make_utils.py
Ref D15957
2022-09-15 18:27:00 +02:00
5b216aae8b Fix T101065: wrong denoising depth after ray precision improvements 2022-09-15 16:04:24 +02:00
fbc74c9d93 Fix warning-as-errors in older GCC's, take 2.
rBf4e6616b835e did not work for `some reason`, this one has been
verified with gcc 10!
2022-09-15 15:58:21 +02:00
f4e6616b83 Fix warning-as-errors in older GCC's.
Recent compilers (at least gcc 11 and 12) do not report any issue, but
gcc 10 does.
2022-09-15 15:46:47 +02:00
c41249d436 PointCloud: add BKE_pointcloud_nomain_to_pointcloud
This adds a utility function to copy the data from a PointCloud
outside of the main database to one that is in the database. This
is similar to `BKE_mesh_nomain_to_mesh`.

Ref D11592
2022-09-15 15:21:25 +02:00
Damien Picard
a869fcd686 I18n: disambiguate and extract a few messages
Disambiguate:
- Lower / Upper (case)
- Spray (ocean modifier)
- Keep Original (clip, grease pencil, object)
- Screen [space] (inside some enum items, mostly)
- Cast Shadow ("shadow that is cast", not "to cast a shadow")

Extract:
- Line Art Light Reference Near and Far
- Mesh vertex attribute domain: Vertex

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15938
2022-09-15 11:38:45 +02:00
903709c4eb GPencil: Add frame number to Trace operator
The default trace can only trace an image or a sequence, but
it was not possible to trace only selected frames in a sequence. 
This new parameter allows to define what frame trace.

If the value is 0, the trace is done as before.

The parameter is not exposed in the UI because this is logic
if it is managed by a python API, but it has no sense in the UI.

This feature was included after receiving feedback from Studios
which need to trace videos only for some frames using custom
python scripts.
2022-09-15 11:19:30 +02:00
Nate Rupsis
2310daed3a NLA: draw track bg based on strip's extrapolation type
In the NLA, draw the track background based on the strip's extrapolation
setting. Previously, this had no visual indicator; "Hold", "Hold
Forward", and "Nothing"  were visually indistinguishable. Now "Nothing"
actually shows nothing, "Hold Forward" shows a dimly colored background
from the strip to its right, and "Hold" shows that in both directions.

Reviewed By: RiggingDojo, sybren

Maniphest Tasks: T97572

Differential Revision: https://developer.blender.org/D14836
2022-09-15 10:47:02 +02:00
3eae1bfe35 Cleanup: quiet sign-conversion warning in OFFSETOF_STRUCT_AFTER
BLI_strict_flags.h raised a build error when this macro was used.
2022-09-15 18:02:53 +10:00
5c4295ee6f Workaround for msvc compiler bug
This is the same issue as in rB2e8089b6bf50.
2022-09-15 09:34:20 +02:00
5d69958442 Correct over allocation in 0e172e9732 2022-09-15 17:10:39 +10:00
718d545ff8 Cleanup: minor improvement to boundary check
Use a byte flag instead of counting polys using edges
(technically a fix for edges with USHRT_MAX+2 users).
2022-09-15 16:57:14 +10:00
0e172e9732 Fix T95649: Corrective Smooth can cause vertices to jump
Calculate a tangent per loop, apply the transformation in multiple
spaces and accumulate the result weighting by the loop-angle.

Note that previously only the tangents Z axis (normal)
was properly accumulated, the X and Y axes only contained the values
from a single loop (the last one written to), meaning only two edges
contributed to the result. Now the transformation from all loops are
taken into account.

In practice the difference between both methods is minimal,
only for more extreme bending it can be noticed which is often when the
previous method didn't work as well.
2022-09-15 16:17:17 +10:00
2c53970bbf Cleanup: use doxy sections, remove outdated comment 2022-09-15 15:27:21 +10:00
27e17fed28 PyDoc: hide overly long titles from the side-bar
The side-bar included both title and description for documentation
pages including quickstart, tips & tricks .. etc.

Titles often wrapped and took up a lot of vertical space in the side-bar.

Now these pages are linked on the main page, with the side-bar
used for top-level Python modules.
2022-09-15 14:34:23 +10:00
4bbb043bc5 Cleanup: spelling in comments, comment blocks 2022-09-15 10:03:46 +10:00
5cd08e373b CMake: exclude '.github' from addons in the install target
This file is only used for the github mirror
and doesn't need to be installed.
2022-09-15 09:48:32 +10:00
f404dd0b3c Fix Unreported: VSE and NLA handle position text is not drawn
When moving strip, or it's handle, text with frame number near handle
should be drawn. This feature was broken by 8d53ead69b, because
function `UI_view2d_text_cache_add` sets all fields of `v2s->rect` to 0.
This case was checked in function `UI_view2d_text_cache_draw`, but it
was not quite obvious.

This commit reverts 8d53ead69b, makes condition for 0 size rectangle
more obvious and adds comment for clarity.

function `UI_view2d_text_cache_add` is only used in NLA and VSE, and
this new condition fits existing use-cases. Status of T97500 is not
affected by this change.
2022-09-15 01:12:16 +02:00
b5115ed80f UV: rename "Pixel Snap Mode" to "Pixel Round Mode"
Maniphest Tasks: T78391

Differential Revision: https://developer.blender.org/D15952
2022-09-15 10:36:13 +12:00
530f203e27 Fix: Build error after previous cleanup commit
The prototype didn't match the definition anymore.
2022-09-14 15:12:15 -05:00
42fe0b6dfc Attributes: add color_srgb property to FloatColorAttributeValue and ByteColorAttributeValue
This patch adds color_srgb property to FloatColorAttributeValue and
ByteColorAttributeValue, so Python code can do
`layer.data.foreach_get("color_srgb", ...)` to fetch the data
efficiently, if it needs it in sRGB color space.

Reviewed By: Bastien Montagne
Differential Revision: https://developer.blender.org/D15966
2022-09-14 22:51:00 +03:00
6d4d74172b Cleanup: Remove unused argument from modifier data mask callback
This isn't likely to be helpful in the future with the move to generic
attributes
2022-09-14 14:49:40 -05:00
e22198b8d1 Cleanup: Make format 2022-09-14 14:45:36 -05:00
ee23f0f3fb Sculpt: Separate hide status from face sets, use generic attribute
Whether faces are hidden and face sets are orthogonal concepts, but
currently sculpt mode stores them together in the face set array.
This means that if anything is hidden, there must be face sets,
and if there are face sets, we have to keep track of what is hidden.
In other words, it adds a bunch of redundant work and state tracking.

On the user level it's nice that face sets and hiding are consistent,
but we don't need to store them together to accomplish that.

This commit uses the `".hide_poly"` attribute from rB2480b55f216c to
read and change hiding in sculpt mode. Face sets don't need to be
negative anymore, and a bunch of "face set <-> hide status" conversion
can be removed. Plus some other benefits:
 - We don't need to allocate either array quite as much.
 - The hide status can be read from 1/4 the memory as face sets.
 - Updates when entering or exiting sculpt mode can be removed.
 - More opportunities for early-outs when nothing is hidden.
 - Separating concerns makes sculpt code more obvious.
 - It will be easier to convert face sets into a generic int attribute.

 Differential Revision: https://developer.blender.org/D15950
2022-09-14 14:37:18 -05:00
Monique Dewanchand
68589a31eb ViewLayer: Lazy sync of scene data.
When a change happens which invalidates view layers the syncing will be postponed until the first usage.
This will improve importing or adding many objects in a single operation/script.

`BKE_view_layer_need_resync_tag` is used to tag the view layer to be out of sync. Before accessing
`BKE_view_layer_active_base_get`, `BKE_view_layer_active_object_get`, `BKE_view_layer_active_collection`
or `BKE_view_layer_object_bases` the caller should call `BKE_view_layer_synced_ensure`.

Having two functions ensures that partial syncing could be added as smaller patches in the future. Tagging a
view layer out of sync could be replaced with a partial sync. Eventually the number of full resyncs could be
reduced. After all tagging has been replaced with partial syncs the ensure_sync could be phased out.

This patch has been added to discuss the details and consequences of the current approach. For clarity
the call to BKE_view_layer_ensure_sync is placed close to the getters.
In the future this could be placed in more strategical places to reduce the number of calls or improve
performance. Finding those strategical places isn't that clear. When multiple operations are grouped
in a single script you might want to always check for resync.

Some areas found that can be improved. This list isn't complete.
These areas aren't addressed by this patch as these changes would be hard to detect to the reviewer.
The idea is to add changes to these areas as a separate patch. It might be that the initial commit would reduce
performance compared to master, but will be fixed by the additional patches.

**Object duplication**
During object duplication the syncing is temporarily disabled. With this patch this isn't useful as when disabled
the view_layer is accessed to locate bases. This can be improved by first locating the source bases, then duplicate
and sync and locate the new bases. Will be solved in a separate patch for clarity reasons ({D15886}).

**Object add**
`BKE_object_add` not only adds a new object, but also selects and activates the new base. This requires the
view_layer to be resynced. Some callers reverse the selection and activation (See `get_new_constraint_target`).
We should make the selection and activation optional. This would make it possible to add multiple objects
without having to resync per object.

**Postpone Activate Base**
Setting the basact is done in many locations. They follow a rule as after an action find the base and set
the basact. Finding the base could require a resync. The idea is to store in the view_layer the object which
base will be set in the basact during the next sync, reducing the times resyncing needs to happen.

Reviewed By: mont29

Maniphest Tasks: T73411

Differential Revision: https://developer.blender.org/D15885
2022-09-14 21:34:38 +02:00
Monique Dewanchand
23276bcc37 Adding const Scene* parameter in many areas.
Related to {D15885} that requires scene parameter
to be added in many places. To speed up the review process
the adding of the scene parameter was added in a separate
patch.

Reviewed By: mont29

Maniphest Tasks: T73411

Differential Revision: https://developer.blender.org/D15930
2022-09-14 21:30:56 +02:00
1a48548980 BLF: Incorrect Define Used
Replace incorrect usage of GLYPH_ASCII_TABLE_SIZE with correct
KERNING_CACHE_TABLE_SIZE

See D15815 for more details.

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

Own Code.
2022-09-14 09:57:54 -07:00
5f4db28c24 Fix T100899: Drag and Drop failing depending on window position
Regression introduced in rBbbf87c4f7509, which now relies on OS coordinates for Drag and Drop.

These coordinates did not match on different OSs.
2022-09-14 13:54:51 -03:00
818c9e524d Fix: Mesh SoA format conversion skips versioning
Converting to the SoA format (T95965) immediately when reading meshes
means that none of the changes from versioning would be applied first.
This means important fixes like f14995aba7 aren't properly applied,
so modifications could be done to invalid CustomData. To fix this, move
the SoA changes into versioning code, in a new versioning_400.cc file.

Differential Revision: https://developer.blender.org/D15919
2022-09-14 11:33:35 -05:00
460fe4a10c Curves: Improve sculpting performance by reducing allocations
The snake hook and grow/shrink brushes need some arrays for input
to the length paramterization code. These were allocated and freed
for every curve. Instead, use a local buffer for each task execution.

Differential Revision: https://developer.blender.org/D15964
2022-09-14 11:18:20 -05:00
390320a151 Mesh: Fix quadratic cost for accessing normals with RNA
Same as eb3a561a7f, but for the mesh normal arrays
introduced in b7fe27314b.
2022-09-14 11:12:27 -05:00
eb3a561a7f Curves/PointCloud: Avoid quadratic cost for retrieving positions
A "lookup_int" callback needs to be provided for RNA collections
that aren't backed by DNA directly. Otherwise they will iterate from
the start of the array for every access.
2022-09-14 10:55:18 -05:00
21ed3b3258 Fix T101025: Cycles motion blur crash with changing point cloud size
Caused by 410a6efb74 which didn't properly use the
smallest size between the Cycles and Blender point clouds.
2022-09-14 09:51:27 -05:00
643e94c032 Cleanup: Add missing licence headers
Missed in eaf416693d
2022-09-14 08:54:04 -05:00
56fb2a5ed0 Cleanup: use proper bool variables in Main, instead of char. 2022-09-14 15:48:49 +02:00
Myron Carey
22bf5ba4d1 Fix T49814: Collada Import Ignores Vertex Normals
We now import and apply custom normals using a similar strategy
to the STL importer. We store custom normal data for each loop
as we read each MPoly and then apply it to the mesh after
`BKE_mesh_calc_edges()` is called.

The new behavior is optional and may be disabled in the Collada import
UI. When disabled, we use the old behavior of only using normals
to determine whether or not to smooth shade an MPoly.

----

Patch as requested in {T49814}.

The Collada import UI now has an additional checkbox, similar to the glTF and FBX import UIs:

{F13428264}

Here is a test Collada file with a simple test cube with flipped custom normals:

{F13428260}

{F13428282}

And a sphere where the two halves are disconnected geometry, but has custom normals that make the halves appear to be connected:

{F13436363}

{F13436368}

I've tested it on a number of my own meshes, and the custom normals appear to be imported
correctly. I'm not too sure about how I've plumbed the option down, though, or whether this
is the most proper way to apply custom normals.

Reviewed By: gaiaclary

Differential Revision: https://developer.blender.org/D15804
2022-09-14 15:26:11 +02:00
Joseph Micheli
8aca0da952 Fix T100684: Correct descriptions in Python API
The descriptions for view_layer_eval and scene_eval incorrectly duplicate the descriptions for view_layer and scene:

  - https://docs.blender.org/api/current/bpy.types.Depsgraph.html?highlight=depsgraph#bpy.types.Depsgraph.view_layer_eval
  - https://docs.blender.org/api/current/bpy.types.Depsgraph.html?highlight=depsgraph#bpy.types.Depsgraph.scene_eval

This patch fixes this by changing "Original" to "Evaluated."

Reviewed By: jbakker

Maniphest Tasks: T100684

Differential Revision: https://developer.blender.org/D15931
2022-09-14 15:20:53 +02:00
Germano Cavalcante
4e4daa6417 Fix T100959: Memory leak when moving node with Alt
The memory leak happens because `ED_node_link_insert` (called after the
transform operation) overwrites the pre-existing `snode->runtime->iofsd`,
losing the reference without freeing the memory.

So to "move" the reference from `snode->runtime->iofsd` to
`op->customdata`, so that each operator works with its own data.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D15948
2022-09-14 09:13:12 -03:00
10a3bfa5ee Cleanup: quiet warnings 2022-09-14 12:07:40 +02:00
a9250cb1f1 Cleanup: remove unused fields + add override 2022-09-14 12:02:27 +02:00
e4b925b9e2 Added missing license headers. 2022-09-14 11:49:48 +02:00
38a77c1400 Fix T100977: Wrong native Ukrainian language name in UI. 2022-09-14 11:37:59 +02:00
Erik Abrahamsson
609171d8b7 Optimization: Exit early when resizing material slots.
When assigning a huge number of materials, like when importing thousands of
objects, the function `BKE_objects_materials_test_all` uses quite a lot of
resources because of the way it loops through all objects to resize the
mat-array.

By counting the amount of processed objects and comparing to the number
of users of the obdata ID, we can exit early and avoid looping through
all objects every time.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15740
2022-09-14 11:00:37 +02:00
39c341bf4a Cleanup: remove redundant braces from assert & raise
autopep8 v1.7 added a space after assert & raise,
remove the braces as they aren't needed.
2022-09-14 16:18:59 +10:00
260b75a952 PyDoc: add an "Advanced" section to document WITH_PYTHON_MODULE
Document the use cases, usage and limitations
of using Blender as a Python module.
2022-09-14 15:17:51 +10:00
d26220d97a Fix reports printing twice when called from Python in background-mode
Calling operators in background-mode always printed with the
assumption that output should never be hidden.
However operators called from `bpy.ops` were also printing reports to
the `stdout` (needed for the Python console and generally useful).

Resolve by adding a flag to signal that the owner of the ReportList
is responsible for printing to the `stdout`.
2022-09-14 14:06:44 +10:00
7bd60d40ef CMake: warn when "bpy" installs into the site-packages from LIBDIR
Using "../lib" as a target is unlikely to be useful,
add a warning & suggest alternatives.
2022-09-14 14:06:41 +10:00
f74fa63b5a Cleanup: skip argument freeing when built as a Python module 2022-09-14 14:06:39 +10:00
Charlie Jolly
e1a9c16176 UI: Add Mix Node to color section of add node menu
This adds back the new mix node to the Color sections
of the add node menu.

The add menu now contains two entries for the mix node.

One under Utilites/Converter which defaults for float.

One under Color which defaults to color with `Mix Color` label.

This was moved as part of D13749.

The issue was reported on BlenderArtists.

Differential Revision: https://developer.blender.org/D15887
2022-09-13 23:06:40 +01:00
7518d30f2a Fix T100771: Incorrect strip length when timecodes are used
Some files have 2 different framerates stored in metadata. Use function
`av_guess_frame_rate` to get media FPS, because it provides more
consistent / correct values across multiple files.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D15839
2022-09-13 20:29:12 +02:00
3302b7e6a3 Fix T100998: Speed effect not rendering scene strip subframes
After change in 19bff8eb51, subframe must be calculated for function
`RE_RenderFrame` in order to render subframes.
2022-09-13 20:25:50 +02:00
08a8de739d Fix: Resolve deprecation warning when copying polygon struct
`MPoly` is used and copied in many places. To avoid the need to use a
special function for copying MPoly, or the need to add a copy
constructor, just rename the `mat_nr` field to include "legacy" in the
name. This keeps the original purpose of notifying developers that
the field shouldn't be used without any further complexity.
Apply the same fix to `bweight`.

Differential Revision: https://developer.blender.org/D15841
2022-09-13 11:43:34 -05:00
Mattias Fredriksson
eaf416693d Geometry Nodes: Port the trim curve node to the new data-block
The trim functionality is implemented in the geometry module, and
generalized a bit to be potentially useful for bisecting in the future.
The implementation is based on a helper type called `IndexRangeCyclic`
which allows iteration over all control points between two points on a
curve.

Catmull Rom curves are now supported-- trimmed without resampling first.
However, maintaining the exact shape is not possible. NURBS splines are
still converted to polylines using the evaluated curve concept.

Performance is equivalent or faster then a 3.1 build with regards to
node timings. Compared to 3.3 and 3.2, it's easy to observe test cases
where the node is at least 3 or 4 times faster.

Differential Revision: https://developer.blender.org/D14481
2022-09-13 11:36:14 -05:00
d88811aed3 Fix T100980: Missing deg update when duplicating a geometry nodetree in node editor.
Tagging depsgraph for relation rebuild does not replace tagging IDs for update.
2022-09-13 16:42:34 +02:00
109cc14dba Revert hidden object optimization in depsgraph
The internal state tracking is not fully suited for such kind
of optimization yet.

It is probably not that much work to make them work, but the
issue caused by the changes is serious enough for the studio
so it feels better to revert changes for now and have a closer
look into remaining issues without pressure.
2022-09-13 16:05:16 +02:00
8442b0ffc1 Fix T101027: Sculpt tools don't respect visibility after recent commit
Caused by b5f7af31d6, which exposed the fact that the PBVH wasn't
retrieving the updated hide status attributes if they were allocated in
sculpt mode. Previously the attributes were always allocated when
entering sculpt mode.
2022-09-13 08:35:58 -05:00
Nate Rupsis
b6ebd5591c NLA: Remove Edited Action tab from NLA panel
Removes the "Edited Action" tab for selected Action strips in the NLA
editor. It is still available in the Action editor, where it is actually
suitable/usable. Having it in the NLA got in the way of the actual NLA
strip properties.

Reviewed By: sybren, RiggingDojo

Differential Revision: https://developer.blender.org/D14964
2022-09-13 15:09:06 +02:00
34051fcc12 EEVEE: Fix volumetric resolve in large scenes.
On NVIDIA volumetric resolve failed for large production scenes.
The result would remove most color from the final render. The cause
seems to be a faulty driver.

This change ported the fragment shader to a compute shader which
would select a different compiler branch and didn't show the error.
2022-09-13 15:05:17 +02:00
Wayde Moss
b404548972 Fix: set ipo/easing in dope ignores hidden channels
Animators were not able to set channel interpolation or easing type for
channels visible in the dopesheet but hidden in the graph editor.

Bug seemed to be due to typo.
No official report, but there was a RCS on this
https://blender.community/c/rightclickselect/yWgbbc/

Reviewed By: sybren, RiggingDojo

Differential Revision: https://developer.blender.org/D10228
2022-09-13 15:03:24 +02:00
92a92fdca5 Fix T101031: Crash with Initialize Face Sets operator 2022-09-13 07:48:41 -05:00
a99a62231e obj: implement support for PBR .mtl extensions
Implement import & export support for "PBR extensions" in .mtl files
(T101029, also fixes T86736).

Newly supported parameters:
- Roughness (Pr, map_Pr)
- Metallic (Pm, map_Pm)
- Sheen (Ps, map_Ps)
- Clearcoat thickness (Pc) and roughness (Pcr)
- Anisotropy (aniso) and rotation (anisor)
- Transmittance (Tf / Kt)

Exporter has an option to enable these additional PBR parameters
export; defaults to off since not all software understands that.

Exporter UI tweaked and all material-related options were put into
their own separate box.

Added/extended test files in Subversion repository for test coverage.
2022-09-13 15:01:29 +03:00
3839a4dd84 Fix broken Cycles Metal build after recent changes
It was unable to find the Metal framework, thanks to Alaska for tracking
this down.
2022-09-13 13:52:14 +02:00
62cee24003 Fix: crash when changing to viewer context in spreadsheet 2022-09-13 13:14:29 +02:00
3c2c296130 Fix compilation error on Windows after recent change 2022-09-13 11:52:11 +02:00
Jeroen Bakker
8068b89a68 EEVEE-Next: Cryptomatte render passes.
This change adds cryptomatte render passes to EEVEE-Next. Due to the upcoming viewport
compositor we also improved cryptomatte so it will be real-time. This also allows viewing
the cryptomatte passes in the viewport directly.

{F13482749}

A surface shader would store any active cryptomatte layer to a texture. Object hash is stored
as R, Asset hash as G and Material hash as B. Hashes are only calculated when the cryptomatte
layer is active to reduce any unneeded work.

During film accumulation the hashes are separated and stored in a texture array that matches
the cryptomatte standard. For the real-time use case sorting is skipped. For final rendering
the samples are sorted and normalized.

NOTE: Eventually we should also do sample normalization in the viewport in order to extract the correct
mask when using the viewport compositor.

Reviewed By: fclem

Maniphest Tasks: T99390

Differential Revision: https://developer.blender.org/D15753
2022-09-13 11:07:38 +02:00
bb3a021427 Fix T101004: Crash when invisible object becomes visible
A regression since ac20970bc2

The issue was caused by depsgraph clearing all id->recalc flags
wrongly assuming that all IDs are fully evaluated.

This change makes it so the depsgraph becomes aware of possibly
incompletely evaluated IDs.

Differential Revision: https://developer.blender.org/D15946
2022-09-13 11:00:37 +02:00
a45c36efae Cycles: Make OSL implementation independent from SVM
Cleans up the file structure to be more similar to that of the SVM
and also makes it possible to build kernels with OSL support, but
without having to include SVM support.

This patch was split from D15902.

Differential Revision: https://developer.blender.org/D15949
2022-09-13 10:59:28 +02:00
8e03df9bbc Fix oneAPI compilation on modern Linux and CentOS 7 libraries 2022-09-13 10:55:36 +02:00
602cca671e Cycles: Include reason the oneAPI library could not be loaded
Additionally, just stick to a pure error stating. Such messages
are aimed for developers and it is rather implied that oneAPI
rendering will be disabled.
2022-09-13 10:52:18 +02:00
cca416cfe6 Fix compilation on Linux, glibc 2.34, and CentOS libraries
A continuation of previous fix for malloc hooks which got removed
from the new glibc library.

The pre-compiled jemalloc has definitions which interpose hooks
in glibc leading to linking errors with multiple hook definitions.

A simple fix is to skip doing the workaround when using jemalloc
from pre-compiled libraries.

This will likely be revisited in the future, but for now it is
important to fix compilation errors for developers.
2022-09-13 10:38:42 +02:00
146e67b2bd CMake: exclude BLI_args when building as a Python module 2022-09-13 18:03:29 +10:00
d92e14af1f Cleanup: typo in variable name 2022-09-13 18:03:09 +10:00
f78219c9a8 Cleanup: spelling in comments 2022-09-13 18:03:09 +10:00
4130f1e674 Geometry Nodes: new evaluation system
This refactors the geometry nodes evaluation system. No changes for the
user are expected. At a high level the goals are:
* Support using geometry nodes outside of the geometry nodes modifier.
* Support using the evaluator infrastructure for other purposes like field evaluation.
* Support more nodes, especially when many of them are disabled behind switch nodes.
* Support doing preprocessing on node groups.

For more details see T98492.

There are fairly detailed comments in the code, but here is a high level overview
for how it works now:
* There is a new "lazy-function" system. It is similar in spirit to the multi-function
  system but with different goals. Instead of optimizing throughput for highly
  parallelizable work, this system is designed to compute only the data that is actually
  necessary. What data is necessary can be determined dynamically during evaluation.
  Many lazy-functions can be composed in a graph to form a new lazy-function, which can
  again be used in a graph etc.
* Each geometry node group is converted into a lazy-function graph prior to evaluation.
  To evaluate geometry nodes, one then just has to evaluate that graph. Node groups are
  no longer inlined into their parents.

Next steps for the evaluation system is to reduce the use of threads in some situations
to avoid overhead. Many small node groups don't benefit from multi-threading at all.
This is much easier to do now because not everything has to be inlined in one huge
node tree anymore.

Differential Revision: https://developer.blender.org/D15914
2022-09-13 08:44:32 +02:00
4d69b6f525 Cleanup: use u-prefixed integer types (for brevity) 2022-09-13 16:29:06 +10:00
75f9b691e2 Docs: improve explanation for why CLG_exit shouldn't be called early 2022-09-13 16:01:39 +10:00
5ffa829a0e Cleanup: improve titles for CMake sections, line length
Also use same convention for comments as (space after #).
2022-09-13 13:50:21 +10:00
060da0858b CMake: omit WITH_INSTALL_PORTABLE from bpy_module.cmake
Since this was added, Linux libraries have been included in `../lib/`.
This made `make bpy` on Linux install the `bpy` module into the bundled
SVN libraries which isn't very useful.

Now leave WITH_INSTALL_PORTABLE unset (defaulting to ON).
Python developers may reference their systems Python and disable the
option if they wish for a system-wide module installation.
2022-09-13 13:30:06 +10:00
41212c1d44 CMake: omit WITH_INSTALL_PORTABLE from the 'lite' configuration
As portable is already the default, setting it meant using the lite
configuration would always reset the value if was intentionally changed.

This was also inconsistent as other configurations left this unset.
2022-09-13 13:30:06 +10:00
9189260880 Python: update defaults for "make bpy"
This was a kind of "lite" target, disabling options such as FFMPEG and
ALEMBIC which may be useful to read/write data from the Python module.

Now fewer options have been changed.
The following options are now disabled:

- Audio support (to prevent audio devices being initialized on startup).
- Input device support such as NDOF and IME as there is no GUI.
- Blender thumbnail extraction as it's not installed as part of
  the Python module.

Instead of attempting to predict what is useful to enable when building
as a Python module, developers can mix combine options e.g.
"make bpy release" or "make bpy lite".
2022-09-13 13:28:22 +10:00
03885fe120 Makefile: support 'make bpy lite' / 'make bpy release'
Re-order configuration loading so 'bpy' is loaded after others.
Needed as `bpy` disables options other configurations enable.
2022-09-13 13:28:22 +10:00
90fb212a93 Docs: improve BKE_object_defgroup_flip_map doc-string 2022-09-13 13:24:45 +10:00
1a08a26388 Cleanup: spelling in comments 2022-09-13 13:24:44 +10:00
c05ff54795 Cleanup: remove unused function 2022-09-13 13:24:42 +10:00
400151833d Nodes: Avoid unnecessary sorting when selecting or moving nodes
Previously the nodes were sorted wven when there was no change.
This is a fixed version of e3ef6a6660, which was reverted by
dc937c5aee.
2022-09-12 21:47:01 -05:00
50913d719c Cleanup: Use attribute API for curves functions 2022-09-12 21:47:01 -05:00
ddfce277e0 NLA: actionclip_add now fails on invoke if no NLA track is selected
This makes the NLA_OT_actionclip_add operation (Shift+A while mousing
over the NLA strips area) fail on invocation if no tracks are active.

This stops the annoyance of using the Shift+A menu to select an action
to add, but only getting the error after you select an action.

Differential Revision: https://developer.blender.org/D15737
2022-09-12 18:11:00 -07:00
b3e9ef1924 Fix building WITH_GHOST_WAYLAND, WITH_OPENXR (without X11)
The pre-processor blocks contained un-balanced braces, causing a syntax
error when building with WAYLAND but not X11.

Use the same number of opening & closing braces in each pre-processor
block so changes aren't as likely to break other platforms.

Also assert when unexpected states are reached.
2022-09-13 10:41:36 +10:00
ebcf004ecf Cleanup: quiet missing-variable-declarations warning 2022-09-13 10:41:36 +10:00
2c73175100 Cleanup: missing declaration warning 2022-09-13 10:41:36 +10:00
28c9b33870 IMBUF: Fix WebP Build Error and Warnings
Fix error and warnings introduced in commit 8851790dd7. Include
unistd.h for close() on Non-Windows OSs. Calm warnings about unused
argument. Return full size of image file to caller.

Own Code.
2022-09-12 17:28:19 -07:00
c8b6062d6c Update RNA to User manual mappings 2022-09-12 19:09:32 -04:00
8851790dd7 IMBUF: Improved Thumbnailing of WebP Images
Thumbnail WebP images quicker while using much less RAM.

See D15908 for more details.

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

Reviewed by Brecht Van Lommel
2022-09-12 15:42:51 -07:00
ad245f1970 Fix T101013: Reordering materials broken with only one assigned
When there was only a single material assigned to the mesh, the material
index attribute didn't necessarily exist. Changing the oder of the slots
wouldn't change the first material index as necessary.
2022-09-12 17:17:11 -05:00
ea474dda62 Fix: Node edge pan and remove on cancel doesn't work
Caused by 4a71765f9a which used an operator that didn't have the
properties it expected.
2022-09-12 16:43:54 -05:00
5bad311f4c Fix: Multires crash after recent face set refactor
Missing null check when retrieving face sets for multires automasking.
Caused by b5f7af31d6.
2022-09-12 16:12:18 -05:00
752a9b743e USD IO: fixed compiler warnings 2022-09-12 15:47:45 -04:00
bc15c83afa Fix T100886: error saving side-by-side stereo EXR image of depth pass
The stereo saving code that combines two image buffers into one did not work
correctly when the number of channels is not equal to 4.
2022-09-12 20:21:13 +02:00
100fe61f7c Sculpt: Fix T100941: Draw cache invalidation loop
PBVH draw was invalidating the draw cache even
when disabled (e.g. if modifiers exist).
2022-09-12 11:10:07 -07:00
8af59cdb16 Cleanup: obj: rename MTLMaterial & MTLTexMapType members
The members were named after .mtl file syntax ("d") instead of their
meaning ("alpha"). In preparation for extending OBJ code for more
PBR parameters support, rename them for clarity. No functionality
changes, just a pure rename.
2022-09-12 21:05:57 +03:00
8f6a07bc75 Cleanup: Comment formatting
Also include a small cleanup to the previous commit missed from review.
2022-09-12 12:54:44 -05:00
2c1650ae8f Sculpt: Fix T100608: SCULPT_UNDO_FACE_SETS broken for redo
Always swap values when restoring sculpt undo data.
2022-09-12 10:51:53 -07:00
b5f7af31d6 When these features aren't used, there is no sense in storing the
corresponding data layers and using their values for computations.
Avoiding that should increase performance in many operations that
would otherwise have to read, write, or propagate these values.
It also means decreased memory usage-- not just for sculpt mode
but for any mesh that was in sculpt mode. Previously the mask, face set,
and hide status layers were *always* allocated by sculpt mode.

Here are a few basic tests when masking and face sets are not used:

| Test | Before | After |
| Subsurf Modifier | 148 ms | 126 ms |
| Sculpt Overlay Extraction | 24 ms every redraw | 0 ms |
| Memory usage | 252 MB | 236 MB |

I wouldn't expect any difference when they are used though.

The code changes are mostly just making sculpt features safe for when
the layers aren't stored, and some changes to the conversion to and
from the hide layers. Use of the ".hide_poly" attribute replaces testing
whether face sets are negative in many places.

Differential Revision: https://developer.blender.org/D15937
2022-09-12 12:48:42 -05:00
3d3c34f345 Sculpt: Fix T101008: Missing CD_MDISPS layer
sculpt_update_object now auto-creates a CD_MDISPS layer
if missing.  Note that it is possible for the depsgraph
to provide a multires ccg context without a CD_MDISPS.
This causes a PBVH_GRIDS pbvh to be built instead of
falling back to PBVH_FACES, which is why this bug happens
(of course falling back to PBVH_FACES would still be a bug).
2022-09-12 10:33:47 -07:00
9951464571 Fix T100956: Cycles GPU context assert after recent changes
We don't need to be on the main thread to destroy the context.
2022-09-12 19:00:07 +02:00
54571003dc Fix T100016: Memory leak in USD importer.
These changes were implemented by Sonny Campbell.

Fixed the first issue by freeing the operator customdata when the import
is cancelled.

Fixed the second issue by using a character array instead of allocating
new memory for the prim_path_mask.

Differential Revision: https://developer.blender.org/D15781
2022-09-12 12:46:27 -04:00
9088a1f476 Geometry: Avoid unnecessary initialization when resizing data arrays
When resizing mesh and curves attribute storage, avoid initializing the
new memory for basic types. Also, avoid skipping "no free" layers; all
layers should be reallocated to the new size since they may be accessed.

The semantics introduced in 25237d2625 are essential for this
change, because otherwise we don't have a way to construct non-trivial
types in the new memory.

In a basic test of the extrude node, I observed a performance
improvement of about 30%, from 55ms to 42ms.

Differential Revision: https://developer.blender.org/D15818
2022-09-12 11:35:33 -05:00
225b5a3491 BLI: Add utility functions to generic spans
Generally we don't want to do per-element operations on these spans
because of the overhead of the runtime type system, but these operations
on the whole span avoid ugly pointer arithmetic in other areas.
2022-09-12 11:04:52 -05:00
e37f3388b1 Attributes: Add function to retrieve span without adding attribute
Previously, the only versions of attribute access that gave a span would
also add the attribute when it doesn't exist, which isn't always wanted.
2022-09-12 11:04:52 -05:00
ce07bc3628 Merge remote-tracking branch 'origin/blender-v3.3-release' 2022-09-12 17:13:25 +02:00
Thibault de Villèle
7c33d7b4b5 Fix T100918: change min value for NLAStrip start
The bug was contained in BKE/intern/nla.c, where the wrong macro was
used as the minimum frame value. Instead of `MINAFRAMEF`, `MINFRAMEF`
was used (the former is around -10k, the latter is 0, both fp32).

Differential Revision: https://developer.blender.org/D15940
2022-09-12 17:08:06 +02:00
038a19ce6c Fix macOS incomplete Python install after recent changes
After 2c23b4e0bf the meaning of PYTHON_LIBPATH changed.
2022-09-12 15:48:09 +02:00
16af35054d GLibC Compat: Add deprecated memory hooks symbols removed from 2.34.
Starting from GLibC 2.34, deprecated `__malloc_hook` & co. have been
removed from headers, while still present in the shared library itself.

This means that it is no more possible to build Blender with USD 22.03
on recent linux systems.

While USD 22.08 has a fix to this issue, it is unlikely to be upgraded
for Blender 3.4, and definitely not for Blender 3.3.

This commit ensures Blender can build with USD 22.03 and glibc >= 2.34.

Ref.: T99618,
https://devtalk.blender.org/t/building-blender-on-linux-using-glibc-2-34-raises-linking-errors-from-the-usd-library/24185

Patch by @brecht, many thanks.
2022-09-12 15:23:42 +02:00
ec2e866aee UI: Cleanup/Fixes of some UI messages. 2022-09-12 14:18:17 +02:00
2d069b609b Fix T100999: GPencil Copy paste stroke(s) does not respect autokeying
The operator was not checking the status of the 
Autokey button.
2022-09-12 12:13:07 +02:00
33abb68cf2 UI: add a Custom Properties panel to the View Layer tab of properties.
Although view layers aren't ID, they do support custom properties,
so not providing the UI to access them seems to be a simple oversight.
2022-09-12 10:31:53 +03:00
6d0f8d5a19 Fix T100851: Sync markers does not work for numinput
special_aftertrans_update would always use TransInfo values (not
the values_final -- we need the final values to follow numinput, snapping,
etc).

Maniphest Tasks: T100851

Differential Revision: https://developer.blender.org/D15893
2022-09-12 09:11:29 +02:00
ebc385de5f Cleanup: Remove unused DerivedMesh functions 2022-09-11 21:42:41 -05:00
94e211ced9 Fix T100874: improve uv unwrap of degenerate geometry
Provide reasonable defaults for UV unwrap for triangles with zero area:

* Three vertices are arranged in a line.
* Two vertices are at the same 3D location.
* All three vertices are at the same 3D location.

Change fixes quads / ngons which have triangulations with zero area.

Change fixes both "Angle Based" method and "Conformal" method.

Differential Revision: https://developer.blender.org/D15922
2022-09-12 14:23:22 +12:00
c9a8380426 Cleanup: remove unused ImBuf.next/prev pointers 2022-09-12 11:20:22 +10:00
f884a34cae Cleanup: replace BLI_snprintf with BLI_path_join
Also use a larger buffer to account for the unlikely case of the
buffer not being big enough for the appended directories.
2022-09-12 11:02:25 +10:00
cf9c0a4b50 Tests: add tests for leading (relative) slashes for BLI_path_join
Also note that leading slashes are kept in the doc-string.
2022-09-12 11:02:25 +10:00
caf6225a3d UV: support uv seams when computing uv islands
An edge can be marked BM_ELEM_SEAM, which means the UV co-ordinates
on either side of the edge are actually independent, even if they
happen to currently have the same value.

This commit optionally add support for UV Seams when computing islands.

Affects UV sculpt tools, individual origins, UV stitch and changing
UV selection modes etc.

Required for upcoming packing refactor which requires seam support
when computing islands.

Differential Revision: https://developer.blender.org/D15875
2022-09-12 12:27:14 +12:00
1f4dc51d09 Fix T100974: Remesh operators reset mesh properties
Caused by 21f2bacad9 which copies a few more values to
the original meshes from the "nomain" meshes. The "nomain" meshes
created from the originals need to copy some values as well.
2022-09-10 18:06:54 -05:00
8b612c6496 GPencil: Add new Set Start Point operator to context menu 2022-09-10 16:12:18 +02:00
98c4e1e590 GPencil: New Set Start point operator
This operator allows to set the start point for any cyclic stroke.

This is very handy to fit interpolation issues or
use thickness modifier.

Note: There is small change in this commit to fix
a typo error in the name of the operator.

Reviewed By: mendio, frogstomp

Maniphest Tasks: T100827

Differential Revision: https://developer.blender.org/D15881
2022-09-10 15:43:20 +02:00
2c23b4e0bf Python: on macOS, stop requiring framework for building bpy module
Build against Python from precompiled libraries by default, instead of
requiring framework from python.org package install. The resulting bpy module
can still be used with any Python install of the same version.

Use the same CMake find module as Linux. This simplifies code, and makes it
possible to manually set PYTHON_* variables in CMake configuration.

Remove WITH_PYTHON_FRAMEWORK option for regular Blender build, as this doesn't
work well due to missing required Python packages. Advanced users can still
set PYTHON_ROOT_DIR=/Library/Frameworks/Python.framework/Versions/3.10 for
the same result.
2022-09-10 13:47:48 +02:00
325eee2261 Cleanup: cycles OSL compiler warnings 2022-09-10 13:47:48 +02:00
8cb3b49e51 Cleanup: replace strncpy with BLI_strncpy
Also replace strncpy+strcat with BLI_string_join
2022-09-10 16:54:21 +10:00
489cb7fd7e Cleanup: remove unnecessary strcat use 2022-09-10 16:19:23 +10:00
c90fbbf75a WM: update comment for wm_autosave_location auto-save fallback 2022-09-10 16:19:23 +10:00
66fab6828c BKE_appdir: add function attributes 2022-09-10 15:50:49 +10:00
c34b4d35ab Fix possible NULL pointer dereference in bookmark operators
Although unlikely, the result of BKE_appdir_folder_id_create may be NULL.
Check this for bookmark operators & move writing bookmarks into a shared
utility function.
2022-09-10 15:38:51 +10:00
9877d9e145 Cleanup: remove redundant NULL checks
Checking if a property exists only makes sense for generic callbacks
that apply to multiple operators.
2022-09-10 14:54:02 +10:00
5a0447ca88 Cleanup: spelling in comments 2022-09-10 14:19:34 +10:00
eae081f8fd Cleanup: format, spelling 2022-09-10 14:17:32 +10:00
ef3c49de81 Cleanup: early return when directories can't be found
Also reduce variable scope and assert when an invalid argument
is passed to BKE_appdir_folder_id_create.
2022-09-10 14:13:07 +10:00
099ae99589 Fix: Missed return in ASSET_OT_bundle_install item enumerator
Discovered from inspection.

Differential Revision: https://developer.blender.org/D15699
2022-09-09 20:12:47 -07:00
352d55b1c8 Mesh: Avoid saving redundant generic material index attribute
This attribute is still read and written in the legacy format which
puts it inside of `MPoly`. Missed in f1c0249f34.
2022-09-09 17:58:13 -05:00
7966fb083e PyGPU: expose 'GPU_SHADER_3D_IMAGE_COLOR'
This shader is required by some addons that need to modulate the alpha of images.
2022-09-09 18:31:08 -03:00
ded4604d71 install_deps: update OpenVDB for Blender 3.4.
This has been a pain, newer OpenVDB forcefully trying to use more recent
system TBB (oneTBB) instead of the one built by this script.

Also include a few minor unrelated fixes.

Ref T99618.
2022-09-09 21:38:56 +02:00
1e1e9014cf install_deps: update OIIO/Boost/Python/NumPy versions.
OIIO: 2.3.18.0
Boost: 1.80.0
Python:3.10.6
NumPy: 1.23.2

Ref T99618.
2022-09-09 18:01:45 +02:00
8611c37f97 Cycles: Generate OSL closures using macros and a template file
This has the advantage of being able to use information about the
existing OSL closures in various places without code duplication. In
addition, the setup code for all closures was moved to standalone
functions to avoid usage of virtual function calls in preparation for GPU
support.

This patch was split from D15902.

Differential Revision: https://developer.blender.org/D15917
2022-09-09 15:47:37 +02:00
ef7c9e793e Cycles: Remove separate OSL attribute map and instead always use SVM attribute map
The SVM attribute map is always generated and uses a simple
linear search to lookup by an opaque ID, so can reuse that for OSL
as well and simply use the attribute name hash as ID instead of
generating a unique value separately. This works for both object
and geometry attributes since the SVM attribute map already
stores both. Simplifies code somewhat and reduces memory
usage slightly.

This patch was split from D15902.

Differential Revision: https://developer.blender.org/D15918
2022-09-09 15:35:44 +02:00
291c313f80 Mesh: Move bevel weight out of MVert and MEdge
As described in T95966, the goal is to move to a "struct of arrays"
approach rather than gathering an arbitrary set of data in hard-coded
structs. This has performance benefits, but also code complexity
benefits (this patch removes plenty of code, though the boilerplate
for the new operators outweighs that here).

To mirror the internal change, the options for storing mesh bevel
weights are converted into operators that add or remove the layer,
like for some other layers.

The most complex change is to the solidify modifier, where bevel
weights had special handling. Other than that, most changes are
removing clearing of the weights, boilerplate for the add/remove
operators, and removing the manual transfer of bevel weights
in bmesh - mesh conversion.

Eventually bevel weights can become a fully generic attribute,
but for now this patch aims to avoid most functional changes.

Bevel weights are still written and read from the mesh in the old way,
so neither forward nor backward compatibility are affected. As described
in T95965, writing in the old format will be done until 4.0.

Differential Revision: https://developer.blender.org/D14077
2022-09-09 08:29:47 -05:00
21f2bacad9 Cleanup: Simplify BKE_mesh_nomain_to_mesh
- Remove "take ownership" argument which was confusing and always true
  - The argument made ownership very confusing
  - Better to avoid boolean arguments that switch a function's purpose
- Remove "mask" argument which was basically wrong and not used properly
  - "EVERYTHING" was used because developers are wary of removing data
  - Instead use `CD_MASK_MESH` for its purpose of original mesh data
- Remove use of shallow copied temporary mesh, which is unnecessary now
- Split shape key processing into separate functions and use C++ types
- Copy fields explicitly rather than using memcpy for the whole struct
- Use higher level functions and avoid redundant code
  - The whole idea is pretty simple and can be built from standard logic
- Adjust `CustomData` logic to be consistent with "assign" expectations
  - Clear the layer data from the source, and moves the anonymous ID

Differential Revision: https://developer.blender.org/D15857
2022-09-09 08:29:46 -05:00
12c235a1c5 Subdiv: Avoid quadratic runtime for loose edges
Currently, when subdividing every single vertex on every loose edge,
Blender iterates over all other edges to find neighbors. This has
quadratic runtime and can be very slow. Instead, first create a
map of edges connected to each vertex.

With about 10000 edges, the performance goes from very slow to very
smooth in my tests. Because of the nature of quadratic runtime, the
improvement will depend massively on the number of elements.

The only downside to this is that the map will still be built when
there are only a couple loose edges, but that case is probably not
so common.

Differential Revision: https://developer.blender.org/D15923
2022-09-09 08:29:46 -05:00
cef1b9c30f Cleanup: remove BLI_make_file_string
This function did multiple things making it difficult to know
what was intended by the caller:

- Directory & file join.
- Expand relative '//' prefix to an optional directory.
- Expand drive letters on windows (guessing with fall-backs).
- Switch slashes to native direction.

This functionality wasn't needed as the full directory was always passed
in, so guessing the drive letter wasn't needed.

If functionality to add drive letters onto paths is needed in the future
a function that only does this can be added.
2022-09-09 23:21:00 +10:00
436f1b4dbe Correct error building on WIN32
Mistake in f7a4ede79f.
2022-09-09 23:21:00 +10:00
6039d15732 Fix Clang warning about braces around initialization 2022-09-09 15:03:36 +02:00
05f821b094 Cleanup: remove unnecessary use of BLI_make_file_string
Use BLI_join_dirfile instead, also reduce right-shift.
2022-09-09 22:43:34 +10:00
8f8ae06b51 Fix use-after-free error when exiting on WIN32
The logging API was freed before calling wm_autosave_delete that called
BKE_appdir_folder_id_create to get the auto-save location (when the
temporary directory wasn't found). Detecting BLENDER_USER_AUTOSAVE would
log details about the path, which would read data freed by CLG_exit.
Resolve by calling CLG_exit last.
2022-09-09 22:43:34 +10:00
f4e5a86544 Realtime Compositor: Implement bokeh blur node
This patch implements the bokeh blur node for the realtime compositor.
The patch is still missing the Variable Size option because it depends
on the Levels node, which is yet to be implemented. In particular, it
requires the computation of global texture properties like the maximum
color.

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

Reviewed By: Clement Foucault
2022-09-09 14:32:58 +02:00
03f33a6f23 Realtime Compositor: Allow inputs to skip realization
This patch adds support for the skip realization option of the input
descriptor. Inputs that request skip realization will not be realized on
the operation domain of the operation and will not contribute to its
computation, and consequently, they can't be a domain input.

An example is the bokeh input of the Bokeh Blur node, which is actually
a resource that is decoupled from the rest of the inputs and should not
affect or be affected by their domain.

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

Reviewed By: Clement Foucault
2022-09-09 14:22:03 +02:00
0fd39da3a9 Realtime Compositor: Implement scale node
This patch implements the Scale node for the realtime compositor.

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

Reviewed By: Clement Foucault
2022-09-09 14:11:43 +02:00
e254d8867d Outliner: Hide library overrdies context menu when no IDs are selected
The library overrides context menu operators only make sense when at
least one ID is selected in the Outliner. So don't show them unless
that's the case. This also means the menu items don't show up anymore
for things like RNA properties, or the overridden properties in the
Library Overrides Properties view.

Also see 7eda9d8dda and the previous commit.
2022-09-09 14:04:27 +02:00
860c3dce1b Outliner: Don't show asset context menu when no IDs are selected
The asset context menu operators only make sense when at least one ID is
selected in the Outliner. So don't show them unless that's the case.
This also means the menu items don't show up anymore for things like RNA
properties, or the overridden properties in the Library Overrides
Properties view.

Also see 7eda9d8dda.
2022-09-09 14:04:27 +02:00
04ae0fe46b Realtime Compositor: Implement blur node
This patch implements the blur node for the realtime compositor. The patch is
still missing the Variable Size option because it depends on the Erode/Dilate
node, which is yet to be implemented. Furthermore, there are a number of
optimizations that can be implemented, the most important of which is the IIR
implementation of the Fast Gaussian filter, as well as the use of hardware
filtering and thread local memory. The latter of which was attempted but was
not robust enough, so it will be submitted as separate patch.

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

Reviewed By: Clement Foucault
2022-09-09 13:58:54 +02:00
1339fec22a Nodes: fix memory leak 2022-09-09 13:35:21 +02:00
f15fecf0f7 Readfile: avoid confusion when debugging a memory leak 2022-09-09 13:16:28 +02:00
ac66a819c1 Realtime Compositor: Implement pixelate node
This patch implements the pixelate node for the realtime compositor.

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

Reviewed By: Clement Foucault
2022-09-09 13:15:01 +02:00
77a4bb02cc Fix T100697: Curve nodes change colors at identity settings
Shader and compositor curve nodes change their inputs even if they are
at identity settings.

That is because shader and compositor curve nodes evaluate their curve
map texture samplers at the normalized input directly, disregarding the
fact that the samplers are evaluated using linear interpolation. This
causes the output to be slightly different that it should be.

This patch remaps the evaluation parameters such that the texture
sampler is evaluated at the center of the pixels.

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

Reviewed By: Clement Foucault
2022-09-09 13:03:53 +02:00
fa0f18b37d Cleanup: readfile: use correct type 2022-09-09 12:37:02 +02:00
0817966f14 Cleanup: Remove unused attribute in draw manager.
There are no plans to use the object attribute anymore.
2022-09-09 12:24:51 +02:00
dc937c5aee Fix Auto-offset for nodes: Revert "Cleanup: Return early"
This "cleanup" commit broke Auto-offset for nodes.

This reverts commit e3ef6a6660.
2022-09-09 11:51:07 +02:00
58945b07f1 Cleanup: remove paranoid NULL checks 2022-09-09 17:46:43 +10:00
Loren Osborn
3baca31719 Fix error extracting arguments from project_source_info
Output of make encounters path names that are single-quoted. This
causes the path to be misinterpreted and fail validation.

Resolves error in "make check_cppcheck"

Ref D15801 (partially applied)
2022-09-09 17:18:11 +10:00
1e6a003860 Cleanup: move return arguments last, use r_ prefix
Also use '_num' suffix instead of '_tot'.
2022-09-09 16:20:32 +10:00
87a45db522 Edit mode normalize fails to respect locked groups
Add BKE_object_defgroup_flip_map_unlocked which excludes locked groups
from the flip-map.

Reviewed By: zanqdo, campbellbarton

Maniphest Tasks: T96787

Ref D15317
2022-09-09 16:03:02 +10:00
Nate Rupsis
43b1624eee Fix T96787: Edit mode normalize fails to respect locked groups
Add BKE_object_defgroup_flip_map_unlocked which excludes locked groups
from the flip-map.

Reviewed By: zanqdo, campbellbarton

Ref D15317
2022-09-09 15:58:49 +10:00
fb07bbb751 License headers: use SPDX identifiers 2022-09-09 15:44:03 +10:00
274dc024f6 Cleanup: format, trailing space 2022-09-09 15:38:27 +10:00
0c9749093b Cleanup: spelling in comments 2022-09-09 15:37:33 +10:00
f7a4ede79f Python: change bpy.app.binary_path behavior WITH_PYTHON_MODULE
The following changes have been made to this attribute with
WITH_PYTHON_MODULE is defined:

- Defaults to an empty string (instead of pointing to __init__.so).
- It's writable, so script authors can point to a valid Blender binary.

`where_am_i(..)` is no longer used by BKE_appdir_program_path_init,
there is now a separate code-path for setting the initial program
directory, calls after this can be used to set the binary path.
2022-09-09 14:01:41 +10:00
d455f1a0ba Cleanup: quiet conversion warning 2022-09-09 12:17:59 +10:00
ce5ad66330 GNUmakefile: change message to reference "bpy" when building as a module 2022-09-09 12:17:09 +10:00
3a01c23a84 Cleanup: cmake line length, wrapping 2022-09-09 11:52:14 +10:00
9e0c2f6867 CMake: exclude Python libs & batch scripts WITH_PYTHON_MODULE for WIN32 2022-09-09 11:33:43 +10:00
22b84424c7 Cleanup: check for Python module in BKE_appdir_program_path_init
Replace the argument with an in ifdef in BKE_appdir_program_path_init.
At the time `blenkernel` didn't define WITH_PYTHON_MODULE, since it does
now there is no need for an argument. With the minor benefit of fewer
preprocessor checks in the main() function.
2022-09-09 11:13:05 +10:00
fad7a30de3 Cleanup: comments, spelling, line length for creator's CMake file 2022-09-09 11:10:37 +10:00
81558783e4 Python: install "bpy" as a package WITH_PYTHON_MODULE
Building WITH_PYTHON_MODULE was creating a "bpy" module that required
Blenders data-files to be located in the module search path too.

This mean that a typical installation on Linux would create:

- `/usr/lib/python3.10/site-packages/bpy.so`
- `/usr/lib/python3.10/site-packages/3.4`
  (containing `scripts` & `datafiles`).

The new behavior creates:

- `/usr/lib/python3.10/site-packages/bpy/__init__.so`
- `/usr/lib/python3.10/site-packages/bpy/3.4`

With the advantage that the "bpy" directory is the self contained Python
module.

No changes are needed for the module loading logic as the mechanism to
swap in blend internal Python "bpy" module
(defined in `release/scripts/modules/bpy/__init__.py`)
works the same in both instances.

Thanks to Brecht for macOS support.

Reviewed by brecht

Ref D15911
2022-09-09 10:25:35 +10:00
Dominik Fill
4a71765f9a Fix T100521: Nodes added with link drag search not added to frame
Use macro NODE_OT_translate_attach for attaching node created through
link-drag-search to frame, as suggested by Leon Schittek (@lone_noel)
in D15888.

Differential Revision: https://developer.blender.org/D15920
2022-09-08 17:03:54 -05:00
ff8cd48418 Fix T100833: Cycles UDIM baking broken after recent changes 2022-09-08 20:24:32 +02:00
06a5741f42 Silence warnings/assert about invalid embedded IDs for older blendfiles.
there is no point in warning about files that are not supposed to be
'correct' in that regard.
2022-09-08 18:49:10 +02:00
e5a7470638 Fix: link drag search feature only works forgeometry nodes groups
The node tree used to detect if the tree was a node group wasn't the
last in the node editor's path like it should be, so the search thought
that all shader node groups weren't node groups.
2022-09-08 10:57:21 -05:00
ff7bba8dad Fix: Integer type in linear probing strategy
Probing strategies must iterate over every possible hash, but the linear
strategy only did 2^32 iterations, not 2^64. Updating this was missed
in 8cbbdedaf4. Also fix an unnecessary comma.

Differential Revision: https://developer.blender.org/D15913
2022-09-08 09:52:42 -05:00
17f37b43f1 Cleanup: Remove unused face customdata for merging meshes 2022-09-08 09:50:59 -05:00
b9727dae82 Cleanup: Remove redundant vertex duplication in extrude node
Now this is done by `Mesh::verts_for_write()`
2022-09-08 09:50:59 -05:00
59f6c60fb6 Cleanup: Remove unused variable in RNA path function
Caused by 462014b59b
2022-09-08 16:44:24 +02:00
7eda9d8dda Outliner: Hide "data operations" context menu entries unless supported
The context menu would always show a section with "Select", "Deselect",
"Hide", "Unhide" and "Select Linked" if there were no more specific
operators to show (e.g. modifier operations). For many tree elements
they did not make sense and simply would do nothing. Only show the
section for supported types.
2022-09-08 16:36:00 +02:00
8f6a38ed7e Cleanup: Simplify outliner context menu building queries
- Remove unnecessary calls to `get_element_operation_type()` (result
  wasn't used).
- Remove branches/checks for cases that couldn't possibly happen.
  (assert instead).
- Ensure all return arguments are set so caller can't make the mistake
  of forgetting that.
- Early exit instead of big `if` block.
- Use `const`.
2022-09-08 16:36:00 +02:00
406243c2fd IDManagement: change IDTypeInfo.owner_get to instead return address of the owner_id pointer.
Also rename the callback. That way, we can keep moving toward a more
generic handling of those embedded IDs (think e.g. about copy code).
2022-09-08 16:34:31 +02:00
462014b59b IDManagement: Add new BKE_id_owner_get accessor.
Essentially calls `IDTypeInfo->owner_get` for now, will make more sense
once the callback is changed to return the address of the pointer
instead.
2022-09-08 16:34:31 +02:00
4ac69c26db Fix Cycles wrong MIS logic in shade_light kernel after recent changes
Though end result was still correct. Thanks to Alaska for spotting this.
2022-09-08 15:23:21 +02:00
173d8edb0b Cleanup: make meaning of base visibility flags more clear
Rename, add comments, and use flag in the depsgraph to ensure the logic
matches.

Differential Revision: https://developer.blender.org/D15883
2022-09-08 15:23:21 +02:00
b5fc8f611e Outliner: Hide ID type filter for library overrides
a) There were two filter icons next to each other in the header which
isn't exactly professional, b) the filter was redundant since IDs are
now grouped under an ID type element ("Objects", "Collection", ...)
anyway.
In the hierarchies view it was already hidden (because the whole point
of it is to show relationships between IDs, you wouldn't want to have
any parts of the hierarchy hidden).
2022-09-08 14:19:59 +02:00
2a769e76a0 Outliner: Hide search options for library overrides hierarchies view
Searching isn't possible in the hierarchies view anymore, so the options
for it shouldn't be displayed either.
Followup to 21b92a5f31, forgot to remove these.
2022-09-08 14:10:58 +02:00
21b92a5f31 Outliner: Hide search button for library overrides hierarchies view
c9a9967903 added a workaround for performance issues in heavy
production scenes in the library overrides hierarchies view, reducing
the amounts of elements to be built. Searching for elements would still
have to build the entire tree, so Blender would essentially freeze when
searching in mentioned heavy scenes. Removing the search functionality
works around this issue for now.
2022-09-08 12:54:49 +02:00
d481fb10ef Nodes: fix handling cyclic node trees 2022-09-08 12:54:00 +02:00
5e2d139ee3 Fix Blender as a Python module for WIN32
BKE_appdir_program_path_init would override the module path extracted
from the Python module, replacing it with the Python executable.

This caused the data files not to be found and the module not to load.
2022-09-08 20:32:57 +10:00
82fc52ffc8 Console: Support page up/down and home keys for scrolling
- Page up/down scrolls up/down an entire page
- Home resets the scrolling back to the bottom.

The fact that these were missing was probably an oversight. Other
similar editors have them.

This works by including the "View2D Buttons List" keymap for the
console, which the other similar editors use as well.
2022-09-08 12:27:42 +02:00
129993c026 Fix T100887: Some C++ importers/exporters (e.g. OBJ) reset file dialog Sort By mode
A couple years ago D8598 made it so that C++ operators generally
should use "default" sort mode, which remembers previously used sort
setting. Back then all the places that needed it got changed to use
this "default" one, but since then some more IO code landed, where
seemingly by accident it used "sort by file name":

- USD importer,
- Grease Pencil exporter,
- OBJ importer & exporter,
- STL importer.

Reviewed By: Julian Eisel
Differential Revision: https://developer.blender.org/D15906
2022-09-08 13:07:31 +03:00
268e1eff8a Fix T96297: obj: improve layout of UI fields and axis validation
Implement ideas from T96297:
- Fix "invalid axis settings" (both forward & up along the same
  direction) validation: now similar to the Python based code, when
  invalid axis is applied, the other axis is changed to not conflict.
- Make axis enums be expanded inside the row, similar to Collada UI.
- Move "selected only" near the top, similar to how it's in Collada,
  USD, FBX and glTF export UIs.
- Move animation export options to the bottom.
2022-09-08 11:43:47 +03:00
ecf3287533 Fix T100822: Merging objects does not assign materials correctly
Caused by {rBf1c0249f34c4}

This is what (I think) went wrong in the above commit:
- `join_mesh_single` was writing material indices to the custom data /
attribute of the source mesh
- the `polyofs` of each mesh that was joined was not taken into account

Now, instead of using the AttributeWriter on a particular mesh, use the
CustomData (`pdata`) - that is constantly changed during joining -
directly for writing.
Otherwise we end up writing into customdata that has not been "extended"
yet (even if we use the destination mesh).
Also note that even on the destination mesh, CustomData would be freed
anyways after all calls to `join_mesh_single` took place, to be replaced
with the mentioned `pdata` which should be the single customdata to
write to here.

When doing this (writing to `pdata`), we also need to take into account
the poly offset of each contributing mesh.

Maniphest Tasks: T100822

Differential Revision: https://developer.blender.org/D15878
2022-09-08 09:06:50 +02:00
a3ddcc6b4d Cleanup: correct PyModuleDef.m_slots reference
Changed in Python 3.5, match Python's internal name.
2022-09-08 15:32:33 +10:00
8a9d1f19ab Python: ensure the runtime version is compatible WITH_PYTHON_MODULE
When Blender is built as a Python module, exit early if the major
and minor versions don't match. Without this, the error message can
be cryptic/unhelpful.
2022-09-08 14:58:16 +10:00
9f50bd20eb Fix: Spreadsheet row filters unimplemented for boolean type
This was lost in 474adc6f88
2022-09-07 23:31:46 -05:00
d593497421 Cleanup: Use C++ methods to retrieve attribute accessors
Replace `mesh_attributes`, `mesh_attributes_for_write` and the point
cloud versions with methods on the `Mesh` and `PointCloud` types.
This makes them friendlier to use and improves readability.

Differential Revision: https://developer.blender.org/D15907
2022-09-07 21:41:39 -05:00
17bc292530 Cleanup: remove ED_types.h & ACTIVE, DESELECT definitions
- ACTIVE flag is no longer in use.

- DESELECT was used in some places as an alias for false,
  even though this could arguably help readability, in practice this
  was often passed with a selection flag leading to confusing calls
  such as `select_beztriple(bezt, DESELECT, SELECT, HIDDEN)`.
  Replace SELECT/DESELECT with true/false in these cases.

- Remove ED_types.h. Add a 'SELECT' definition to DNA_anim_types.h,
  for fcurve_test, we could use a shared DNA header, or remove use of
  the define entirely in favor of typed enums.
2022-09-08 12:08:20 +10:00
c2c369ebe6 Cleanup: prefer terms verts/polys over vertices/polygons
Follows existing naming for the most part, also use "num" as a suffix
in some instances (following our naming conventions).
2022-09-08 11:34:02 +10:00
c36c403cdb Cleanup: Removed handling of unused flag in TimeMarkers
This removes the defunct handling of the ACTIVE flag in
TimeMarker::flags. It's not possible for that flag to be set though
normal operation.

Differential Revision: https://developer.blender.org/D15828
2022-09-07 18:13:05 -07:00
0a32f6b76a Fix T100863, T100875: Vertex group reading broken for recent files
This patch consists of two related fixes. The first is a simple fix for
forward compatibility, setting the Mesh.dvert pointer when writing a
file allows old Blender versions to read vertex groups from newly saved
files.

The second part is a bit uglier and more complex. Normally mesh vertex
group data is read in mesh_blend_read_data, for backward compatibility
with very old files. However, after 05952aa94d the mesh.dvert
pointer was not set, so the data was not read. Reading vertex group
layers when reading custom data is enough to fix that issue. We need to
read the data from *both* places, but BKE_defvert_blend_read cannot run
twice without memory leaks, so first try reading from custom data, then
read the pointer if that fails.

Differential Revision: https://developer.blender.org/D15905
2022-09-07 14:33:29 -05:00
e53405bf15 UI: Small Adjustments to Event Icons
Minor adjustments to event icons required after recent font changes.

See D15582 for more details and examples.

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

Reviewed by Brecht Van Lommel
2022-09-07 08:06:29 -07:00
67dcdebb3a Fix T100669: OBJ exporter does not properly export image sequence texture names
When exporting OBJ/MTL animation, texture file paths of image
sequences were not adjusted to contain the correct frame number.
Fixes T100669.

Also, the OBJ exporter was wrongly writing to the same .mtl file
for each exported frame, which is a regression compared to the
legacy Python exporter.
2022-09-07 17:56:21 +03:00
715d185dcd DRW: update test 'draw_pass_all_commands'
It was incorrectly updated in rBc226c480079fc07e3784f673b1bac4a774fe7937
2022-09-07 08:51:05 -03:00
da0c3cdbc9 DRW: fix 'bind_texture' being called in place of 'bind_image'
Error pointed out by tests.
2022-09-07 08:51:05 -03:00
967664d1ee BLI: new C++ BitVector data structure
This adds a new `blender::BitVector` data structure that was requested
a couple of times. It also replaces usages of `BLI_bitmap` in C++ code.

See the comment in `BLI_bit_vector.hh` for more details about the
advantages and disadvantages of using a bit-vector and how the new
data structure compares to `std::vector<bool>` and `BLI_bitmap`.

Differential Revision: https://developer.blender.org/D14006
2022-09-07 13:15:34 +02:00
13a7516f43 Cleanup: factor out "set default filepath" into a ED_fileselect_ensure_default_filepath
Follow up to D15904, a bunch of places had exact same logic for
"is filepath set? if not, set some default one", so factor all that out
into a separate ED_fileselect_ensure_default_filepath function.
2022-09-07 13:27:27 +03:00
97bd04d665 Fix T100797: C++ exporters do not remember the path on subsequent exports
Most/all C++ based IO code had a pattern of doing using
RNA_struct_property_is_set to check whether a default path needs to
be set. However, it returns false for properties restored from
"previous operator settings" (property restoration code sets
IDP_FLAG_GHOST flag on them, which "is set" sees and goes
"nope, not set").

The fix here is to apply similar logic as 10 years ago in the
T32855 fix (rBdb250a4): use RNA_struct_property_is_set_ex instead.

Reviewed By: Campbell Barton
Differential Revision: https://developer.blender.org/D15904
2022-09-07 12:57:34 +03:00
788952705c IDManagement: Add some assert to ensure lib consistency in embedded IDs.
From re-checking related code, it seems that we already always ensure
consistency of the `lib` pointer between embedded IDs and their owners.

This commit only adds some asserts in ambedded ID read code to
double-check this.
2022-09-07 11:26:11 +02:00
46642507ae Geometry Nodes: improve printing geometry set for debugging 2022-09-07 10:43:46 +02:00
ab5d0d2df3 Cleanup: Remove some references to proxies in comments/log messages.
Note that there are still some references to proxies left, in some cases
it's unclear if the code related to the comment is even still relevant,
this goes beyond mere cleanup to address then.
2022-09-07 10:27:20 +02:00
17d8028181 Nodes: add owner_tree method to nodes 2022-09-07 10:24:51 +02:00
2b43173fa9 Fix T100862: only leading deform modifiers used in weight/vertex paint.
It turns out upon close inspection that the 'deform only' mesh
only includes leading deform modifiers, rather than all of them
like crazyspace evaluation. This reduces the effect of the change
in rB9823a8f72be8 to using the fully evaluated mesh (all modifiers)
when the whole stack resulted in no topology change.
2022-09-07 11:10:41 +03:00
ddfd2b7644 Cleanup: comment unused INPUTCHANGE event 2022-09-07 16:34:44 +10:00
b5837bc948 WM: don't clear modifiers when the window is de-activated
Leave the modifiers as they were so comparing with previous modifiers
on window re-activation isn't detected as a state change.
2022-09-07 16:18:06 +10:00
8c8c102980 Fix T40059: Switching windows ignores held modifier keys
Re-enable workaround (USE_WIN_ACTIVATE) which should no longer cause
problems as of [0].

[0]: 37d835f0bc
2022-09-07 16:07:47 +10:00
857639559c CMake: add missing headers 2022-09-07 15:14:50 +10:00
3f5505b4cb Cleanup: de-duplicate bounding box center calculation 2022-09-07 15:14:50 +10:00
adb746415f Cleanup: add sections, use float literals 2022-09-07 15:14:50 +10:00
bd2b50dfa8 Cleanup: sort cmake file lists 2022-09-07 15:14:50 +10:00
7c52f18f15 Cleanup: format 2022-09-07 15:14:49 +10:00
124655547c Cleanup: GHOST/Win32 drop
- Reduce variable scope.
- Use snake-case for variables.
- Remove unnecessary counter when building file-list.
- Remove break after return.
- Use early return.
- Add missing braces.
2022-09-07 15:14:49 +10:00
be038b844c Cleanup: Tweak naming for recently added mesh accessors
Use `verts` instead of `vertices` and `polys` instead of `polygons`
in the API added in 05952aa94d. This aligns better with
existing naming where the shorter names are much more common.
2022-09-07 00:06:31 -05:00
20daaeffce UV: add new operator, uvcalc_align_rotation
Adds a new operator to automatically rotate UV Islands into alignment.

Modes:
* Auto (All edges)
* Geometry (V direction will point in geometry direction) [1]
* Edge (Rotate until selected edge is in V direction)

Also adds uv_sync_selection support to UV Randomize Transform.

Resolves: T78399
Differential Revision: https://developer.blender.org/D15820

[1] Listed as "World" in Task description.
2022-09-07 16:26:32 +12:00
18d1ef46f2 Cleanup: rename internal types for GHOST/Wayland
- Use pascel-case type names, instead of snake-case with `_t` suffix.
- Use `GWL_` prefix (short for GhostWayLand), to distinguish these
  types from ghost (`GHOST_*`) and wayland (`wl_*`) types.
- Rename `input` to `seat` (following wayland's own terminology).
- Use `wl_` prefix for wayland native variables which have locally
  defined equivalents so `GWL_Output *output` isn't confused with
  `struct wl_output *wl_output`. As the locally defined types are used
  more often this is less verbose overall.
2022-09-07 14:04:01 +10:00
ef46f5399b GHOST/Wayland: correct logging ID 2022-09-07 13:07:13 +10:00
da3d1e9165 Cleanup: spelling in comments, correct doxy slashes, replace '/w' 2022-09-07 13:04:44 +10:00
a5d65200c2 Cleanup: unused argument warning 2022-09-07 13:04:44 +10:00
ffc0e4d410 Fix building with MSVC
Correct error from [0] which built with GCC.

[0]: b8d9864518
2022-09-07 13:04:44 +10:00
b8d9864518 Cleanup: remove unused Main argument to RNA_path functions
Note that lib_override functions have kept the unused argument,
but this may be removed too. It impacts many lib_override functions
so this can be handled separately.
2022-09-07 11:07:44 +10:00
9c4c9a889d Cleanup: use 'continue' in customdata for loop, reduce right shift 2022-09-07 09:02:59 +10:00
Lukas Stockner
6951e8890a Mikktspace: Optimized port to C++
This commit is a big overhaul to the Mikktspace module, which is used
to compute tangents. I'm not calling it a rewrite since it's the
result of a lot of iterations on the original code, but pretty much
everything is reworked somehow.

Overall goal was to a) make it faster and b) make it maintainable.

Notable changes:
- Since the callbacks for requesting geometry data were a big
  bottleneck before, I've ported it to C++ and made it header-only,
  templating on the data source. That way, the compiler generates code
  specific to the caller, which allows it to inline the data source and
  specialize for some cases (e.g. subd vs. non-subd in Cycles).
- The one input parameter, an optional angle threshold, was not used
  anywhere. Turns out that removing it allows for considerable
  algorithmic simplification, removing a lot of the complexity in the
  later stages. Therefore, I've just removed the option in the new code.
- The code computes several outputs, but only one (the tangent itself)
  is ever used in Blender. Therefore, I've removed the others to
  simplify the code. They could easily be brought back if needed, none
  of the algorithmic simplifications are conflicting with them.
- The original code had fallback paths for many steps in case temporary
  memory allocation fails, but that never actually gets used anyways
  since malloc() doesn't really ever return NULL in practise, so I
  removed them.
- In general, I've restructured A LOT of the code to make the
  algorithms clearer and make use of some C++ features (vectors,
  std::array, booleans, classes), though there's still some of cleanup
  that could be done.
- Parallelized duplicate detection, neighbor detection, triangle
  tangent computation, degenerate triangle handling and tangent space
  accumulation.
- Replaced several algorithms with faster equivalents: Duplicate
  detection uses a (concurrent) hash set now, neighbor detection uses
  Radixsort and splits vertices by index pairs etc.

As for results, the exact speedup depends on the scene of course, but
let's consider the file from T97378:
- Blender 3.1 (before D14675): 6.07sec
- Blender 3.2 (with D14675): 4.62sec
- rBf0a36599007d (last nightly build): 4.42sec
- With this commit: 0.90sec

This speedup will mostly be noticed at the start of Cycles renders and,
even more importantly, in Eevee when doing something that changes the
geometry (e.g. animating) on a model using normal maps.

Differential Revision: https://developer.blender.org/D15589
2022-09-07 00:35:44 +02:00
Lukas Stockner
6b6428fcbc Cleanup: Move (edit)mesh_tangent.c to C++
This changes the two tangent-related files in BKE to C++ in preparation for the C++ Mikktspace port in D15589.
For now, they still use the original Mikktspace.

Differential Revision: https://developer.blender.org/D15636
2022-09-07 00:24:42 +02:00
043f59cb3b Fix weight paint smoothing with vertex selection.
Broken in rB2480b55f216c3137 by incorrectly converting a boolean
expression. There is also another suspect expression nearby.
2022-09-06 23:02:55 +03:00
2636f6fdee Fix T100760: No color attribute initialization when created by brush
Caused by 25237d2625.
2022-09-06 14:46:14 -05:00
f94130c94b Fix T100854, T100856: Invalid shape keys when exiting edit mode
The `mvert` pointer was passed to `bm_to_mesh_shape` and was never
reset to the beginning of the vertex array. Use spans instead to
eliminate this error completely. This also has the benefit of letting
the CustomData system handle allocation of mesh layers.
2022-09-06 14:25:48 -05:00
ced56dbc53 Fix: Restore fix for empty attributes after recent commit
3484c6d4f1 removed parts of 6e5eb46d73 by mistake,
returning no attribute when attribute data wasn't found. However, we
want that attributes can exist even on empty geometry. This commit
restores the fix and tries to make it more explicit to avoid the same
mistake again.

Differential Revision: https://developer.blender.org/D15899
2022-09-06 13:23:41 -05:00
Sonny Campbell
394c0b5ae4 Fix T99141: Crash with edit mode and copy location constraint
The constraint attempted to access mesh normals on a mesh with
wrapper type ME_WRAPPER_TYPE_BMESH. This commit reverses the if
statements so that If there is an editmesh then we use that as the
source of truth - otherwise use the evaluated mesh.

Differential Revision: https://developer.blender.org/D15809
2022-09-06 13:09:01 -05:00
e3ef6a6660 Cleanup: Return early 2022-09-06 12:14:04 -05:00
545fb528d5 Cleanup: Avoid using runtime node flag, use topology cache
It's easier to keep track of state in these algorithms if it's stored in
a central place like a set. Plus, using flags requires clearing them
beforehand. For the selected linked operators, using the topology
cache means we don't have to iterate over all links.
2022-09-06 12:14:04 -05:00
1d24586a90 Cleanup: Move select all nodes code to operator
This more specific high level functionality isn't needed
elsewhere. Move it to the operator and clean it up a bit.
2022-09-06 12:14:03 -05:00
2d38768f89 Cleanup: Use more specific function for deselecting all nodes 2022-09-06 12:14:03 -05:00
ff17131109 Fix T100841: Creating a frame node with shortcut doesn't sort nodes
Before 58c650a44c, the nodes span was rebuilt on every redraw. Now
that it's only rebuilt as necessary, we need to tag it dirty when nodes
are reordered. Relying on the order of the nodes at all isn't ideal, but
it's fairly fundamental in many areas at the moment.
2022-09-06 12:14:03 -05:00
6830ba12a8 Cleanup: Remove unnecessary node sorting, rename variables
Changing node colors shouldn't change the output of `node_sort`.
2022-09-06 12:14:03 -05:00
6d08ba8a50 Fix T100824: Cycles GPU render broken on macOS 13 Beta and Apple silicon
The recent revert of Apple silicon inlining changes to avoid long compile times
worked on macOS 12, but in macOS 13 Beta it results in render errors. This may
be a compiler bug and perhaps get fixed in time, but try to be on the safe side
and ensure Blender 3.3.0 works regardless.

This brings part of the inlining back, which brings improved performance but
also longer compiler times again. Compile time is around 2min now, where the
previous full inlining was about 5-7min.

Patch by Michael Jones.

Differential Revision: https://developer.blender.org/D15897
2022-09-06 19:11:52 +02:00
da9e685e26 Fix T100823: Do Not Load Non-Scalable Fonts
Do not allow the loading of old-style non-scalable fonts.

See D15884 for more details.

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

Reviewed by Brecht Van Lommel
2022-09-06 09:48:41 -07:00
0c242ff72b Cleanup: IDManagement: Simplify owner_get calllback of IDTypeInfo.
Now that all embedded IDs have a loopback pointer to their owner, we do
need anymore extra parameters for this accessor.
2022-09-06 18:21:16 +02:00
e46687c3aa Address to some extent issues with invalid embedded IDs in existing files.
Many existing .blend files (including startup ones) seem to have invalid
embedded IDs (they are not properly tagged with `LIB_EMBEDDED_DATA`).

We cannot `do_version` this so just fix it on the fly when detecting the
issue. User then need to re-save these files.

We also need to update some release files (default factory startup is
OK, but e.g. the VSE template one is not).

Keeping the assert is important here, as such missing flag is a critical
data corruption that can potentially have many serious consequences
throughout the ID management code.
2022-09-06 18:01:53 +02:00
e047b2618a BLI: Add new blender::Pool container
A `blender::Pool` can construct and destruct elements without reordering. Freed items memory
will be reused by next allocations.

Elements are allocated in chunks to reduce memory fragmentation and avoid reallocation.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D15894
2022-09-06 17:51:25 +02:00
0759f671ce Fix T100824: Cycles GPU render broken on macOS 13 Beta and Apple silicon
The recent revert of Apple silicon inlining changes to avoid long compile times
worked on macOS 12, but in macOS 13 Beta it results in render errors. This may
be a compiler bug and perhaps get fixed in time, but try to be on the safe side
and ensure Blender 3.3.0 works regardless.

This brings part of the inlining back, which brings improved performance but
also longer compiler times again. Compile time is around 2min now, where the
previous full inlining was about 5-7min.

Patch by Michael Jones.

Differential Revision: https://developer.blender.org/D15897
2022-09-06 17:39:08 +02:00
3484c6d4f1 Cleanup: Remove unused update custom data pointers in attribute API
Unused after 05952aa94d, 410a6efb74, and e9f82d3dc7.
2022-09-06 09:43:32 -05:00
64b10c43c4 Blender 3.3 release version bump.
Branch is frozen now and in Bcon5.
2022-09-06 16:34:45 +02:00
e3afead9aa Fix (unreported) bad handling of embedded IDs on owner copying.
Completely forgot in rBcd49fee74114 to handle the owner ID copying case
(this code now also needs to re-assign to `owner_id` pointer of the
newly copied embedded IDs to their rightful owner).
2022-09-06 16:23:06 +02:00
6f80c60ce6 Fix T100850: Regression: Gpencil: crash on material color and other properties change.
rBcd49fee74114 forgot to add proper support for calls to `ntreeAddTree`
with a NULL Main (which should generate `NO_MAIN` ntrees).
2022-09-06 16:23:06 +02:00
3dd9ab341a IDManagement: better debug checks in owner_get callbacks.
Simplify and make more efficients checks in collection one (missed
these in yesterday's commit rBcd49fee74114), add some to ShapeKey's one.
2022-09-06 16:23:06 +02:00
987c3a3e22 Merge branch 'blender-v3.3-release' 2022-09-06 16:17:34 +02:00
Josh Whelchel
74477149dd Fix T100845: wrong Cycles OptiX runtime compilation include path
Causing OptiX kernel build errors on Arch Linux.

Differential Revision: https://developer.blender.org/D15891
2022-09-06 16:11:12 +02:00
d9ea72291f Fix T100842: Display Texture Paint UVs option in UV editor not working
In 8cf52e8226 we assumed that the UV IBO's are only needed in edit mode,
however the UV lines also need to work in texture paint mode. So prefer to
use bmesh when available to fix the original bug, but don't assume the face
is hidden when there is no bmesh.

Differential Revision: https://developer.blender.org/D15895
2022-09-06 16:08:30 +02:00
e1fbb4ce89 Merge branch 'blender-v3.3-release' 2022-09-06 15:39:12 +02:00
8b11ed392c Cycles: Fix crashes in oneAPI backend for scenes not fitting in dGPU memory
Differential Revision: https://developer.blender.org/D15889
2022-09-06 15:38:15 +02:00
c226c48007 Update DRW tests
And remove retest of `GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR`.
2022-09-06 08:43:40 -03:00
b23fceff7d GPU/DRW: Fix test
Regression introduced in rB755e728a9840
2022-09-06 13:20:54 +02:00
dd41dda80e Merge branch 'blender-v3.3-release' 2022-09-06 11:53:44 +02:00
25c8d72e20 Fix T100747: Cannot add "String" attribute to mesh
Caused by {rB31365c6b9e4c}.

The new API `CustomDataAttributeProvider` just did not support
`CD_MASK_PROP_STRING`.

While strings dont perform nicely in their current form, still add
support back for the API.

Adding Strings to the supported types seems to survive just
fine, see attached example file.

Maniphest Tasks: T100747

Differential Revision: https://developer.blender.org/D15851
2022-09-06 11:44:07 +02:00
397e5c5526 GL: Require a minimum of 8 ssbo slot per shader stage
Otherwise we disable this feature. This is because some driver
does not support any vertex storage buffers but still support
8 ssbo in fragment shader.
2022-09-06 11:12:38 +02:00
d7a67e245d DRW: remove consistent debug buffer bind
This avoids the overhead of debug drawing when not debugging
anything or even not using the new draw manager.
2022-09-06 11:12:38 +02:00
6602f30225 Cleanup: early exit when the active layer disallows procedural access
Once the active layer index is reached, there is no need to keep
searching. Return early instead.
2022-09-06 17:16:04 +10:00
3ebf6a7f38 Cleanup: Remove use of designated initializers in C++ code
Does not compile on Windows.
2022-09-06 18:31:01 +12:00
6c6a53fad3 Cleanup: spelling in comments, formatting, move comments into headers 2022-09-06 16:25:20 +10:00
077ba5ac38 ShaderBuilder: Fix compilation error due to recent changes.
Added CustomData_get_layer to stub.
2022-09-06 08:18:04 +02:00
Jason Fielder
32d19f7317 MacOS: Resolve purple rendering artifacts in EEVEE materials by increasing sampler limit.
Enables a feature flag during OpenGL device initialisation on macOS, which increases the available number of texture samplers available for use within shaders. Enabling this flag removes purple rendering artifacts present in certain EEVEE materials, when the existing limit of 16 is exceeded.

This feature flag is supported on Apple Silicon and AMD GPUs, for devices supporting macOS 11.0+. Device initialisation first tests whether GL device creation with the flag is supported, if not, we fall back to standard initialisation.

Other solutions would not be trivial or incur additional performance overhead or feature limitations. Other workarounds, such as texture atlas's, could already be created by artists.

{F13245498}

{F13245497}

Reviewed By: jbakker

Maniphest Tasks: T57759, T63935

Differential Revision: https://developer.blender.org/D15336
2022-09-06 08:08:07 +02:00
d9db79dbe5 Cleanup: Move uvedit_islands to c++
Differential Revision: https://developer.blender.org/D15870
2022-09-06 15:52:26 +12:00
f0a3659900 GPU: remove 'GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR'
The only difference between `GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR`
and `GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR` is that in the vertex
shader the 2D version uses `vec4(pos, 0.0, 1.0)` and the 3D version
uses `vec4(pos, 1.0)`.

But VBOs with 2D attributes work perfectly in shaders that use 3D
attributes. Components not specified are filled with components from
`vec4(0.0, 0.0, 0.0, 1.0)`.

So there is no real benefit to having two different shader versions.
2022-09-05 19:01:02 -03:00
755e728a98 GPU: remove 'GPU_SHADER_3D_IMAGE_MODULATE_ALPHA'
`GPU_SHADER_3D_IMAGE_MODULATE_ALPHA` can be seamlessly replaced by
`GPU_SHADER_3D_IMAGE_COLOR` with no real harm done.
2022-09-05 18:11:35 -03:00
1fcc673230 Cleanup: Remove unused function
This had a specific use case relating to the `CurveEval` type
which shouldn't be necessary anymore.
2022-09-05 15:48:47 -05:00
5763918651 GPU: convert 'GPU_SHADER_2D_IMAGE_COLOR' to 3D
3D shaders work in both 2D and 3D viewports.

This shader is a good candidate to be exposed in Python.
2022-09-05 17:34:10 -03:00
4536de98d1 GPU: remove 'GPU_SHADER_2D_SMOOTH_COLOR'
The only real difference between `GPU_SHADER_2D_SMOOTH_COLOR` and
`GPU_SHADER_3D_SMOOTH_COLOR` is that in the vertex shader the 2D
version uses `vec4(pos, 0.0, 1.0)` and the 3D version uses
`vec4(pos, 1.0)`.

But VBOs with 2D attributes work perfectly in shaders that use 3D
attributes. Components not specified are filled with components from
`vec4(0.0, 0.0, 0.0, 1.0)`.

So there is no real benefit to having two different shader versions.

This will simplify porting shaders to python as it will not be
necessary to use a 3D and a 2D version of the shaders.

In python the new name for '2D_SMOOTH_COLOR' and '3D_SMOOTH_COLOR'
is 'SMOOTH_COLOR', but the old names still work for backward
compatibility.
2022-09-05 16:34:05 -03:00
0c3953d545 GPU: remove 'GPU_SHADER_2D_IMAGE'
The only real difference between `GPU_SHADER_2D_IMAGE` and
`GPU_SHADER_3D_IMAGE` is that in the vertex shader the 2D
version uses `vec4(pos, 0.0, 1.0)` and the 3D version uses
`vec4(pos, 1.0)`.

But VBOs with 2D attributes work perfectly in shaders that use 3D
attributes. Components not specified are filled with components from
`vec4(0.0, 0.0, 0.0, 1.0)`.

So there is no real benefit to having two different shader versions.

This will simplify porting shaders to python as it will not be
necessary to use a 3D and a 2D version of the shaders.

In python the new name for '2D_IMAGE' and '3D_IMAGE'
is 'IMAGE', but the old names still work for backward
compatibility.
2022-09-05 16:34:05 -03:00
baf2835ff7 GPU: remove 'GPU_SHADER_2D_FLAT_COLOR'
The only real difference between `GPU_SHADER_2D_FLAT_COLOR` and
`GPU_SHADER_3D_FLAT_COLOR` is that in the vertex shader the 2D
version uses `vec4(pos, 0.0, 1.0)` and the 3D version uses
`vec4(pos, 1.0)`.

But VBOs with 2D attributes work perfectly in shaders that use 3D
attributes. Components not specified are filled with components from
`vec4(0.0, 0.0, 0.0, 1.0)`.

So there is no real benefit to having two different shader versions.

This will simplify porting shaders to python as it will not be
necessary to use a 3D and a 2D version of the shaders.

In python the new name for '2D_FLAT_COLOR'' and '3D_FLAT_COLOR'
is 'FLAT_COLOR', but the old names still work for backward
compatibility.
2022-09-05 16:34:05 -03:00
223665b994 GPU: remove 'GPU_SHADER_2D_UNIFORM_COLOR'
The only real difference between `GPU_SHADER_2D_UNIFORM_COLOR` and
`GPU_SHADER_3D_UNIFORM_COLOR` is that in the vertex shader the 2D
version uses `vec4(pos, 0.0, 1.0)` and the 3D version uses
`vec4(pos, 1.0)`.

But VBOs with 2D attributes work perfectly in shaders that use 3D
attributes. Components not specified are filled with components from
`vec4(0.0, 0.0, 0.0, 1.0)`.

So there is no real benefit to having two different shader versions.

This will simplify porting shaders to python as it will not be
necessary to use a 3D and a 2D version of the shaders.

In python the new name for '2D_UNIFORM_COLOR'' and '3D_UNIFORM_COLOR'
is 'UNIFORM_COLOR', but the old names still work for backward
compatibility.

Differential Revision: https://developer.blender.org/D15836
2022-09-05 16:34:05 -03:00
cec67176b1 GPencil: Use correct index for start point and refactor update
The last commit offset the start point by 1.

Also, remove the update because is better to do this in each operator that need it.
2022-09-05 20:19:35 +02:00
d26a0be968 UI: Corrected Scaling of AREAMINX
Minimum horizontal area size should be scaled by UI resolution.

See D15865 for more details.

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

Reviewed by Brecht Van Lommel
2022-09-05 10:37:15 -07:00
258d385857 Cleanup: Unused variable, compiler warning 2022-09-05 12:02:21 -05:00
05952aa94d Mesh: Remove redundant custom data pointers
For copy-on-write, we want to share attribute arrays between meshes
where possible. Mutable pointers like `Mesh.mvert` make that difficult
by making ownership vague. They also make code more complex by adding
redundancy.

The simplest solution is just removing them and retrieving layers from
`CustomData` as needed. Similar changes have already been applied to
curves and point clouds (e9f82d3dc7, 410a6efb74). Removing use of
the pointers generally makes code more obvious and more reusable.

Mesh data is now accessed with a C++ API (`Mesh::edges()` or
`Mesh::edges_for_write()`), and a C API (`BKE_mesh_edges(mesh)`).

The CoW changes this commit makes possible are described in T95845
and T95842, and started in D14139 and D14140. The change also simplifies
the ongoing mesh struct-of-array refactors from T95965.

**RNA/Python Access Performance**
Theoretically, accessing mesh elements with the RNA API may become
slower, since the layer needs to be found on every random access.
However, overhead is already high enough that this doesn't make a
noticible differenc, and performance is actually improved in some
cases. Random access can be up to 10% faster, but other situations
might be a bit slower. Generally using `foreach_get/set` are the best
way to improve performance. See the differential revision for more
discussion about Python performance.

Cycles has been updated to use raw pointers and the internal Blender
mesh types, mostly because there is no sense in having this overhead
when it's already compiled with Blender. In my tests this roughly
halves the Cycles mesh creation time (0.19s to 0.10s for a 1 million
face grid).

Differential Revision: https://developer.blender.org/D15488
2022-09-05 11:56:34 -05:00
63cfc8f9f6 Cleanup: Fix unused variable warnings 2022-09-05 11:28:30 -05:00
70da5a1434 Cleanup: Remove unused code for VSE waveform drawing 2022-09-05 17:49:46 +02:00
7f70b99584 Fix VSE: accidentally commented out code
`DEG_id_tag_update` was commented out in `sequencer_meta_toggle_exec()`.
Tagging does not affect functionality now, but it should be done.
2022-09-05 17:49:46 +02:00
Germano Cavalcante
89abc14d6c Fix T81002: Images drawn with the Python gpu module no longer draw on top in the Image Editor
This reverts commit 32d4a67017 thus fixing T81002 again.

And in order not to break T81212 (again) a different fix was implemented.


Reviewed By: brecht

Differential Revision: https://developer.blender.org/D15840
2022-09-05 12:35:42 -03:00
44619eaa32 Cleanup: make format 2022-09-05 17:25:05 +02:00
39a3d312c1 GPencil: Fix bug in set start api function
The point of the second stroke was duplicated.
2022-09-05 17:10:42 +02:00
191872a836 GPencil: Improve previous commit error checking
Better check if the strokes has more points. 

A 0 or 1 point stroke never need to set start point.
2022-09-05 17:08:23 +02:00
ffe4840c2b Cleanup: Add parameter auto_flip documentation 2022-09-05 17:04:23 +02:00
5b2720befc GPencil: Small code cleanup 2022-09-05 17:01:35 +02:00
Bastien Montagne
cd49fee741 IDMAnagement: Add owner ID pointer to embedded ones.
Add a dedicated `owner_id` pointer to ID types that can be embedded
(Collections and NodeTrees), and modify slightly come code to make
handling those more safe and consistent.

This implements first part of T69169.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D15838
2022-09-05 16:12:54 +02:00
dd19d6456a EEVEE: Fix attributes node on Alpha Clip/Hashed materials
This was cause by a missing implementation of some post
processing attribute functions. Leading to unresolved reference.
2022-09-05 16:03:30 +02:00
Damien Picard
19b9ea72b0 I18n: extract keymap preferences
The per-keymap user preferences messages were not extracted. This goes
through the keymap preferences RNA, as well as Python files for UI.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15871
2022-09-05 15:37:09 +02:00
Damien Picard
dead26b577 I18n: translate untitled file names
When saving, the default file name is "untitled" regardless of
selected language. This can be translated, like many graphical
applications do.

This applies to:
- blend file
- alembic file
- collada file
- obj file
- usd file
- rendered image
- grease pencil export
- subtitles export
- other Python exports through ExportHelper

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15868
2022-09-05 15:29:20 +02:00
f70cf451ed Merge branch 'blender-v3.3-release' 2022-09-05 15:21:49 +02:00
141d5cac3a GPencil: Move Outline operator in menu
Reviewed by: Matias Mendiola
2022-09-05 15:20:20 +02:00
8000d52684 Fix T100796: wrong tangents on bezier splines with duplicate points and handles
Differential Revision: https://developer.blender.org/D15880
2022-09-05 15:20:18 +02:00
Damien Picard
a2a208d88d I18n: fix translation of status bar
- Use the proper context (Operator, since that is what the cursor
  keymap status uses)
- Add a few missing message extraction tags

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15867
2022-09-05 15:19:04 +02:00
fbf875a3da GPencil: Move Scale Thickness option in menu
The option is more logic in the Normalize group

Reviewed by: Matias Mendiola
2022-09-05 15:16:42 +02:00
404e75c165 Merge branch 'blender-v3.3-release' 2022-09-05 15:07:47 +02:00
1b216fc237 Fix T100814: Cycles wrong area light parametric texture coordinates
The fix from cefd6140f3 was for light intersection, but light sampling also
needs it.

Differential Revision: https://developer.blender.org/D15879
2022-09-05 13:25:50 +02:00
871347fd93 Fix Cycles not rendering hair without radius attributes
This was fixed in 8159e0a but accidentally reverted as part of 18b703d
2022-09-05 11:38:32 +02:00
38508f5110 GPencil: New BKE function to set stroke start point
This function allows to set the start point for cyclic strokes.

The function is required by a new modifier and operator
that are currently under development.
2022-09-05 11:03:12 +02:00
91b1ca5b7b Fix T100820: Crash renaming modifier with visibility driver 2022-09-05 10:41:15 +02:00
472d8f8e92 Merge branch 'blender-v3.3-release' 2022-09-05 10:06:31 +02:00
Clément Foucault
3ae996c293 Fix T100649: Regression: Environment texture is stretched when added to mesh
The new code was not using the correct default attribute. Add access to
`g_data.P` through `node_tex_coord_position()` to replace the old
`GPU_builtin(GPU_VIEW_POSITION)` which was used before.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D15862
2022-09-05 09:21:02 +02:00
Clément Foucault
f0166bc168 Fix T100775: Regression: EEVEE world environment is stretched when using orthographic view
It was using normalized vector instead of `viewCameraVec` which account for
orthographic views.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D15861
2022-09-05 09:18:44 +02:00
b0d9b6f6df Fix T100788 Regression: EEVEE wrong normal map on backfaces
This was caused by rB07cf3ce92fa2. It was missing a sign flip.
2022-09-05 09:12:12 +02:00
0ff920b777 Cleanup: Clarify multi-socket input sorting
The multi-socket input sorting was used for two purposes: moving links
to the proper positions when dragging a new link, and resetting the
multi-input indices on the links when removing a link. They are now
separated into two functions, and the sorting when making a group
node that didn't accomplish anything is removed (in that case a
proper implementation would copy the indices from the original
exterior sockets).
2022-09-03 23:25:06 -05:00
b978c1bc65 Cleanup: Replace recursive quadratic node link mute operation
The previous implementation iterated over all links multiple times
recursively. Instead, use the node tree topology cache, only iterate
over all links once, and use a stack to propagate the mute upsteam
and downstream.
2022-09-03 17:57:53 -05:00
b60850d395 Cleanup: Deduplicate node link intersection test 2022-09-03 14:52:27 -05:00
56193eccf6 Cleanup: Refactor node add reroute operator
Use C++ Map that supports the duplication natively. Use vectors instead
of linked lists, and adjust naming. Also remove combination of reroutes
for input sockets, which doesn't make sense since a reroute isn't
allowed to combine multiple input links into one output.
2022-09-03 14:19:09 -05:00
4b818b1513 Merge branch 'blender-v3.3-release' 2022-09-03 11:43:15 +02:00
a631dc5575 Fix T100731: Keymap Editor context menu crash
Caused by {rB3f3d82cfe9ce}

Since above commit, a `uiRNACollectionSearch` may contain a NULL
`search_prop`, crashing the menu entry for "Jump To Target"
(`ui_jump_to_target_button_poll`).

Now safeguard against this with a NULL check (getting search callbacks
to work for "Jump To Target" can be investigated in master).

Maniphest Tasks: T100731

Differential Revision: https://developer.blender.org/D15832
2022-09-03 11:36:57 +02:00
a50ca6a1cd Fix T100687: Geometry Attribute Convert crashes in sculpt mode
Since above commit, `BKE_id_attributes_active_get` would also return
"internal" attributes like ".hide_poly" or ".hide_vert".
As a consequence, a couple of poll functions dont return false anymore
(attribute remove, attribute convert), allowing these operators to
execute, but acting on this "internal" layers is just asking for
trouble.

In the UI, we dont see these attributes, because `MESH_UL_attributes`
checks `is_internal`, same thing we do now in
`BKE_id_attributes_active_get`.

Maniphest Tasks: T100687

Differential Revision: https://developer.blender.org/D15833
2022-09-03 11:30:51 +02:00
0348bc88e4 Cleanup: Return early 2022-09-02 19:06:12 -05:00
2d72fc0586 Cleanup: use more standard variable name for node sockets 2022-09-02 17:48:46 -05:00
4a4044ad9b Cleanup: Use separate variables for node socket locations
This will help if the locations are moved out of DNA
and require slightly more complicated access.
2022-09-02 17:46:38 -05:00
df40440d22 Cleanup: Avoid using node socket location
The location of a reroute node and its sockets should be the same,
only stored in different coordinate spaces. Because the node's location
is the ground truth, use that for finding whether the mouse is hovering.
2022-09-02 17:46:38 -05:00
cd10fb4826 Cleanup: Use references and const in node editor 2022-09-02 17:46:38 -05:00
aa08545a01 Cleanup: Use new node topology cache for sorting multi input sockets
Assuming the cost of building the cache is ammortized, this
may be be helpful because it removes some quadratic behavior.
2022-09-02 17:45:29 -05:00
a736ca33ab Cleanup: Return early 2022-09-02 16:20:01 -05:00
0b4b3abc0b Merge branch 'blender-v3.3-release' 2022-09-02 15:49:33 -05:00
831ed297d0 Fix T100767: Geometry nodes viewer node placed incorrectly
See explanation in comment.

Differential Revision: https://developer.blender.org/D15864
2022-09-02 15:48:41 -05:00
b903b74944 Cleanup: Deduplicate node link points evaluation functions 2022-09-02 15:44:05 -05:00
40d815dff6 Cleanup: Further split of node link Bezier calculation function
Now dragged handles are handled separately, and the function returns a
statically sized array by value. The functions are also renamed to be
more consistent with curve naming elsewhere in Blender.
2022-09-02 15:44:05 -05:00
21e235afc3 Fix: Ensure topology cache exists when drawing nodes
This was missed in 58c650a44c.
2022-09-02 15:44:05 -05:00
8d1e5334ec Cleanup: Split node link draw culling to separate function
This was only really used in one place, so better to just do it there
rather than requiring another argument for the handle calculation.
2022-09-02 15:44:05 -05:00
ab6702a40f Cleanup: Return early 2022-09-02 15:44:05 -05:00
4068880ffc Cleanup: Remove unnecessary struct keyword usage in node editor 2022-09-02 15:44:05 -05:00
0fb699b212 Cleanup: Remove unused struct
Unused after 217d0a1524
2022-09-02 15:44:05 -05:00
a1e01f4c02 UI: 3D Text Caret
Changes to the text caret (cursor) when editing Text objects in the
3D Viewport.

See D15797 for more details and examples.

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

Reviewed by Brecht Van Lommel
2022-09-02 13:18:09 -07:00
65a215b819 Cleanup: DRW: Fix warning in release mode 2022-09-02 21:16:42 +02:00
86e7aaead2 Cleanup: Use C++ vector types in node editor 2022-09-02 14:09:41 -05:00
58c650a44c Nodes: Use existing nodes span cache
Use cache from 25e307d725 rather
than creating a new vector on every redraw.
2022-09-02 14:09:41 -05:00
RaphaelBelmont
6f53af3a81 EEVEE: Fix Symbol error in SH_L2 Caculation
The caculation of 7th SH coefficient need a negative sign

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D15635
2022-09-02 20:59:09 +02:00
2b7de49a2b EEVEE-Next: Port to new Draw Manager 2022-09-02 20:56:55 +02:00
99afbc40e7 Cleanup: Fix clang-tidy warnings: [bugprone-suspicious-memory-comparison] 2022-09-02 20:34:37 +02:00
06043c8313 Cleanup: Fix clang-tidy warnings: [modernize-redundant-void-arg] 2022-09-02 20:34:37 +02:00
73434f02c3 Cleanup: Fix clang-tidy warnings: [modernize-use-nullptr] 2022-09-02 20:34:37 +02:00
4e84fba547 Cleanup: Fix clang-tidy warnings: [modernize-use-using] 2022-09-02 20:34:37 +02:00
9c469321c5 Cleanup: Fix clang-tidy warnings: [readability-else-after-return] 2022-09-02 20:34:37 +02:00
ccf62df8b6 Cleanup: Fix clang-tidy warnings: [readability-inconsistent-declaration-parameter-name] 2022-09-02 20:34:37 +02:00
aa781f98bb Cleanup: Fix clang-tidy warnings: [bugprone-incorrect-roundings] 2022-09-02 20:34:37 +02:00
9ba04c4598 Cleanup: Fix clang-tidy warnings: [modernize-use-bool-literals] 2022-09-02 20:34:37 +02:00
361a2de6f1 Cleanup: Fix clang-tidy warnings: [modernize-deprecated-headers] 2022-09-02 20:34:37 +02:00
e0bdd171f3 Merge branch 'blender-v3.3-release' 2022-09-02 13:10:45 -05:00
d3242b772b obj: improve placement of shader nodes in imported materials
Previously for most materials (especially the ones without any
textures), the nodes were "off screen" way to the right, requiring
a view framing to even see them.

Also, as soon as multiple images were used, many nodes overlapped
one another and the connections were all a mess.

Simplify all that, and now each node type (coordinate, mapping, image,
normal map, bsdf etc.) is in it's own column, with BSDF at zero
coordinate. Each used image (along with any possible coordinate,
mapping, normal map) is it's own row. The resulting connections
are much cleaner.
2022-09-02 21:03:44 +03:00
1a641b449a BLF: Replacement of Hebrew Font
Replacement of our Hebrew font, which has bad variable weight default.

See D15846 for more details.

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

Reviewed by Brecht Van Lommel
2022-09-02 10:54:03 -07:00
e48a6fcc63 DRW-Next: Add uniform attributes (object attributes) support
This replaces the direct shader uniform layout declaration by a linear
search through a global buffer.

Each instance has an attribute offset inside the global buffer and an
attribute count.

This removes any padding and tighly pack all uniform attributes inside
a single buffer.

This would also remove the limit of 8 attribute but it is kept because of
compatibility with the old system that is still used by the old draw
manager.
2022-09-02 19:37:15 +02:00
356460f5cf Cleanup: EEVEE-Next: Use reference as suggested by MSVC 2022-09-02 19:05:48 +02:00
28d8076a2e Fix T100768: Reverse curves skips handles of middle Bezier points
Reversing Bezier handle types and positions would skip the middle point
of curves with an odd number of segments, which is still necessary to
swap in order to avoid changing the curve's shape.
2022-09-02 12:05:12 -05:00
da0bd86739 Cleanup: GPU: UniformAttribute: Improve const correctness
Removes a warning and tidy the API.
2022-09-02 19:01:12 +02:00
Clément Foucault
65ad36f5fd DRWManager: New implementation.
This is a new implementation of the draw manager using modern
rendering practices and GPU driven culling.

This only ports features that are not considered deprecated or to be
removed.

The old DRW API is kept working along side this new one, and does not
interfeer with it. However this needed some more hacking inside the
draw_view_lib.glsl. At least the create info are well separated.

The reviewer might start by looking at `draw_pass_test.cc` to see the
API in usage.

Important files are `draw_pass.hh`, `draw_command.hh`,
`draw_command_shared.hh`.

In a nutshell (for a developper used to old DRW API):
- `DRWShadingGroups` are replaced by `Pass<T>::Sub`.
- Contrary to DRWShadingGroups, all commands recorded inside a pass or
   sub-pass (even binds / push_constant / uniforms) will be executed in order.
- All memory is managed per object (except for Sub-Pass which are managed
   by their parent pass) and not from draw manager pools. So passes "can"
   potentially be recorded once and submitted multiple time (but this is
   not really encouraged for now). The only implicit link is between resource
   lifetime and `ResourceHandles`
- Sub passes can be any level deep.
- IMPORTANT: All state propagate from sub pass to subpass. There is no
   state stack concept anymore. Ensure the correct render state is set before
   drawing anything using `Pass::state_set()`.
- The drawcalls now needs a `ResourceHandle` instead of an `Object *`.
   This is to remove any implicit dependency between `Pass` and `Manager`.
   This was a huge problem in old implementation since the manager did not
   know what to pull from the object. Now it is explicitly requested by the
   engine.
- The pases need to be submitted to a `draw::Manager` instance which can
   be retrieved using `DRW_manager_get()` (for now).

Internally:
- All object data are stored in contiguous storage buffers. Removing a lot
   of complexity in the pass submission.
- Draw calls are sorted and visibility tested on GPU. Making more modern
   culling and better instancing usage possible in the future.
- Unit Tests have been added for regression testing and avoid most API
   breakage.
- `draw::View` now contains culling data for all objects in the scene
   allowing caching for multiple views.
- Bounding box and sphere final setup is moved to GPU.
- Some global resources locations have been hardcoded to reduce complexity.

What is missing:
- ~~Workaround for lack of gl_BaseInstanceARB.~~ Done
- ~~Object Uniform Attributes.~~ Done (Not in this patch)
- Workaround for hardware supporting a maximum of 8 SSBO.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D15817
2022-09-02 18:45:14 +02:00
fd47fe4006 Cleanup: fix compiler warning 2022-09-02 18:33:10 +02:00
789936ea1b Merge branch 'blender-v3.3-release'
# Conflicts:
#	release/scripts/addons
2022-09-02 18:28:46 +02:00
Clément Foucault
e02e844f51 Fix T100163: Eevee: Regression: Displacement maps affected by rotation
This was an oversight as the matrix multiplication present in original
code was reversed.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D15858
2022-09-02 18:21:24 +02:00
07cf3ce92f Fix T100377: EEVEE: Regression 3.2 normalmap node broken
This was caused by un-wanted normalization. This is a requirement of
the MikkTspace. The issue is that g_data.N is expected to be normalized
by many other functions and overriden by bump displacement.

Adding a new global variable containing the interpolated normal fixes the
issue AND make it match cycles behavior better (mix between bump and
interpolated normal).
2022-09-02 18:13:54 +02:00
719a0378ae Cleanup: Use NODE_STORAGE_FUNCS for compositor nodes
This patches replaces the custom node storage acessor functions from the
viewport compositor code and replaces it with NODE_STORAGE_FUNCS.
2022-09-02 18:12:31 +02:00
Clément Foucault
874e9cbab9 Fix T99528: EEVEE: Regression: Faulty shaders when using Volume Info node
Workaround the issue by adding an intermediate function. This is usually
the case when working with attributes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D15860
2022-09-02 18:11:11 +02:00
Nathan Vegdahl
49ca810bf3 Cycles: enable adaptive sampling for Sobol-Burley
This uses the same sample classification approach as used for PMJ,
because it turns out to also work equally well with Sobol-Burley.

This also implements a fallback (random classification) that should
work "okay" for other samplers, though there are no other samplers
at the moment.

Differential Revision: https://developer.blender.org/D15845
2022-09-02 17:36:58 +02:00
4bbbba5bc2 Fix Cycles scrambling distance incorrectly showing as enabled for Sobol-Burley
Contributed by Alaska.

Differential Revision: https://developer.blender.org/D15849
2022-09-02 17:36:58 +02:00
aa174f632e Cleanup: split surface/displacement/volume shader eval into separate files 2022-09-02 17:13:28 +02:00
b865339833 Cleanup: remove some unnecessary kernel feature defines
That are either unused or aren't useful for testing anymore without a
megakernel.
2022-09-02 17:13:28 +02:00
cf57624764 Cleanup: refactoring of kernel film function names and organization 2022-09-02 17:13:28 +02:00
e72b9ca556 Fix: Wrong enum used in Mix Node for factor mode
Wrong type of enum was used for factor mode in rna_nodetree.c

No functional change, thankfully the correct enum had the same value.
2022-09-02 15:42:52 +01:00
622470fbb2 Cleanup: Comments of ID's tags. 2022-09-02 16:18:43 +02:00
852995d084 Cleaunp: Reorder GPencil function parameters
It's better to keep stroke as first parameter.
2022-09-02 16:11:23 +02:00
426d6b4baa GPencil: Simplify Perimeter functions to not use RegionView3D
This makes the api more portable and not depend on 
any visual area for background tasks like future modifiers.
2022-09-02 16:07:37 +02:00
633117669b Realtime Compositor: Implement dilate erode node
This patch implements the dilate/erode node for the realtime compositor.

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

Reviewed By: Clement Foucault
2022-09-02 14:47:39 +02:00
8cfca8e1bd PyGPU: only use 3D shaders and rename string enums
Since rB6269d66da, creating formats no longer depends solely on the
shader, but now depends on the dimensions used to fill the VBOs.

This allows 3D shaders to work flawlessly when assigned dimensions are
2D.

So there's no real benefit to us having shaders that are limited to 2D
use anymore.

This limitation makes it difficult to implement other builtin shaders
as they indirectly require a 2D version.

So this commit removes the 2D versions of the builtin sahders used in
Python , renames the string enums but keeps the old enums working for
backward compatibility.

(This brings parts of the changes reviewed in D15836).
2022-09-02 09:39:09 -03:00
Clément Foucault
de818d81c3 Fix T98190: EEVEE: Very slow rendering on Intel HD Graphics 4400
This particular GPU driver does not constant fold all the way in order
to discard the unused branches.

To workaround that, we introduce a series of material flag that generates
defines that only keep used branches.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D15852
2022-09-02 13:51:43 +02:00
c8ac1280bb EEVEE-Next: Move weight layer indexes to shader shared.
Upcoming cryptomatte patch would need access to these defines. So moving
them from film_lib to shader shared. We cannot include the film_lib as
it requires images/textures to be bound that we don't need.

At the same time fixes incorrect casing (`lAYER` => `LAYER`).
2022-09-02 11:33:33 +02:00
0a85288462 Fix build error after recent Metal GPU commit
These definitions were in the patch but didn't make it to the commit.
2022-09-01 17:10:05 -05:00
af4e62a020 Cleanup: Remove duplicate declaration in GPU capabilities 2022-09-01 16:57:17 -05:00
Thomas Dinges
cc8ea6ac67 Metal: MTLShader and MTLShaderGenerator implementation.
Full support for translation and compilation of shaders in Metal, using
GPUShaderCreateInfo. Includes render pipeline state creation and management,
enabling all standard GPU viewport rendering features in Metal.

Authored by Apple: Michael Parkin-White, Marco Giordano

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D15563
2022-09-01 22:28:40 +02:00
Jason Fielder
ac07fb38a1 Metal: Minimum per-vertex stride, 3D texture size + Transform feedback GPUCapabilities expansion.
- Adding in compatibility paths to support minimum per-vertex strides for vertex formats. OpenGL supports a minimum stride of 1 byte, in Metal, this minimum stride is 4 bytes. Meaing a vertex format must be atleast 4-bytes in size.

- Replacing transform feedback compile-time check to conditional look-up, given TF is supported on macOS with Metal.

- 3D texture size safety check added as a general capability, rather than being in the gl backend only. Also required for Metal.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D14510
2022-09-01 22:18:02 +02:00
Jason Fielder
5f4409b02e Metal: MTLIndexBuf class implementation.
Implementation also contains a number of optimisations and feature enablements specific to the Metal API and Apple Silicon GPUs.

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D15369
2022-09-01 21:45:12 +02:00
9d59734ffd Fix build (missing include from fa40013009) 2022-09-01 21:57:42 +03:00
fa40013009 Cleanup: obj: simplify material node tree creation
As pointed out in D15827 comment, the unique_ptr usage in
ShaderNodetreeWrap related code does not sound very useful. Looking at
it, whole ShaderNodetreeWrap does not make much sense - it's only
ever created, and then immediately just one thing is fetched from it.
This very much sounds like "a function", so make it just that -
header file contains just a `create_mtl_node_tree` function, and the
whole implementation is hidden from the users. Which I've also
simplified into just a handful of freestanding functions.

No functionality or performance changes, but the code does get ~80
lines shorter.
2022-09-01 21:26:28 +03:00
16adfff1c6 Cleanup: make format 2022-09-01 19:59:55 +02:00
9a86255da8 Node Editor: Visual tweaks to node links
Several visual tweaks to node links to make them overall fit in
better with the look of the node editor:

- Change the link thickness with the zoom level to a certain degree.
- Remove the fuzziness of the node link and its shadow/outline.
- The link outline color can now be made transparent.
- Add circles at the end of dragged links when connecting to sockets.
- Improve the banding of the color interpolation along the link.
- Adjust the spacing of dashes along straight node links.

Reviewed By: Pablo Vazquez, Hans Goudey

Differential Revision: http://developer.blender.org/D15036
2022-09-01 19:48:35 +02:00
6ee3431914 Fix: Use of deprecated field in legacy MFace conversion
The material indices have been moved out of MPoly since f1c0249f34.
That conversion happens in file reading code currently, so the material
indices have to be accessed the new way everywhere.
2022-09-01 12:45:18 -05:00
08894ac929 Merge branch 'blender-v3.3-release' 2022-09-01 20:44:09 +03:00
f366d197db Fix T100737: OBJ/USD import: imported object has no active material, material has 2 users
Fixes issues in importers written in C++ (T100737):

- Materials had one reference count too much. Affected Collada,
  Alembic, USD, OBJ importers, looks like "since forever".
- Active material index was not properly set on imported meshes.
  Regression since 3.3 (D15145). Affected Alembic, USD, OBJ. Note:
  now it sets the first material as the active one, whereas
  previously the last one was set as active. First one sounds more
  "intuitive" to me.

Reviewed By: Bastien Montagne
Differential Revision: https://developer.blender.org/D15831
2022-09-01 20:38:56 +03:00
82e3513a8d Merge branch 'blender-v3.3-release' 2022-09-01 17:48:06 +02:00
ad4dcfe227 Fix T100709: baking max ray distance wrong with older .blend files
Add versioning to compensate for bugfix from T97945.
2022-09-01 17:16:50 +02:00
3249853ebe Fix: Incorrect vertex group layer "construct" callback
The "set default" callback doesn't need to be defined since it falls
back to clearing the memory, but since "construct" is optional, it
needs to be defined. Mistake in 25237d2625.
2022-09-01 08:23:57 -05:00
00d2bda241 Py Docs: Document delayed setting of UI data
Blender may not apply certain UI data changes immediately when done via BPY.
This is a rather typical gotcha, better to have it documented.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D15614
2022-09-01 15:03:51 +02:00
06d2dc6be2 Cleanup: minor cleanups for sample pattern code 2022-09-01 14:57:39 +02:00
60119daef5 Cycles: remove old Sobol pattern, simplify sampling dimensions
The multi-dimensional Sobol pattern required us to carefully use as low
dimensions as possible, as quality goes down in higher dimensions. Now that we
have two sampling patterns that are at least as good, there is no need to keep
it around and the implementation can be simplified.

Differential Revision: https://developer.blender.org/D15788
2022-09-01 14:57:39 +02:00
Nathan Vegdahl
50df9caef0 Cycles: improve Progressive Multi-Jittered sampling
Fix two issues in the previous implementation:
* Only power-of-two prefixes were progressively stratified, not suffixes.
  This resulted in unnecessarily increased noise when using non-power-of-two
  sample counts.
* In order to try to get away with just a single sample pattern, the code
  used a combination of sample index shuffling and Cranley-Patterson rotation.
  Index shuffling is normally fine, but due to the sample patterns themselves
  not being quite right (as described above) this actually resulted in
  additional increased noise. Cranley-Patterson, on the other hand, always
  increases noise with randomized (t,s) nets like PMJ02, and should be avoided
  with these kinds of sequences.

Addressed with the following changes:
* Replace the sample pattern generation code with a much simpler algorithm
  recently published in the paper "Stochastic Generation of (t, s) Sample
  Sequences". This new implementation is easier to verify, produces fully
  progressively stratified PMJ02, and is *far* faster than the previous code,
  being O(N) in the number of samples generated.
* It keeps the sample index shuffling, which works correctly now due to the
  improved sample patterns. But it now uses a newer high-quality hash instead
  of the original Laine-Karras hash.
* The scrambling distance feature cannot (to my knowledge) be implemented with
  any decorrelation strategy other than Cranley-Patterson, so Cranley-Patterson
  is still used when that feature is enabled. But it is now disabled otherwise,
  since it increases noise.
* In place of Cranley-Patterson, multiple independent patterns are generated
  and randomly chosen for different pixels and dimensions as described in the
  original PMJ paper. In this patch, the pattern selection is done via
  hash-based shuffling to ensure there are no repeats within a single pixel
  until all patterns have been used.

The combination of these fixes brings the quality of Cycles' PMJ sampler in
line with the previously submitted Sobol-Burley sampler in D15679. They are
essentially indistinguishable in terms of quality/noise, which is expected
since they are both randomized (0,2) sequences.

Differential Revision: https://developer.blender.org/D15746
2022-09-01 14:57:39 +02:00
ba1bf87bd8 GPUMaterial: Make uniform attrib precompute hash and attribute safe name
This avoids redundant operation at draw time.
The per attrib hash is to be used with the future implementation.
2022-09-01 14:41:00 +02:00
06005b0870 Tweak cryptomatte channels naming to improve interoperability
Use lowercase rgba channel names which still by-passes lossy nature
of DWA compression and which also keeps external compositing tools
happy.

Thanks Steffen Dünner for testing this patch!

Differential Revision: https://developer.blender.org/D15834
2022-09-01 14:39:26 +02:00
Germano Cavalcante
cb771dbe76 PyDoc: update the shader creation examples with gpu module
The old way of creating shaders is being replaced by using
`GPUShaderCreateInfo` for more portability.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D14634
2022-09-01 08:31:56 -03:00
Germano Cavalcante
6269d66da2 PyGPU: GPUShader: implementation of 'attrs_info_get' method
With the new `attrs_info_get` method, we can get information about
the attributes used in a `GPUShader` and thus have more freedom in the
automatic creation of `GPUVertFormat`s

Reviewed By: fclem, campbellbarton

Differential Revision: https://developer.blender.org/D15764
2022-09-01 08:25:55 -03:00
05fe7ca5af Merge branch 'blender-v3.3-release' 2022-09-01 12:43:13 +02:00
df751516e1 Fix cryptomatte passes saved lossy into multilayer EXR
The DWA compression code in OpenEXR has hardcoded rules which decides
which channels are lossy or lossless. There is no control over these
rules via API.

This change makes it so channel names of xyzw is used for cryptomatte
passes in Cycles. This works around the hardcoded rules in the DWA code
making it so lossless compression is used. It is important to use lower
case y channel name as the upper case Y uses lossy compression.

The change in the channel naming also makes it so the write code uses
32bit for the cryptomatte even when saving half-float EXR.

Fixes T96933: Cryptomatte layers saved incorrectly with EXR DWA compression
Fixes T88049: Cryptomatte EXR Output Bit Depth should always be 32bit

Differential Revision: https://developer.blender.org/D15823
2022-09-01 10:37:39 +02:00
Monique Dewanchand
17501c146e Cleanup: Remove/replace View Layer macros.
This patch is a cleanup required before refactoring the view layer syncing
process {T73411}.

* Remove FIRSTBASE.
* Remove LASTBASE.
* Remove BASACT.
* Remove OBEDIT_FROM_WORKSPACE.
* Replace OBACT with BKE_view_layer_active_object.
* Replace OBEDIT_FROM_VIEW_LAYER with BKE_view_layer_edit_object.

Reviewed By: mont29

Maniphest Tasks: T73411

Differential Revision: https://developer.blender.org/D15799
2022-09-01 10:22:43 +02:00
f9c249917d Cleanup: use reference instead of copy 2022-09-01 09:57:24 +02:00
Bastien Montagne
414baf9780 Fix invalid memory handling in C++ OBJ MTL Importer.
An ID created with regualr ID management code should never ever be
directly freed directly.

For embedded nodetrees, there is a dedicated function.

Reviewed By: aras_p

Differential Revision: https://developer.blender.org/D15827
2022-09-01 09:17:02 +02:00
9806672e86 Fix: Build error in Cycles with OpenVDB turned off 2022-08-31 18:06:13 -05:00
3a605b23d0 Fix T100708: Cycles bake of diffuse/glossy color not outputting alpha 2022-08-31 20:51:50 +02:00
b9998541e1 Fix part of T100626: Cycles not using tiles for baking
Leading to excessive memory usage compared to Blender 2.93. There's still
some avoidable memory usage remaining, due to the full float buffer in the
new image editor drawing and not loading the cached EXR from disk in tiles.

Main difficulty was handling multi-image baking and disk caches, which is
solved by associating a unique layer name with each image so it can be
matched when reading back the image from the disk.

Also some minor header changes to be able to use RE_MAXNAME in RE_bake.h.
2022-08-31 20:04:14 +02:00
e665f0f497 Fix T100714: Cycles volume render artifacts with negative value grids
The volume bounds were not constructed correctly in this case.
2022-08-31 20:04:14 +02:00
d7b33cd8c8 Sculpt: Fix T100479: Memory corruption in sculpt_boundary_edit_data_init 2022-08-31 10:20:30 -07:00
70f1711324 Mesh: Remove unnecessary copy in modifier stack
These few lines making a copy of the final mesh were confusing.
The goal (I'm fairly certain) is to make sure the cage mesh and final
mesh aren't shared when applying the vertex coordinates to the final
mesh. This can be done more simply though, in a way that avoids
duplicating the final mesh if it already isn't shared.

This works well in some basic tests with different modifiers. Though
I doubt it was really a bottleneck anywhere, simplifying the modifier
stack internals is always nice.

Differential Revision: https://developer.blender.org/D15814
2022-08-31 12:12:09 -05:00
91d9f46aec Cleanup: Use const for node data in compositor
Push the const usage a bit further for compositor nodes, so that they
are more explicit about not modifying original nodes from the editor.

Differential Revision: https://developer.blender.org/D15822
2022-08-31 12:06:13 -05:00
fae955fdb1 Fix merge error. 2022-08-31 10:04:23 -07:00
ab8240fcff Fix submodule refs 2022-08-31 10:02:42 -07:00
373e69b94e Merge branch 'blender-v3.3-release' 2022-08-31 09:46:33 -07:00
cdc0be48c9 Cleanup: fix warnings from vcol limit commit 2022-08-31 09:43:52 -07:00
e6557785ed Fix: crash on undo due to missing node declaration
This was broken in {rB25e307d725d0b924fb0e87e4ffde84f915b74310}.
2022-08-31 18:35:07 +02:00
0a4249561c Fix compile error from merge. 2022-08-31 09:08:35 -07:00
2f729bc111 Fix T98525: depsgraph for indirectly referenced ID Properties in drivers.
If the RNA path of a Single Property variable goes through a pointer
to a different ID, the property should be attached to that ID using
the owner reference in the RNA pointer. This already happened when
building some, but not all of the relations and nodes.

This patch fixes the remaining cases.

Differential Revision: https://developer.blender.org/D15323
2022-08-31 19:00:38 +03:00
f987d9b758 Merge branch 'blender-v3.3-release' 2022-08-31 08:33:23 -07:00
30ec628d43 UI: Fix Geometry Nodes "Is Face Planar" name
Old name: "Face is Planar"
New name: "Is Face Planar"

This follows the current convention (Is Shade Smooth, Is Viewport, ...).
2022-08-31 17:31:04 +02:00
db98007c3a UI: Fix Geometry Nodes "Mesh to Volume" name (typo)
Old name: "Mesh To Volume"
New name: "Mesh to Volume"

This is consistent with what we do for the other nodes
(Mesh to Curve, Mesh to Points).
2022-08-31 17:30:39 +02:00
a6ba8e5f38 Core: Remove color attribute limit from CustomData API
Note: does not fix the limit in PBVH draw which is
caused by VBO limits not MAX_MCOL.
2022-08-31 08:29:16 -07:00
2a13ce1e61 Fix T100700: Compositor crashes when disabled then enabled
The viewport compositor crashes when it is disabled then enabled after
the compositor node tree is edited.

This happens because the compositor engine uses the view_update callback
of the draw engine type to detect changes in the node tree and reset its
state for future evaluation. However, the draw manager only calls the
view_update callback for enabled engines, so the compositor never
receives the needed updates to properly reset its state and then crashes
at draw time.

This patch call the view_update callback for all registered engines
regardless if they are enabled or not, that way, they always receive
the potentially important updated needed to maintain a correct state.

Aside from the compositor engine, this change affects the EEVEE and
Workbench engines because they are the only engines that utilizes this
callback. However, both of them only reset a flag that is checked at
draw time. So the change should have no side effects. For the EEVEE
engine, we just add a null check in case it was not instanced, while
Workbench already have the appropriate null check.

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

Reviewed By: Clement Foucault
2022-08-31 16:59:54 +02:00
370b17a8c6 Merge remote-tracking branch 'origin/blender-v3.3-release' 2022-08-31 16:30:57 +02:00
0864ab5248 UI: Fix order of Geometry Nodes in the Add Nodes Mesh menu 2022-08-31 16:29:13 +02:00
ae79bc490a GPencil: Apply Brush Size to Outline thickness while drawing
The new factor allows to apply the current brush size to the
external stroke perimeter conversion done in draw mode.
2022-08-31 16:18:08 +02:00
097ed6565e Merge branch 'blender-v3.3-release' 2022-08-31 16:10:59 +02:00
f1c0249f34 Mesh: Move material indices to a generic attribute
This patch moves material indices from the mesh `MPoly` struct to a
generic integer attribute. The builtin material index was already
exposed in geometry nodes, but this makes it a "proper" attribute
accessible with Python and visible in the "Attributes" panel.

The goals of the refactor are code simplification and memory and
performance improvements, mainly because the attribute doesn't have
to be stored and processed if there are no materials. However, until
4.0, material indices will still be read and written in the old
format, meaning there may be a temporary increase in memory usage.

Further notes:
* Completely removing the `MPoly.mat_nr` after 4.0 may require
  changes to DNA or introducing a new `MPoly` type.
* Geometry nodes regression tests didn't look at material indices,
  so the change reveals a bug in the realize instances node that I fixed.
* Access to material indices from the RNA `MeshPolygon` type is slower
  with this patch. The `material_index` attribute can be used instead.
* Cycles is changed to read from the attribute instead.
* BMesh isn't changed in this patch. Theoretically it could be though,
  to save 2 bytes per face when less than two materials are used.
* Eventually we could use a 16 bit integer attribute type instead.

Ref T95967

Differential Revision: https://developer.blender.org/D15675
2022-08-31 09:09:01 -05:00
d4d14df38c Release schedule: Blender 3.3 RC
The branch is now in Bcon4, critical bug fixes only.
2022-08-31 16:08:26 +02:00
3e73afb536 Merge branch 'blender-v3.3-release' 2022-08-31 15:34:44 +02:00
b1231e616a Cycles: Enforce Windows driver version requirements for sycl
sycl/L0 runtime reports compute-runtime version since Intel graphics
driver 101.3268 on Windows, when querying driver version from sycl.
Prior to this driver, it was 0. Now we can bump minimum requirement to
this one and filter-out devices returning 0.

Maniphest Tasks: T100648
2022-08-31 15:33:16 +02:00
310a43bcac Cleanup: Resolve unused-lambda-capture warning 2022-08-31 15:20:45 +02:00
ac20970bc2 Depsgraph: optimize out evaluation of hidden objects
This change makes it so that objects which are temporary hidden from
the viewport (the icon toggle in outliner) do not affect on the
performance of the viewport.

The attached file demonstrates the issue. Before this change hiding
the object does not change FPS, after this change FPS goes high when
the object is hidden.

F13435936

Changing the object temporary visibility is already expected to tag
scene for bases updates, which flushes down the stream to the object
visibility update. So the only remaining topic was to ensure the
graph does a special round of visibility update on such changes.

Differential Revision: https://developer.blender.org/D15813
2022-08-31 15:11:18 +02:00
5a1b733a67 Fix unnecessary modifier visibility re-evaluation
While it is hard to measure the performance impact accurately, there
is no need to perform per-modifier string lookup on every frame update.

Implemented as an exceptional case in the code which flushes updates to
the entire component. Sounds a bit suboptimal, but there are already
other exception cases handled in the function.

Differential Revision: https://developer.blender.org/D15812
2022-08-31 15:11:18 +02:00
c1e342136d UI: Add shift-click hint to library overrides button tooltip
This information was missing and made the feature hard to discover.
2022-08-31 15:04:43 +02:00
773241add9 Merge branch 'blender-v3.3-release' 2022-08-31 14:47:52 +02:00
24fe659224 LibOverride: Replace linked objects by their overrides when created from 3DView.
From the 3DView code has basically no knowledge of collection hierarchy,
so we can either not remap any local usage of linked objects that are
being overridden, or remap them in all their local collections.

The second behavior makes most sense in the vast majority of cases.

Note that this was only an issue when directly linking and overriding
objects, not when doing so through collections.
2022-08-31 14:44:55 +02:00
4b9d7b71e0 Fix: incorrect detection of used sockets 2022-08-31 14:41:57 +02:00
627e8ad682 Fix: missing vector clear
Otherwise, these vectors are never cleared, leading to crashes
down the line.
2022-08-31 13:57:08 +02:00
d3f07998ed Cleanup: simplify debugging
This makes it easy to set breakpoints where false is returned.
2022-08-31 13:57:08 +02:00
81d82427b5 Merge branch 'blender-v3.3-release' 2022-08-31 12:38:13 +02:00
d210ab90d4 Fix crash in liboverride operations from the Outliner.
Checks for 'invalid' selected IDs that need to be skipped were
incomplete, and one was missing the actual return statement.
2022-08-31 12:36:54 +02:00
25e307d725 Nodes: move NodeTreeRef functionality into node runtime data
The purpose of `NodeTreeRef` was to speed up various queries on a read-only
`bNodeTree`. Not that we have runtime data in nodes and sockets, we can also
store the result of some queries there. This has some benefits:
* No need for a read-only separate node tree data structure which increased
  complexity.
* Makes it easier to reuse cached queries in more parts of Blender that can
  benefit from it.

A downside is that we loose some type safety that we got by having different
types for input and output sockets, as well as internal and non-internal links.

This patch also refactors `DerivedNodeTree` so that it does not use
`NodeTreeRef` anymore, but uses `bNodeTree` directly instead.

To provide a convenient API (that is also close to what `NodeTreeRef` has), a
new approach is implemented: `bNodeTree`, `bNode`, `bNodeSocket` and `bNodeLink`
now have C++ methods declared in `DNA_node_types.h` which are implemented in
`BKE_node_runtime.hh`. To make this work, `makesdna` now skips c++ sections when
parsing dna header files.

No user visible changes are expected.

Differential Revision: https://developer.blender.org/D15491
2022-08-31 12:16:13 +02:00
5a60535a20 GPUCapabilities: Add GPU_shader_draw_parameters_support
This checks for the availability of `gl_BaseInstanceARB` or equivalent.

Disabling for any workaround that disables shader_image_load_store_support
as a preventive measure.
2022-08-31 11:35:18 +02:00
41f439a737 Merge branch 'blender-v3.3-release' 2022-08-31 10:29:35 +02:00
6177d9f0c8 Fix: reverse uv lookup fails due to floating point accuracy issues
The case when the query uv is almost on an edge but outside of any
triangle was handled before. Now the case where the query uv is
almost on an edge but inside more than one triangle is handled as well.
2022-08-31 10:28:35 +02:00
68f234b8ab Cleanup: obj: simplify import/export syntax handling code
I want to add support for PBR materials extension to OBJ, but the way
current I/O code syntax handling was done made it quite cumbersome
to extend the number of MTL textures/parameters.

Simplify all that by removing FormatHandler template on "syntax"
that gets routed through keyword enums, and instead just have
simple `write_obj_*` and `write_mtl_*` functions.

Simplify MTLMaterial to not contain a map of textures (that is always
fully filled with all possible textures), instead now there's
a simple array. Rename `tex_map_XX` to `MTLTexMap`.

All this does not affect behavior or performance, but it does result
in 170 fewer lines of code, and saves a couple kilobytes of executable
size.
2022-08-31 11:18:34 +03:00
caa352bc45 Merge branch 'blender-v3.3-release' 2022-08-31 09:44:15 +02:00
e2deee73ab Update freedesktop file.
Add new features for upcoming Blender 3.3 and also missing 3.2 notes, which were not merged to master.
2022-08-31 09:42:17 +02:00
60576fba11 Fix resource leak dropping files in GHOST/Win32
Early returns in error cases missed calling ReleaseStgMedium for
getDropDataAsFilenames, getDropDataAsString & getDropDataAsString.
2022-08-31 16:28:32 +10:00
a0ff2be199 Cleanup: remove pointless strcpy return value check 2022-08-31 16:12:24 +10:00
70035e6473 Cleanup: break before the default case in switch statements
While missing the break before a default that only breaks isn't
an error, it means adding new cases needs to remember to add the
break for an existing case, changing the default case will also
result in an unintended fall-through.

Also avoid `default:;` and add an explicit break.
2022-08-31 16:01:29 +10:00
ff651a08b5 Fix returning a freed context when initialization fails for GHOST/Win32 2022-08-31 14:55:47 +10:00
4df3cf020b Fix uninitialized variable use for ID3D11RenderTargetView
When 'm_render_target' was NULL, backbuffer_res would be used without
being assigned. While it seems likely this code-path is rarely used
(if at all), resolve the logical error.
2022-08-31 14:55:47 +10:00
065a1cd0b1 Cleanup: check GetKeyboardState succeeds before using it's values
Quiets compiler warning.
2022-08-31 14:55:39 +10:00
e9d4a20a59 Cleanup: tablet press could fall through to release on GHOST/Win32
Introduced in [0], checking the logic here, there seems to be no reason
a press event should ever run release logic, relocate break statement.

In practice this was unlikely to cause problems as peeking into press
events would need to fail, peeking into release would need to succeed.
Even so, better avoid accidental fall through in switch statements.

[0]: 6f158f834d
2022-08-31 14:36:44 +10:00
8bfb65e254 Cleanup: remove 'else' after return 2022-08-31 14:36:44 +10:00
c4a16389bc Cleanup: use bool for GHOST_SystemWin32::setConsoleWindowState return 2022-08-31 14:36:44 +10:00
0f8ebd21e3 Cleanup: reduce scope, quiet unused variable warnings
When building without thumbnails some variables weren't used,
reduce their scope as well as the BlPath sub-string.
2022-08-31 14:26:47 +10:00
876d1bfe4e Cleanup: quiet MSVC warning using flag flag operations on boolean
While harmless it wasn't clear if other bits might be set but ignored,
assign the value instead.
2022-08-31 14:26:46 +10:00
68d85ce208 Cleanup: format 2022-08-31 13:52:44 +10:00
cae50c83c6 Cleanup: split font datafile loading into a function
Also use more descriptive/conventional variable names.
2022-08-31 12:50:08 +10:00
657b92c888 BLF: use existing stat from 'direntry' for directory check 2022-08-31 12:42:41 +10:00
dc733cf17d Merge branch 'blender-v3.3-release' 2022-08-31 10:02:45 +08:00
fec90a5d58 GPencil: Fix sharp_threshold property in sample stroke operator
The property registration was missing in the operator, now fixed.
2022-08-31 10:02:09 +08:00
66fecfcda6 LineArt: Fix (unreported) wrong index in weight transfer
Line art now uses global index for vertices but needs to have
local index in order to do correct weight transfer.
2022-08-31 10:02:09 +08:00
Charlie Jolly
bfa0ee13d5 Node: Mix node
This patch is a response to T92588 and is implemented
as a Function/Shader node.

This node has support for Float, Vector and Color data types.

For Vector it supports uniform and non-uniform mixing.

For Color it now has the option to remove factor clamping.

It replaces the Mix RGB for Shader and Geometry node trees.

As discussed in T96219, this patch converts existing nodes
in .blend files. The old node is still available in the
Python API but hidden from the menus.

Reviewed By: HooglyBoogly, JacquesLucke, simonthommes, brecht

Maniphest Tasks: T92588

Differential Revision: https://developer.blender.org/D13749
2022-08-31 00:13:57 +01:00
0331a8c67c Cleanup: Remove redundant addition of attribute
The radius attribute is aleady added in `pointcloud_random`.
2022-08-30 17:03:04 -05:00
b5bc086864 Cleanup: Avoid using geometry component unnecessarily 2022-08-30 17:00:36 -05:00
7bfabc6444 Cleanup: Remove unused point cloud function
This can be done more intuitively with a "copy parameters" function
like `curves_copy_parameters` or `BKE_mesh_copy_parameters` anyway.
2022-08-30 16:52:30 -05:00
d94a11ed79 Curves: Avoid unnecessarily initializing new positions layer
When creating a curves data-block, one is expected to set the new
position values. We can slightly improve performance by avoiding
doing that redundantly.

Similar to cccc6d6905.
2022-08-30 16:49:24 -05:00
4c91c24bc7 Attributes: Avoid unnecessarily initializing new attributes
The "write_only" (i.e. no reading) API function expects the caller to
set values for all new attribute elements, so using calloc or setting
 the default value first is redundant. In theory this can improve
performance by avoiding an extra pass over the array. I observed a
6% improvement in a basic test with the mesh to points node:
from 47.9ms to 45ms on average.

See 25237d2625 for more info.
Similar to cccc6d6905.
2022-08-30 16:45:00 -05:00
cccc6d6905 Mesh: Avoid redundant custom data layer initialization
In all these cases, it was clear that the layer values were set right
after the layer was created anyway. So there's no point in using
calloc or setting the values to zero first.

See 25237d2625 for more info.
2022-08-30 16:27:43 -05:00
47d105f6ad Merge branch 'blender-v3.3-release' 2022-08-30 15:39:30 -05:00
d9c48d94e4 Fix: Potential name clash when adding rest position attribute
If a "rest_position" attribute already existed, potentiall with another
type, the next name "rest_position.001" would be used, which might
even conflict with a name on another domain. Use the C++ attribute
API instead, which has more standard/predictable behavior.
2022-08-30 15:38:38 -05:00
bcd671e565 Cleanup: Use C++ attribute API 2022-08-30 15:32:10 -05:00
3090edfecf Cleanup: Use standard variable name for curve points 2022-08-30 15:32:10 -05:00
4944167dee GPUBatch: Add multi_draw_indirect capability and indirect buffer offset
This is for completion and to be used by the new draw manager.
2022-08-30 22:26:11 +02:00
f5ea2a6434 GPUTexture: Add type correct GPU_SAMPLER_MAX constant for C++
This avoid having to cast when using it in `.cc` and `.hh` files.
2022-08-30 22:26:11 +02:00
36e74cc4f7 GPUMaterial: Expose debug name getter
This also makes it mandatory, but reduced length for release.
2022-08-30 22:26:11 +02:00
da03c1f96d GPUCodegen: Do not rely on auto resource location
This allows the render engine to expect non-overlapping resources in the
generated create info.
Textures are indexed from 0 and up.
Nodetree ubo is bound to slot 0.
Uniform attributes ubo is bound to slot 1.
2022-08-30 22:26:11 +02:00
b15f90bf85 GPUBatch: Add draw parameter getter
This is used to populate indirect draw commands in the draw manager.
2022-08-30 22:26:11 +02:00
fe195f51d1 GPUStorageBuf: Add read() function to readback buffer data to host
This is not expected to be fast. This is only for inspecting the content
of the buffer for debugging or validation purpose.
2022-08-30 22:26:11 +02:00
25237d2625 Attributes: Improve custom data initialization options
When allocating new `CustomData` layers, often we do redundant
initialization of arrays. For example, it's common that values are
allocated, set to their default value, and then set to some other
value. This is wasteful, and it negates the benefits of optimizations
to the allocator like D15082. There are two reasons for this. The
first is array-of-structs storage that makes it annoying to initialize
values manually, and the second is confusing options in the Custom Data
API. This patch addresses the latter.

The `CustomData` "alloc type" options are rearranged. Now, besides
the options that use existing layers, there are two remaining:
* `CD_SET_DEFAULT` sets the default value.
  * Usually zeroes, but for colors this is white (how it was before).
  * Should be used when you add the layer but don't set all values.
* `CD_CONSTRUCT` refers to the "default construct" C++ term.
  * Only necessary or defined for non-trivial types like vertex groups.
  * Doesn't do anything for trivial types like `int` or `float3`.
  * Should be used every other time, when all values will be set.

The attribute API's `AttributeInit` types are updated as well.
To update code, replace `CD_CALLOC` with `CD_SET_DEFAULT` and
`CD_DEFAULT` with `CD_CONSTRUCT`. This doesn't cause any functional
changes yet. Follow-up commits will change to avoid initializing
new layers where the correctness is clear.

Differential Revision: https://developer.blender.org/D15617
2022-08-30 14:56:05 -05:00
d81e947c59 BLF: Fallback Stack Error Handling
Properly handle invalid fonts.

See D15798 for more details

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

Reviewed by Brecht Van Lommel
2022-08-30 11:31:11 -07:00
627bd4c46a Merge branch 'blender-v3.3-release' 2022-08-30 20:21:09 +02:00
f20d0de3b7 Fix T93084: Area stretch overlay full red on large scale mesh
Issue arises when face areas are really large combined with small UV
areas (report has a mesh ~1.5 km), then precission of shorts is
insufficient.

Now use floats instead.
This also removes this negative signed version of the total area ratio
(since with floats it is no longer used).

Thx @brecht for a lot of hand-holding!

NOTE: this is an alternative to D15805 (and quick tests show this does
not introduce the tiny performance hit as D15805 did).

Maniphest Tasks: T93084

Differential Revision: https://developer.blender.org/D15810
2022-08-30 20:16:30 +02:00
6f52a118a0 Fix: Build error on windows 2022-08-30 13:06:09 -05:00
934b9277be Fix build error from missing include 2022-08-30 12:47:21 -05:00
82a46ea6f8 Geometry Nodes: Use separate field context for each geometry type
Using the same `GeometryComponentFieldContext` for all situations,
even when only one geometry type is supported is misleading, and mixes
too many different abstraction levels into code that could be simpler.
With the attribute API moved out of geometry components recently,
the "component" system is just getting in the way here.

This commit adds specific field contexts for geometry types: meshes,
curves, point clouds, and instances. There are also separate field input
helper classes, to help reduce boilerplate for fields that only support
specific geometry types.

Another benefit of this change is that it separates geometry components
from fields, which makes it easier to see the purpose of the two concepts,
and how they relate.

Because we want to be able to evaluate a field on just `CurvesGeometry`
rather than the full `Curves` data-block, the generic "geometry context"
had to be changed to avoid using `GeometryComponent`, since there is
no corresponding geometry component type. The resulting void pointer
is ugly, but only turns up in three places in practice. When Apple clang
supports `std::variant`, that could be used instead.

Differential Revision: https://developer.blender.org/D15519
2022-08-30 11:08:27 -05:00
4d107041ec Merge branch 'blender-v3.3-release' 2022-08-30 10:43:36 -05:00
3306b4a86b Fix T99253: Missing face center dots with deform modifier cage option
Before 8c25889bb6, subsurf face center tags were stored in each
vertex, so they were always copied to duplicate meshes. Now they are
stored in runtime data though, so they need to be copied explicitly.
The function name "reset_on_copy" is a bit awkward here, so the
tags are copied by the caller.
2022-08-30 10:41:26 -05:00
38cf0d7d13 GPencil: Improve Thickness handling for Outline operator
Actually, when you increase the thickness of the stroke in the outline conversion, the shape of the stroke changes and becomes thicker.

This commit includes a new algorithm to correct this problem. A new `Keep Shape`  parameter allows you to disable it because, for artist reasons, it may be good to keep the old algorithm and change the shape.
2022-08-30 17:12:03 +02:00
002f339aed Fix: Alphabetical order in duplicate data preferences panel 2022-08-30 08:22:31 -05:00
9cfa74087e Merge branch 'blender-v3.3-release' 2022-08-30 15:18:49 +02:00
afa4f8f3ce LibOverride: Minor resync optimization by removing unuecessary processing.
Not much to gain here, but can make resync faster by a few percents when
dealing with linked overrides and such.
2022-08-30 15:18:17 +02:00
34ff27025d Cleanup: Remove one level of indentation by early continue in a loop. 2022-08-30 15:18:17 +02:00
f3186389b0 Fix T100586: libOverride resync could remove too many data-blocks.
Do not delete 'orphaned' overrides when their reference is missing
because the library file itself is missing.
2022-08-30 15:18:17 +02:00
fdc332981e Cleanup: simplify comparison, clarify comment 2022-08-30 21:20:26 +10:00
e0ab4b29a9 Merge branch 'blender-v3.3-release' 2022-08-30 21:07:31 +10:00
524d9a3e2f Fix error in operator poll functions
- PALETTE_OT_color_add: crashed without a brush.
- SCREEN_OT_actionzone: crashed without a window.
- PREFERENCES_OT_studiolight_show: exception when opening prefs failed.
2022-08-30 21:06:17 +10:00
c7555372fe Merge branch 'blender-v3.3-release' 2022-08-30 12:51:12 +02:00
558a6a45b4 Cleanup: Avoid misleading Outliner tree element callback name
These functions used the term "find", which makes it sound like a lookup
callback, when in fact it would add elements to a set for further
processing. So use "collect" instead.
2022-08-30 12:24:17 +02:00
34e30baedf Fix T100673: crash when using slide brush without attachment info
The slide brush requires attachment information on the curves.
Now a warning is shown instead of crashing Blender. The attachment
information can be generated by executing the
`Curves > Snap to Nearest Surface` operator.
2022-08-30 12:20:37 +02:00
702f112e77 Merge branch 'blender-v3.3-release' 2022-08-30 19:46:44 +10:00
a97ae83a09 Fix T100703: Crash in file reading with ID's referenced from the WM
Don't decrement ID reference counts as any ID references from the
window-managers will have already been freed.

Reviewed By: mont29

Ref D15808
2022-08-30 19:41:48 +10:00
364f47c834 Merge branch 'blender-v3.3-release' 2022-08-30 11:24:58 +02:00
16938ab7d4 Update DPC++ to 20220812
This was already done in the libraries SVN, just the build system
changes got forgotten to be committed.
2022-08-30 11:23:35 +02:00
d2c0d86a38 EEVEE-Next: Register render passes for compositor.
EEVEE-Next passes were rendered to the render result, but didn't appear
in the compositor. Reasoning is that when a render engine has the update
render passes callback registered it would not register any default
render passes. This callback is used to update the Render Layer node.

This patch implements the callback for EEVEE-Next with the render passes
that are already available. In the future the callback should be
extended. Note that AO/SHADOW render passes have been disabled for now
as they need to be converted to color buffers.
2022-08-30 10:26:10 +02:00
a65676e6e9 GPencil: Rename in Outline operator mode with material_mode
The old name `mode` was confusing because there was also a `view_mode`.
2022-08-30 09:37:26 +02:00
e7f1c73a4e GPencil: Add thickness parameter to Outline operator
Instead to use always a value of 1, now the thickness of the stroke perimeter can be set.

This thickness is added to the original perimeter, so using a big number can increase the global thickness of the stroke.
2022-08-30 09:37:26 +02:00
c29d63aa5e Cleanup: spelling in comments 2022-08-30 16:22:49 +10:00
24b8ccaa94 Cleanup: format 2022-08-30 16:22:49 +10:00
26487530f2 Merge branch 'blender-v3.3-release' 2022-08-30 11:14:08 +10:00
e9fe4aa7d7 Fix Dirty Vertex Colors failure when no vertex colors existed 2022-08-30 11:12:55 +10:00
5ae3fa50e2 Cleanup: Remove misleading std::string reference binding
These functions that retrieve strings from assets return stringrefs.
Storing them as std::strings is unnecessary and relies on binding to
the const references.
2022-08-29 18:11:37 -05:00
6577d2df8c Cleanup: Use const for custom data layers 2022-08-29 17:00:46 -05:00
71b660571a Sculpt: Avoid creating mask and face set when remeshing
If these layers didn't exist on the original mesh, they would be created
from scratch and transferred anyway. That is inefficient because all the
work is pointless, and because creating these layers could slow down
subsequent sculpt operations.
2022-08-29 16:55:26 -05:00
dc92c5766f Merge branch 'blender-v3.3-release' 2022-08-29 14:55:04 -05:00
b814f64f4a Fix: Broken build with OpenVDB turned off
Problem with e3a6a2f412.
2022-08-29 14:50:26 -05:00
Tom Edwards
35df9f80b9 Fix T99576: Guard against empty names when removing attributes
It's possible for misbehaving scripts written before 3.3 to reach
this state and crash Blender. With this change, the error is reduced
to a Python exception.

Differential Revision: https://developer.blender.org/D15724
2022-08-29 14:45:55 -05:00
Pratik Borhade
68487cff95 Fix T98968: Node reroute tool doesn't add to frames
If reroute node lies in side the frame node boundaries then set
frame node as the parent of reroute.

Differential Revision: https://developer.blender.org/D15739
2022-08-29 14:45:01 -05:00
Pratik Borhade
50e5c78799 Fix T98968: Node reroute tool doesn't add to frames
If reroute node lies in side the frame node boundaries then set
frame node as the parent of reroute.

Differential Revision: https://developer.blender.org/D15739
2022-08-29 14:39:14 -05:00
7fbf72f148 Build: automatically disable WITH_GHOST_WAYLAND if missing libraries
Same as other build options, don't make it a hard requirement to have
Wayland libraries installed when it gets enabled by default.

Also fixes wayland-protocols not being found on the buildbot.
2022-08-29 19:51:07 +02:00
74caf77361 Cycles: add option to specify OptiX runtime root directory
This allows individual users or Linux distributions to specify a directory
Cycles will automatically look for the OptiX include folder, to compile kernels
at runtime.

It is still possible to override this with the OPTIX_ROOT_DIR environment
variable at runtime.

Based on patch by Sebastian Parborg.

Ref D15792
2022-08-29 19:50:20 +02:00
42cff95519 Cycles: disable Scrambling Distance UI when using Sobol Burley
Contributed by Alaska.

Differential Revision: https://developer.blender.org/D15794
2022-08-29 19:45:58 +02:00
21acfbe348 Cleanup: move Cycles display driver context handling to render module
This is highly coupled to Blender logic so doesn't belong in Cycles.
2022-08-29 19:45:58 +02:00
810e7c032c Cleanup: move part of render module to C++ 2022-08-29 19:45:58 +02:00
ff27457240 Allocator: add MEM_cnew_array
This is a more C++ friendly version MEM_calloc_arrayN, like MEM_cnew is for
MEM_callocN. For cases where data structures are still C and Vector or Array
don't work.
2022-08-29 19:45:58 +02:00
658ff994c5 Merge branch 'blender-v3.3-release' 2022-08-29 19:21:49 +02:00
805d1063a0 Cycles: Remove "return" and "assert" from oneAPI kernel code 2022-08-29 19:18:50 +02:00
dff15bb5bf Fix: Broken build with OpenVDB turned off
Problem with e3a6a2f412.
2022-08-29 12:12:16 -05:00
48e1a66af0 Merge branch 'blender-v3.3-release' 2022-08-29 18:21:56 +02:00
1cd8ca49f9 Cycles: Increased minimum supported driver for Windows in oneAPI 2022-08-29 18:10:56 +02:00
999c5c5c8d Fix (studio-reported) crash when linking/appending data in some cases.
Recent refactor (rB7be1c8bbae76f49f) removed a null check in WM code,
that is mandatory in some cases like e.g. liboverride apply code on
linked data.
2022-08-29 17:25:09 +02:00
1567dca657 Merge branch 'blender-v3.3-release' 2022-08-29 17:01:01 +02:00
e3a6a2f412 Fix T99004: scaling volume down results in crash
OpenVDB crashes when the determinant of the grid transformation is
too small. The solution is too detect when the determinant is too small
and to replace the grid with an empty one. If possible the translation
and rotation of the grid remains unchanged.

Differential Revision: https://developer.blender.org/D15806
2022-08-29 17:00:08 +02:00
Damien Picard
9120c86c3f I18n: disambiguate and make a few more strings translatable
Those strings were at least partly disambiguated:
- Area
  - Zone
  - Measurement
- Ease
  - BBone Ease In / Out
- Back
  - Camera BG image depth
  - GP interpolate sequence
- Edge Crease
  - Theme
- Jitter
  - Brush
  - GPencil
  - Lens distorsion compositing node
- Cineon color management
  - Black
  - Gamma
  - White

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15791
2022-08-29 16:04:03 +02:00
Damien Picard
0db582c41c Add missing RNA text for the MeshUVLoop struct
The structures in rna_mesh.c all had a UI text which showed up in the
animation editors, except for MeshUVLoop.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15803
2022-08-29 15:08:29 +02:00
Damien Picard
9bf5c37bee I18n: translate newly created node group sockets
Translate:
- new group socket names
  - default names Input and Output
  - on connecting a link from another node
- new geometry nodes input and output socket names

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15763
2022-08-29 14:26:10 +02:00
Damien Picard
73bfd8058f I18n: make add-ons' info translatable
The info provided by add-ons is very valuable to users, yet it wasn’t translatable yet.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15747
2022-08-29 14:12:21 +02:00
9823a8f72b Weight Paint: use coordinates from normal evaluated mesh if same topology.
Weight and Vertex paint don't change coordinates and thus don't need
crazyspace data, which allows using coordinates from normal evaluated
meshes.

Since painting uses original topology, the deform only mesh is used,
but if the fully evaluated mesh has the same topology, it is preferred.
This is useful because not only Geometry Nodes, but even simple weight
computation modifiers are excluded from the deform only mesh evaluation.

Differential Revision: https://developer.blender.org/D15501
2022-08-29 14:10:31 +03:00
e460050099 Merge branch 'blender-v3.3-release' 2022-08-29 12:45:14 +02:00
7bb08882ec I18n: Better wording for the skipped languages in language menu file. 2022-08-29 11:05:03 +02:00
613b6ad9e5 GPencil: New conversion to outline in draw mode
This new option converts the stroke to outline perimeter as soon as is drawn.

If no alternative material is set, the actual material is used.

The algorithm is similar to the new operator in D15664

Reviewed By: pepeland

Differential Revision: https://developer.blender.org/D15738
2022-08-29 09:47:08 +02:00
377b81ac07 Fix compilation issue in MTLQueryPool::allocate_buffer.
This compilation issue happened due to multiple patches being handled at the same
time one overwriting a correction of the other.
2022-08-29 08:34:47 +02:00
c4d9dca4a6 Cleanup: Add missing override keyword in mtl_backend. 2022-08-29 08:31:56 +02:00
91b88d3d94 Merge branch 'blender-v3.3-release' 2022-08-28 17:55:42 -04:00
7b56c74881 Update RNA to User manual mappings 2022-08-28 17:53:49 -04:00
e0414070d9 Cleanup: Slightly improve virtual array implementation consistency
Previously the base virtual array implementation optimized for
common cases where data is stored as spans or single values.
However, that didn't make sense when there are already
sub-classes that handle those cases specifically. Instead,
implement the faster materialize methods for each class.
Now, if the base class is reached, it means no optimizations
for avoiding virtual function call overhead are used.

Differential Revision: https://developer.blender.org/D15549
2022-08-28 14:40:49 -05:00
67f3259c54 Curves: Avoid creating types array when unnecessary
When the curve type attribute doesn't exist, there is no reason to
create an array for it only to fill the default value, which will add
overhead to subsequent "add" operations. I added a "get_if_single"
method to virtual array to simplify this check. Also use the existing
functions for filling curve types.

Differential Revision: https://developer.blender.org/D15560
2022-08-28 14:33:03 -05:00
28750bcf7e Cleanup: replace NULL with nullptr for C++ files 2022-08-28 20:52:28 +10:00
7269ee4dbb Cleanup: use const FontBLF arguments 2022-08-28 20:46:53 +10:00
206272621e Merge branch 'blender-v3.3-release' 2022-08-28 20:21:32 +10:00
4694d497b7 Merge branch 'blender-v3.3-release' 2022-08-28 20:19:02 +10:00
ff78f79abc Merge branch 'blender-v3.3-release' 2022-08-28 20:18:58 +10:00
7de290ea08 Fix crashes running operators in invalid contexts
Fix for running operators outside of expected contexts.

- UI_OT_view_drop (poll)
- UI_OT_view_item_rename (poll)
- OBJECT_OT_gpencil_modifier_move_to_index
- OBJECT_OT_modifier_move_to_index
- OBJECT_OT_geometry_nodes_input_attribute_toggle
- OBJECT_OT_geometry_node_tree_copy_assign
- OBJECT_OT_shaderfx_remove
- OBJECT_OT_shaderfx_copy
- POSE_OT_relax (& other pose slide operators).
2022-08-28 20:18:12 +10:00
219d109575 Fix crash in gpencil.brush_reset_all referencing freed memory
A reference to the active brush was kept even when it was freed.
2022-08-28 20:00:14 +10:00
1f9d0acfa9 Fix running transform without a region
Running transform in background mode or without a region would crash.
2022-08-28 19:55:52 +10:00
ff7a7a6f77 Merge branch 'blender-v3.3-release' 2022-08-27 09:12:14 +02:00
f7ce20e340 Cleanup: Remove two files committed by mistake.
Committed in rB3c7a6718ddc.
2022-08-27 09:09:41 +02:00
d527aa4dd5 UV: support constrain-to-bounds for uv rotation operator
Differential Revision: https://developer.blender.org/D15730
2022-08-27 17:01:55 +12:00
7459c0228e Cleanup: rename filename to filepath when used for full paths 2022-08-27 14:52:31 +10:00
d41acc23e1 CMake: include missing header files 2022-08-27 14:32:50 +10:00
bfca876c05 CMake: cleanup, rename INC_HD_CYCLES to SRC_HD_CYCLES_HEADERS
Our convention is to use `INC_*` for include directories,
this caused `make check_cmake` to incorrectly fail as it expected
these files to be include directories.
2022-08-27 14:32:50 +10:00
3cba80039d UV: bpy_extras.mesh_utils.mesh_linked_uv_islands raises error in edit mode
Maniphest Tasks: T86484

Differential Revision: https://developer.blender.org/D15778
2022-08-27 16:09:17 +12:00
f7027f2253 Cleanup: simplify key input handling for GHOST/Win32
- Don't create utf8 text for key release events.
- Reduce variable scope.
2022-08-27 13:47:17 +10:00
95162e7157 Cleanup: add missing braces for GHOST/Win32 2022-08-27 13:11:34 +10:00
de1a2d7988 Cleanup: pass notifiers as const 2022-08-27 12:54:26 +10:00
578dff7863 Fix assertion when notifiers weren't removed from the notifier queue set
Since [0] notifiers were cleared and left in the queue, while harmless
it meant the call to remove the notifier from the set was redundant.

Now set aside a category to tag notifiers as having been cleared and
skip them entirely.

[0]: 0aaff9a07d
2022-08-27 12:28:18 +10:00
955032ffb0 Cleanup: use C style comments for GHOST/Win32 text 2022-08-27 11:24:49 +10:00
37d835f0bc Fix T100582: Windows-10 Switching Desktops locks Ctrl Key
Regression in recent fix for T66088 [0]. caused by much older problem
introduced with [1] & [2].

Unlike other platforms, as of [1] GHOST/Win32 was keeping track of the
pressed modifier keys.

Since GHOST/Win32 cleared the modifier state on window activation [2]
and only changes to modifier state would generate key events, activating
the window and releasing the modifier would not send the release event.

Resolve this by removing the stored modifier state from GHOST/Win32,
always passing modifier press/release events through to Blender
(matching other GHOST back-ends).
Instead, use key-repeat detection to prevent repeated modifier keys
from being generated - an alternate solution to T26446.

[0]: 8bc76bf4b9
[1]: d6b43fed31
[2]: 6b987910e4
2022-08-27 07:36:00 +10:00
07ccb9b573 Cleanup: use 'len_v2'
Simplifies readability and avoids repeat casts.
2022-08-26 16:10:22 -03:00
6bea434c41 Cleanup: Move bmesh_query_uv.c to C++
Helpful for D14365.
2022-08-26 13:56:50 -05:00
6a9cf59ce1 Merge branch 'blender-v3.3-release' 2022-08-26 15:35:18 -03:00
e040aea7bf Transform: Use more general approach to node view update
With rBe6a557952ead, concerns were reported about missing updates when
the view is moved other than through the Edge Pan system.

Although the transform operator blocks navigation in general, it is
good to avoid these cases.
2022-08-26 15:34:38 -03:00
da022f3f48 Merge branch 'blender-v3.3-release' 2022-08-26 14:19:34 -03:00
0c8de0eb3b Fix T100632: Regression: Node border snap guide line not drawing properly
Caused by {rBd2271cf93926}.

Color values were being used without being initialized.
2022-08-26 14:18:11 -03:00
e6a557952e Fix T100633: Node Editor: Edge scrolling breaks node snapping
The view offset, calculated by the Edge Pan system, only affects the
position of the nodes, but forget to update:
- snapping data
- final value of transform
- values used for custom drawing

Therefore, to avoid having to update a lot of scattered data, the
`transformViewUpdate` utility has been implemented to recalculate input
values when the view changes.

This utility does more than is necessary to fix the bug, but with that,
it can work in any situation.
2022-08-26 14:17:55 -03:00
3c060b2216 Fix T100633: Node Editor: Edge scrolling breaks node snapping
The view offset, calculated by the Edge Pan system, only affects the
position of the nodes, but forget to update:
- snapping data
- final value of transform
- values used for custom drawing

Therefore, to avoid having to update a lot of scattered data, the
`transformViewUpdate` utility has been implemented to recalculate input
values when the view changes.

This utility does more than is necessary to fix the bug, but with that,
it can work in any situation.
2022-08-26 13:17:51 -03:00
cc9c4e2744 CustomData: Add function to get name of default layer
Used by D14365
2022-08-26 11:16:10 -05:00
167e2fda15 Merge branch 'blender-v3.3-release' 2022-08-26 18:09:05 +02:00
8181494ffe Fix assert in id remapper tests.
Was using uninitialized ID name, leading to unknown ID type.

Thanks at Ray molenkamp (@LazyDodo) for noting the issue.
2022-08-26 18:08:46 +02:00
aaea263be4 Cleanup: Fix const correctness in CustomData set name function
The function does modify the object since it changes the name of a layer
it owns. Ideally this wouldn't be possible, but raw pointers don't have
ownership semantics so this is a common problem with CustomData.
2022-08-26 10:57:43 -05:00
Luis Pereira
763cafc2b1 Fix T55284: error in Hybrid MultiFractal Musgrave texture
The calculation was revised to address two issues:
* Discontinuities occurring when detail was a non-integer greater than 2.
* Levels of detail in the interval [0,1) repeating the levels of detail in
  the interval [1,2).

This fixes Cycles, Eevee and geometry nodes.

Differential Revision: https://developer.blender.org/D15785
2022-08-26 17:27:43 +02:00
a1c8a17b4d IDManagement: fix missing WM name validation when using "keep current WM list" code path
The blendfile_liblink and blendfile_io python tests in debug fired an
assert that WMWinMan object was in Main database, but not in the ID
name map. This was caused by wm_window_match_do going into case 3
there: the new WM list is completely empty, the old list is not empty,
and it was directly using the old/current list (via
wm_window_match_keep_current_wm function), without actually
registering/validating the objects in it through the name map.

Reviewed By: Bastien Montagne
Differential Revision: https://developer.blender.org/D15787
2022-08-26 12:15:12 +02:00
51178fd4da UV: improve consistency for scale parameter of uvcalc_randomize_transform 2022-08-26 21:19:46 +12:00
3e51ebaf54 IDManagement: fix missing WM name validation when using "keep current WM list" code path
The blendfile_liblink and blendfile_io python tests in debug fired an
assert that WMWinMan object was in Main database, but not in the ID
name map. This was caused by wm_window_match_do going into case 3
there: the new WM list is completely empty, the old list is not empty,
and it was directly using the old/current list (via
wm_window_match_keep_current_wm function), without actually
registering/validating the objects in it through the name map.

Reviewed By: Bastien Montagne
Differential Revision: https://developer.blender.org/D15787
2022-08-26 11:49:02 +03:00
e1f8136230 Merge branch 'blender-v3.3-release' 2022-08-26 09:16:46 +02:00
60420f6ea4 Fix T100602: Incoming Vector in world shader for Eevee is inverted
Regression from {rBf4d7ea2cf61} where the direction was flipped.

Maniphest Tasks: T100602

Differential Revision: https://developer.blender.org/D15779
2022-08-26 09:13:55 +02:00
054cec404b Cleanup: use booleans 2022-08-26 15:58:32 +10:00
6bf2c73249 Cleanup: quiet GCC array bounds warning 2022-08-26 15:06:33 +10:00
e77ac31799 makesrna: type check bool/int/float/enum get/set callbacks
While converting types from callbacks isn't a bug, it's unlikely
we ever want to do this on purpose and can hide mistakes such as
silently converting floating point values to ints as happened
with Sequencer.frame_start.
2022-08-26 14:43:16 +10:00
5bd4aea29c Cleanup: use matching function signatures for RNA callbacks
Use matching int/float/boo types for RNA callbacks.
2022-08-26 14:37:16 +10:00
4a0dd1d435 Merge branch 'blender-v3.3-release' 2022-08-26 14:26:55 +10:00
c9723d9464 Fix Sequence.frame_start being rounded to int when assigned 2022-08-26 14:22:58 +10:00
65cd265235 CMake: disable IME for lite configuration 2022-08-26 13:28:45 +10:00
6fc7b37583 Cleanup: reduce variable scope 2022-08-26 12:51:46 +10:00
a3e1a9e2aa Cleanup: spelling in comments, format 2022-08-26 12:47:21 +10:00
ef51825c06 Fix incorrect UI scaling after changing monitors DPI under Wayland
Add a GHOST_kEventWindowDPIHintChanged event to ensure the UI is
properly updated.
2022-08-26 12:37:08 +10:00
047d0e6c4a Merge branch 'blender-v3.3-release' 2022-08-25 17:26:58 +02:00
Bastien Montagne
500d815478 Fix T100255: Make RigidBodyWorld (and effector_weights) collections refcounted.
Those collections were so far mainly just tagged as fake user (even
though a few places in code already incremented usercount on them).

Since we now clear the fakeuser flag when linking/appending data, ensure
that these collections are preserved by making these usages regular ID
refcounting ones.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D15783
2022-08-25 17:21:39 +02:00
9b41ac6251 Revert "LibOverride: Preserve viewlayers when creating overrides of collecitons."
Commit is not working as expected in some cases, as revealed by
liboverride testcase entering infinite loop.

Code needs some more thinking.

This reverts commit ee7bd79b54.
2022-08-25 16:17:34 +02:00
093607423d Merge branch 'blender-v3.3-release' 2022-08-25 12:23:27 +02:00
b27856f12e Update liboverride operators to manual mapping. 2022-08-25 12:23:10 +02:00
ee7bd79b54 LibOverride: Preserve viewlayers when creating overrides of collecitons.
Usually, when overriding collections, the linked reference ones are
removed from the ViewLayer, and the overrides replace them.

This change to `layer_collection_sync` code makes it so that in case
there is a free viewlayer hierarchy matching the linked collection, it
gets re-used for the override one, instead of re-creating everything
from scratch.

To achieve this, resync process is split into two steps, first regular
collections are processed, then the override ones. This should ensure
an override does not steal the layers of its reference if the later is
still instantiated in the view layer.
2022-08-25 12:22:38 +02:00
d4764a385a Merge branch 'blender-v3.3-release' 2022-08-25 11:50:55 +02:00
9c2bc57cbd Fix Cycles oneAPI for a newer DPC++ compiler version 2022-08-25 11:50:22 +02:00
e50c7a244b Merge branch 'blender-v3.3-release' 2022-08-25 09:25:22 +02:00
714a3739da Fix T100599: dont reset parent inverse setting parent type the same
Since rBb100bdca25b1 the parent inverse was always reset in
ED_object_parent (also for just changing the parent type).

This does make sense (since there is no point keeping it when e.g
changing from "Bone" to "Object" or "Vertex" to "Object", for this to
really make sense it would have to be properly recalculated anyways
which does not happen afaict).

The reported issue was that setting the prop to the same value as it was
before (e.g. from "Object" to "Object") would still reset the parent
inverse which was really unexpected since from a user standpoint,
nothing has changed here.

So in case the value does not really change, we now just early out and
skip `ED_object_parent`.

Maniphest Tasks: T100599

Differential Revision: https://developer.blender.org/D15771
2022-08-25 09:22:55 +02:00
96d8367924 PyAPI: return faces instead of indices from bmesh_linked_uv_islands
Return faces instead of face indices from bmesh_linked_uv_islands
since BMesh indices aren't reliable when geometry is added/removed,
where the faces will still be valid.
2022-08-25 17:05:50 +10:00
012db9e820 Cleanup: replace dict with set for bmesh_utils.bmesh_linked_uv_islands
Also correct doc-string syntax.
2022-08-25 16:41:22 +10:00
de570dc87e Fix T78406: create uv randomize islands operator
Implement a new operator to randomize the scale, rotation and offset
of selected UV islands.
2022-08-25 18:09:32 +12:00
f36d8d59c2 Cleanup: remove redundant calculation in bmo_poke_exec
Mistake in [0] calculated the mean-face-center which wasn't used.

0: 23344bca6c
2022-08-25 15:14:34 +10:00
fcecbc5610 Cleanup: rename mat3_to_quat_is_ok to mat3_to_quat_legacy
Update comment, noting why this is kept.
2022-08-25 14:33:01 +10:00
be40f31d03 Keyframing: replace mat3_to_quat_is_ok with mat4_to_quat
Added [0] which notes in most cases results are the same but in some
cases the result seems better. While true at the time of writing since
then mat3_to_quat has been improved and used for nearly all matrix
to quaternion conversion.

0: 876cfc837e
2022-08-25 14:32:34 +10:00
a7650c6206 BLI_math: ensure non-negative matrices for mat3_to_quat calculations
Making the callers responsible for this isn't practical as matrices are
often passed indirectly to a functions such as mat3_to_axis_angle,
BKE_object_mat3_to_rot & BKE_pchan_mat3_to_rot.
Or the matrix is combined from other matrices which could be negative.

Given quaternions calculated from negative matrices are completely
invalid and checking only needs to negate matrices with a negative
determinant, move the check into mat3_to_quat and related functions.

Add mat3_normalized_to_quat_fast for cases no error checking on the
input matrix is needed such as blending rotations.
2022-08-25 13:48:31 +10:00
8593228a13 Cleanup: remove outdated, unhelpful comments 2022-08-25 13:36:54 +10:00
9f1c05d5cb Fix matrix/quaternion conversion with negative scaled cameras 2022-08-25 12:38:04 +10:00
a604ed0068 Fix accessing freed memory for GHOST/Wayland clipboard access 2022-08-25 10:52:36 +10:00
Mattias Fredriksson
87e8810dd0 Cleanup: Add asserts to curves data-block creation
Ref D14481
2022-08-24 18:22:39 -04:00
Mattias Fredriksson
1dae11ccb5 Cleanup: Improve comments
Add to comments in curves header, fix typo in attribute header.

Ref D14481
2022-08-24 18:22:29 -04:00
f593a560d3 Cleanup: Deduplicate RNA mesh element index retrieval
Reuse the subtraction, which simplifies adding assertions
and refactoring to remove the custom data pointers.
2022-08-24 15:41:55 -04:00
b19c51c7f4 Cleanup: Move outliner types to namespace, avoid C-style type definition
With C++ we should transition towards namespaces to avoid naming
collisions. Having the namespace in place is the first step for that
transition.

Plus, the `typedef` isn't necessary for struct/class/enum definitions
in C++, so avoid the verbosity it adds.
2022-08-24 20:10:15 +02:00
ce1f401b42 Merge branch 'blender-v3.3-release' 2022-08-24 19:17:14 +02:00
3a1ea04d46 Cleanup warning about missing pointer casting. 2022-08-24 19:16:18 +02:00
fc26e3fe19 Cleanup: Fix typo in comment
Added by mistake in 6718afdc8a.
2022-08-24 11:25:04 -04:00
5d4d5a2162 Merge branch 'blender-v3.3-release' 2022-08-24 17:12:01 +02:00
8b7293eb41 LibOverride: Fix (unreported) crashes in some cases, preserve active object on Clear, general cleanup.
Inconsistencies in update/tagging code between different code doing the
same 'Clear. liboverride operation lead to crashes in some cases.

Unify deg tagging and WM notifiers accross the three editor-level
codepaths performing the common Make/Reset/Clear operations.

Preserve if possible the active object accross Clear operation.

Several cleanup/rename/re-arangement of code to make it more consistent.
2022-08-24 17:11:36 +02:00
24dc84f156 Cleanup: rename new IDTemplate operator to create overrides to make.
Matches other operators' names and UI labels better.
2022-08-24 17:11:36 +02:00
61896947d4 Merge branch 'blender-v3.3-release' 2022-08-24 15:39:52 +02:00
e65f0337e9 Fix WITH_CYCLES_ONEAPI_BINARIES issues with make release
Fix typo in blender_release.cmake, and ensure that "make release" still works
when ocloc is not available. While a fatal error is useful for debugging, the
current convention is to disable features, especially in cases like this where
there is no simple way to make the feature work.

Differential Revision: https://developer.blender.org/D15774
2022-08-24 15:38:27 +02:00
be0a68f0d1 BLI_math: assert mat3_normalized_to_quat doesn't use a negative matrix
Add an assert to ensure callers don't pass in negative matrices as the
resulting quaternion is invalid.
2022-08-24 20:45:17 +10:00
489aeda034 Merge branch 'blender-v3.3-release' 2022-08-24 20:40:43 +10:00
8c38a994c6 Fix Quaternion.rotate(matrix) with negative matrices
Rotating a quaternion by a negative matrix gave an invalid result.

Follow up fix for T94231 which negated negative matrices too.
2022-08-24 18:59:04 +10:00
dc2d75d9bc Merge branch 'blender-v3.3-release' 2022-08-24 17:27:25 +10:00
62f764fad7 Fix T100606: Apply object transform fails with delta quaternion rotation
Apply transform failed to clear delta quaternion & axis-angle rotation.
2022-08-24 17:26:38 +10:00
02d13c2d2f Merge branch 'blender-v3.3-release' 2022-08-24 09:17:51 +02:00
62bd007646 Fix T100590: Crash when changing active image texture node
Mistake in own rBc76d7f7bde35.
Happened when no image was set in the Image Editor already (which is now
checked for).

Maniphest Tasks: T100590

Differential Revision: https://developer.blender.org/D15761
2022-08-24 09:15:14 +02:00
4fb64068a7 Cleanup: use determinant_m3(m) < 0 to implement is_negative_m3/m4
Use a more direct method of checking if a matrix is negative instead of
using cross & dot product.

Also replace some determinant_m3() < 0 checks with is_negative_m3.
2022-08-24 16:34:04 +10:00
f39c9d1596 Merge branch 'blender-v3.3-release' 2022-08-24 16:09:13 +10:00
10a4726a5b Fix T94231: Matrix.to_quaternion() returns invalid rotation
The result of mat3_normalized_to_quat isn't valid for negative matrices.

Isolate the fix to the Matrix.to_quaternion() instead of changing
mat3_normalized_to_quat to prevent unintended side effects elsewhere.
2022-08-24 16:07:56 +10:00
be81690b73 Merge branch 'blender-v3.3-release' 2022-08-24 10:20:52 +10:00
112a2c0627 Fix error from 21ea499558
Was not using the absolute index for comparison,
breaking the id_management test.
2022-08-24 10:20:05 +10:00
649807a8cd Cleanup: format 2022-08-24 09:22:26 +10:00
a6056b870b Fix T100494: Broken sculpt hide status undo/redo
Caused by 2480b55f21 using the undo step indices instead of the
indices of vertices in the mesh, causing the hide values to be swapped
around randomly in the mesh.
2022-08-23 14:09:46 -04:00
e36ced1dce Fix: Write hide status attributes for undo steps
We don't convert to the old mesh format when writing undo steps to
avoid overhead. So we can't skip writing the hide attributes then.
2022-08-23 13:50:47 -04:00
35c601269b Fix T100482: Face Set visibility reset after saving
The face hide attribute wasn't created in order to store the visiblity
from the face sets, it was only updated if it already existed.
2022-08-23 12:17:16 -04:00
486d27d32a Cleanup: Move paint.c to C++ 2022-08-23 12:01:37 -04:00
59aef1d717 Cleanup: Use utility to write palette color list 2022-08-23 11:19:07 -04:00
b649fc13ed Cleanup: Avoid using invalid attribute domain
The number of attribute domains isn't an attribute domain, so storing
ATTR_DOMAIN_NUM in a variable with an eAttrDomain type isn't correct.
In the cases it was used, the value wouldn't be accessed anyway.
2022-08-23 10:44:10 -04:00
c32bb58e5b Depsgraph: use more fine grained update tags for scenes
Ref D15710, this avoids unnecessary sequencer updates for some operations.
2022-08-23 15:27:16 +02:00
a87d3edb98 Build: add system for shipping with dynamic libraries on Linux and macOS
PLATFORM_BUNDLED_LIBRARIES gathers shared libraries that will be installed
to the lib/ folder. The Blender executable gets a relative rpath pointing to
this folder as part of the install step.

The build rpath is different and uses absolute paths, so that it works for
executables like tests that are in different locations, and to support the
case where the build and install folders are different.

The system is already used for the OpenMP library on macOS. But on Linux it
will only kick in once we start using shared libraries for dependencies.

This also removes Mesa libraries from the old location, as these would cause
Blender to start with software OpenGL.

Ref T99618
2022-08-23 15:27:16 +02:00
afb74149c1 Cleanup: consistent variable names for install target directories 2022-08-23 15:27:16 +02:00
ddad2f8672 Build: use package instead of git repo for sse2neon
More consistent with other libs and avoids issues where it would always be
rebuilt.
2022-08-23 15:27:16 +02:00
a77a1bcae7 Merge branch 'blender-v3.3-release' 2022-08-23 15:09:50 +02:00
efc9faef23 Fix T98954: Color management is very slow with sequencer sound
Function `rna_ColorManagement_update` tagged unnecesary updates.

Reviewed By: sergey, brecht

Differential Revision: https://developer.blender.org/D15710
2022-08-23 15:08:46 +02:00
21ea499558 Fix T100286: Crash accessing freed depsgraph object instances
Invalidate depsgraph.object_instances when freed, this resolves a crash
when accessing the object instances after iteration has finished.

Unlike most other collections, object_instances is only valid while the
iterator is in-memory.

The Python/RNA API needs to inline int/string collection lookups so the
Python instance can be created before the iterator ends.

Reviewed By: mont29, sergey

Ref D15755
2022-08-23 22:56:54 +10:00
ffb6cc263f Cleanup: format 2022-08-23 22:55:48 +10:00
Jeroen Bakker
37533cd6cb ImBuf: Optimize GPU memory by using 1 component format for grayscale images
This is done by checking the number of bitplanes from the image buffer.
We assume that for float buffer to use the same bitplanes as it was a
byte buffer.

Then, the data of the image buffer is packed at the start of the `rect` or
`float_rect` before upload.

**Statistics - einar.v004.blend **

Note that not all grayscale textures have been stored as BW images so the
amount of memory that can be reduced would be more.

Without patch
```
104 Textures - 3294.99 MB (3294.47 MB over 32x32), 37 RTs - 192.52 MB.
Avg. tex dimension: 2201.88x1253.51 (2283.53x2202.13 over 32x32)
464 Buffers - 25.01 MB total 1.24 MB IBs 23.50 MB VBs.
3512.52 MB - Grand total GPU buffer + texture load
```

Patch applied
```
104 Textures - 2917.66 MB (2917.14 MB over 32x32), 39 RTs - 215.45 MB.
Avg. tex dimension: 2221.38x1252.75 (2323.28x2253.47 over 32x32)
467 Buffers - 25.01 MB total 1.24 MB IBs 23.51 MB VBs.
3158.13 MB - Grand total GPU buffer + texture load.
```

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D15484
2022-08-23 14:35:39 +02:00
13b2716e1c Merge branch 'blender-v3.3-release' 2022-08-23 14:25:18 +02:00
65870821da Fix: OBJ import unused parameter warning
Since {rB2542fda14d85}, `r_node` is an unused parameter.
Changed `load_texture_image` to reflect that.

Differential Revision: https://developer.blender.org/D15759
2022-08-23 14:22:23 +02:00
Philipp Oeser
0bc95b7b40 Compositor: handle NODE_DO_OUTPUT in RNA when setting a node active
Main motivation is from T54314 where there was no way to read from a
Viewer image datablock after setting another viewer node active.

Part of the problem was addressed in rB16d329da284c (where handlers for
the compositing background job were added so that you can act after the
compositor has run), however there was still the remaining issue that
setting another viewer node active would not properly tag the node
NODE_DO_OUTPUT. This forced users into a complicated workaround (using
switch nodes feeding into a single viewer node).

Now handle NODE_DO_OUTPUT properly in RNA, too, and do proper updates so
that behavior from RNA matches that of the Node Editor when setting a
viewer node active.

ref T54314.

Reviewed By: JacquesLucke

Maniphest Tasks: T54314

Differential Revision: https://developer.blender.org/D15203
2022-08-23 14:22:04 +02:00
60e2dfd1e8 Fix T99524: GPencil not updating when frame num is changed
When changing the frame_number of a grease pencil frame, the grease
pencil object is not updated correctly. The frame stays where it
previously was.

The fix adds a `property_update` callback to the `frame_number` RNA
property.

Maniphest Tasks: T99524

Reviewed By: antoniov

Differential Revision: https://developer.blender.org/D15394
2022-08-23 13:53:44 +02:00
511ff898da Merge branch 'blender-v3.3-release' 2022-08-23 12:40:58 +02:00
1663530408 Fix T100318: handle custom nodes in field inferencing more gracefully
Custom nodes are not supported, but it shouldn't crash here.
2022-08-23 12:40:26 +02:00
65c6886284 Merge branch 'blender-v3.3-release' 2022-08-23 11:55:57 +02:00
95464a842c Fix T99932: video in node group does not play 2022-08-23 11:54:51 +02:00
Damien Picard
4ac96a483b I18n: make workspaces translatable
This makes workspaces more translatable:
- New Workspace menu
  - header
  - preset menus
  - preset entries
- workspace names upon factory file template load
- new workspace name upon workspace addition

To properly translate those names, an extraction function for
workspace names from app templates was added as well.

(Do not do anything when loading a user-saved file!)

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15727
2022-08-23 11:54:34 +02:00
22fdb88be5 Merge branch 'blender-v3.3-release' 2022-08-23 11:19:08 +02:00
d269ad3535 Fix T100578: Surface Deform modifier displays wrong in editmode
This was the case when the "Show in Editmode" option was used and a
vertexgroup affected the areas.

Probably an oversight in {rBdeaff945d0b9}?, seems like deforming
modifiers always need to call `BKE_mesh_wrapper_ensure_mdata` in
`deformVertsEM` when a vertex group is used.

Maniphest Tasks: T100578

Differential Revision: https://developer.blender.org/D15756
2022-08-23 11:07:26 +02:00
c76d7f7bde Fix T99493: better syncing between Node Editor and Image Editor
Since {rBb0cb0a785475}, changing the active texture in the Node Editor
would also change the current image in the Image Editor.
While this was an overall improvement, this was not desired when the
image currently looked at was a `Render Result` or a `Viewer Node`
(artists usually want to keep focus on these).

With this patch, syncing the active texture change from the Node Editor
to the Image Editor will now only happen if the Image Editor's current
image is not a Render Result or a Viewer Node.

NOTE: Syncing the active paint slot to the Image Editor still happens
(even if the Image Editor's current image is not a Render Result or a
Viewer Node), behavior was not changed since this is a much more
explicit action while texture painting and probably desired in that
case.

Maniphest Tasks: T99493

Differential Revision: https://developer.blender.org/D15749
2022-08-23 11:07:08 +02:00
a3548667bc Merge branch 'blender-v3.3-release' 2022-08-23 10:58:00 +02:00
5d67b52441 Fix T100562: Realize Instances node crashes when there is an attribute name collision 2022-08-23 10:57:28 +02:00
56205e9f31 Fix T100579: internal links are drawn when sockets are hidden 2022-08-23 10:35:38 +02:00
6319dcb230 Fix: Missing compositor domain priority for filter nodes
Domain priorities were accidentally left out of the patches for the
filter nodes. This patch adds them appropriately.
2022-08-23 09:33:28 +02:00
655e9eabc3 Cleanup: Turn filter node methods into an Enum
This patch turns the filter node methods into an enum and renames the
members from FILT into FILTER for easier writing.
2022-08-23 09:24:25 +02:00
78061e6c3e Fix: Compositor results are fuzzy with bilinear filtering
The realtime compositor sometimes produces fuzzy results when the
interpolation is set to bilinear. This was due to the domain realization
shader, which incorrectly sampled the input image.

This patch fixes such fuzziness by introducing a 0.5 offset to evaluate
the sampler at the center of pixels. Additionally, it makes sure the
centring offset is an integer offset by taking its floor, retaining the
previous 0.5 offset even with the difference in size is odd.
2022-08-23 09:06:16 +02:00
35cc755366 Cleanup: simplify partition functions
- Assign return arguments last instead of manipulating them.
- Remove redundant NULL assignment of return arguments.
2022-08-23 12:48:06 +10:00
7694678025 Cleanup: remove unnecessary NULL check 2022-08-23 12:18:01 +10:00
ee60aa9d01 Cleanup: match names between functions & declarations 2022-08-23 11:05:50 +10:00
a65e4e6139 check_cppcheck: skip files that hang, minor improvements
- Skip text_format_pov.c & text_format_pov_ini.c which caused
  cppcheck to hang.
- Enable '--inconclusive' checks as they can be useful.
2022-08-23 11:01:02 +10:00
7f6cd405b9 Merge branch 'blender-v3.3-release' 2022-08-22 18:16:09 +02:00
4fecf652e2 Fix T100568: triangulate node resets vertices to rest position
The triangulate node is not supposed to take shape keys into account.
This was likely a mistake in rBabf30007abdac2a5bf3a1.
2022-08-22 18:15:33 +02:00
3345e8ed3c Merge branch 'blender-v3.3-release' 2022-08-22 16:31:53 +02:00
Iliya Katueshenock
5fff6c419c Fix T100258: wrong spline length used in Spline Parameter node
Differential Revision: https://developer.blender.org/D15705
2022-08-22 16:30:18 +02:00
de00b892a7 Merge branch 'blender-v3.3-release' 2022-08-22 16:13:30 +02:00
Sonny Campbell
8265d08e7f Fix T90706: crash when deleting fluid sim geometry
Differential Revision: https://developer.blender.org/D15299
2022-08-22 16:00:39 +02:00
500e4d540a Merge branch 'blender-v3.3-release'
Conflicts:
	release/scripts/startup/bl_ui/space_userpref.py
2022-08-22 15:44:44 +02:00
Damien Picard
0b2be4fbc3 I18n: Fix lighting preferences error messages
While the current situation sort of works, a proper translation cannot
be achieved in every language. Separate messages for each lighting
type.
2022-08-22 15:34:27 +02:00
4ad471d67f I18n: systematically tag all messages in RNA_ENUM_ITEM_HEADING.
Add missing labels, and also add tooltips.

Unfortunately there is no way currently to extract two messages from a
single 'function' call, so unless those type of macros become very
widely used, would keep it as manual tagging.

Also disambiguate `case` in text context, pretty sure English is one of
the very rare languages to use this word for character case too.
2022-08-22 15:24:21 +02:00
Damien Picard
ee985fa925 I18n: disambiguate a few translations
- Keying (keyframe insertion)
- Roughness (particle children)
- New image, collection, text (in menus)
- Parents (particles)
- Wrap (text)
- Light (add menu)
- Empty (volume add menu)
- Empty (empty add menu)
- Cycles (f-curve modifier)
- Drag (workspace tool type)
- Power (light intensity)
- Power (math nodes)

This last change also moves all math operations in nodes to the
ID_nodetree context. It's needed only for some operations, but we
can't be more granular here.

Also...

- Fix context extraction for interpolation mode headers in F-Curves
  and GPencil interpolation operator
- Enable new translation: "Slot %d" in image editor
- Fix an English message in the node editor:
  "Replace the input image's alpha channels by..." -> channel

Ref. T43295

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15694
2022-08-22 14:33:07 +02:00
ba74704c9a Merge branch 'blender-v3.3-release' 2022-08-22 12:16:11 +02:00
c973d333da Fix T100527: Right click in the attribute name field crashes blender.
`UI_context_active_but_prop_get_templateID` became much more widely used
with recent rBfec254364884, which revealed that it did not do any check
on actual type of data it accesses, resulting easily in undefined
behavior.

Now also check the callback function pointer, this should be safe
enough.

Patch by @Severin (Julian Eisel), many thanks!
2022-08-22 12:15:50 +02:00
ad577d3b69 Merge branch 'blender-v3.3-release' 2022-08-22 11:49:32 +02:00
f29f023017 Enable oneAPI AoT binaries on Windows 2022-08-22 11:49:00 +02:00
b72c658cfd Enable oneAPI AoT binaries on Windows 2022-08-22 11:47:18 +02:00
9e23ab9f37 Fix: Memory leak in realtime compositor
There was a memory leak in the GPU code generator for the compositor
output. It was just due to a missing free in the GPU code generator
destructor, so this patch makes sure it is freed.
2022-08-22 10:57:24 +02:00
79dfd2eb7b EEVEE-Next: Fix shader compilation error.
This fixes a compilation error in eevee_light_culling_debug shader.

Some compilers complained when accessing the same data twice. Unclear
why. We should investigate that this change doesn't harm the performance
of the shader.

Although the light is a local variable it might clutter available
registers. If so it will harm developers during debugging.
2022-08-22 10:44:46 +02:00
d966ce718b EEVEE-Next: Fix shader compilation error.
Due to a copy-paste error there was an out of bound read. Some drivers
didn't complain about it, others did. This patch fixes the compilation
error by accessing the array within bounds.
2022-08-22 10:36:38 +02:00
0aeae0d0b9 Revert "Fix T99259: Python API: ViewLayer.aovs.remove isn't available"
This reverts commit ae7909010f.
2022-08-22 08:40:36 +02:00
Mangal Kushwah
ae7909010f Fix T99259: Python API: ViewLayer.aovs.remove isn't available
Imeplemented **ViewLayer.aovs.remove** by Adding a new rna function to call the internal **BKE_view_layer_remove_aov**, removed assert from **BKE_view_layer_remove_aov**.

Reviewed By: jbakker

Maniphest Tasks: T99259

Differential Revision: https://developer.blender.org/D15341
2022-08-22 08:36:19 +02:00
9581be930b Cleanup: remove dead code 2022-08-22 12:42:23 +10:00
2a43c9bb08 Cleanup: move inline unit system search into a function
Improved readability and remove redundant NULL checks.
Also remove redundant assignment.
2022-08-22 12:42:23 +10:00
212a3a23df Merge branch 'blender-v3.3-release' 2022-08-22 12:14:09 +10:00
f3bf497c2c Merge branch 'blender-v3.3-release' 2022-08-22 12:14:06 +10:00
edfa67a8cc Merge branch 'blender-v3.3-release' 2022-08-22 12:14:02 +10:00
dc644677cb Merge branch 'blender-v3.3-release' 2022-08-22 12:13:58 +10:00
c9144f0cbb Fix potential undefined behavior printing a NULL pointer string
Improve messages when the font directory can't be detected or is missing.
2022-08-22 12:10:41 +10:00
ed070b1223 check_cppcheck: update 'glew' exclusion since it's removal 2022-08-22 11:36:27 +10:00
b04514da5d Cleanup: match names between functions & declarations
Mostly update the declarations, in some cases rename in the function
especially when the names used were inconstant with related functions.
2022-08-22 11:20:40 +10:00
5bd1d63115 Cleanup: move model authors from the doc-string to the implementation
There is no need for details like this in API doc-strings.
2022-08-22 10:58:02 +10:00
a283e07e04 BLI: float4x4: Fix bug / typo in << operator 2022-08-21 12:45:10 +02:00
563404d8ad Fix T100430: Restore larger node socket snap hitbox
Restore old hitbox for connecting links to sockets.

Commit rBd9d97db018d2 improved the node socket snapping when nodes
are close together by decreasing the tolerance around the cursor when
checking for nodes in front, that might occlude the socket.
In doing so it also reduced the hitbox of the node socket itself that
extended outside of the node.

This commit restores the old node socket hitbox while keeping the
improved behavior when nodes are close together with the following
changes:
1) When looking for the socket under the cursor, iterate through the
nodes front to back, which prioritizes node sockets in the foreground.
2) Instead of checking for another node underneath the cursor it checks
if the socket is actually occluded by another node.

The way the occlusion test for sockets is tweaked you can now connect to
sockets that are only partially occluded, which is a bit more forgiving
than previously.

Reviewed By: Hans Goudey

Differential Revision: http://developer.blender.org/D15731
2022-08-21 10:20:17 +02:00
a0c28a8054 Fix T100430: Restore larger node socket snap hitbox
Restore old hitbox for connecting links to sockets.

Commit rBd9d97db018d2 improved the node socket snapping when nodes
are close together by decreasing the tolerance around the cursor when
checking for nodes in front, that might occlude the socket.
In doing so it also reduced the hitbox of the node socket itself that
extended outside of the node.

This commit restores the old node socket hitbox while keeping the
improved behavior when nodes are close together with the following
changes:
1) When looking for the socket under the cursor, iterate through the
nodes front to back, which prioritizes node sockets in the foreground.
2) Instead of checking for another node underneath the cursor it checks
if the socket is actually occluded by another node.

The way the occlusion test for sockets is tweaked you can now connect to
sockets that are only partially occluded, which is a bit more forgiving
than previously.

Reviewed By: Hans Goudey

Differential Revision: http://developer.blender.org/D15731
2022-08-21 10:12:50 +02:00
acf083a5bf BLF: Fix FT_Get_Advance Wrong Value Without Size
Fix possibility of getting invalid fixed-pitch advance size.

See D15735 for more details.

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

Own Code.
2022-08-19 17:16:22 -07:00
c9a9967903 Outliner: Workaround for big performance issue in Library Overrides mode
When displaying the Hierarchies view of the Library Overrides display
mode in a specific Heist production file, Blender would become
unresponsive for about 30 seconds and every redraw in the Outliner would
lag noticably. Issue is that the sum of hierarchy elements is multiple
thousands, and that really brings the Outliner to its knees. I've looked
into some improvents and committed a few minor ones already, but it
seems it's really the big sum of elements causing the issue. There
doesn't appear to be a single bottle-neck.

To work around this, "lazy build" children, so that children of
collapsed elements are not actually created. This brings the tree
building down to some tens of miliseconds, and redrawing becomes
rather lag-free again, even with big parts of the tree un-collapsed.

Problem: Searching still needs to build the entire tree, so it's
essentially unusable right now. Should we disallow searching
altogether?
2022-08-19 22:22:40 +02:00
c2a6c3a4e2 Outliner: Refactor how lazy-building of children is done
Makes the lazy-building (where children are only built when the parent
isn't collapsed) more generic, so more display modes can use it. So far
this was hardcoded for the "Data API" display mode.

This will be used to work around a big performance issue with the
Library Overrides Hierachies view in a complex production file, see
following commit.
2022-08-19 22:22:25 +02:00
3a1ae5a02a Outliner: Workaround for big performance issue in Library Overrides mode
When displaying the Hierarchies view of the Library Overrides display
mode in a specific Heist production file, Blender would become
unresponsive for about 30 seconds and every redraw in the Outliner would
lag noticably. Issue is that the sum of hierarchy elements is multiple
thousands, and that really brings the Outliner to its knees. I've looked
into some improvents and committed a few minor ones already, but it
seems it's really the big sum of elements causing the issue. There
doesn't appear to be a single bottle-neck.

To work around this, "lazy build" children, so that children of
collapsed elements are not actually created. This brings the tree
building down to some tens of miliseconds, and redrawing becomes
rather lag-free again, even with big parts of the tree un-collapsed.

Problem: Searching still needs to build the entire tree, so it's
essentially unusable right now. Should we disallow searching
altogether?
2022-08-19 22:21:11 +02:00
231078441f Outliner: Refactor how lazy-building of children is done
Makes the lazy-building (where children are only built when the parent
isn't collapsed) more generic, so more display modes can use it. So far
this was hardcoded for the "Data API" display mode.

This will be used to work around a big performance issue with the
Library Overrides Hierachies view in a complex production file, see
following commit.
2022-08-19 22:21:10 +02:00
8115d31248 Outliner: (Refactor) Use C++ map instead of GHash
This container is type safe and contains a few nice optimizations,
although they shouldn't make a big difference here in practice. The
hashing now uses our default hashing method which reduces code
complexity and seems to perform slightly better in my tests.

For a Heist shot with a highly complex library overrides hierarchy in
the Outliner this reduces the tree building time from around 25 to 23.6
seconds here. However the main design change for performance is yet to
come, all this is just general code refactoring (which at least
shouldn't make performance worse).
2022-08-19 22:21:04 +02:00
6b9209ddfa Merge branch 'blender-v3.3-release' 2022-08-19 21:02:02 +02:00
51b79e4775 Fix T96133: Cycles viewport render crash with NVIDIA GPUs on macOS 2022-08-19 20:40:44 +02:00
4b62970dd3 Cleanup: replace CHECK_TYPE macro with static_assert
To avoid conflicts with BLI headers and simplify code.
2022-08-19 20:36:02 +02:00
6ef4267d5e Merge branch 'blender-v3.3-release' 2022-08-19 17:52:52 +02:00
be5c296e52 Fix T100502: GPencil Primitive apply offset when using Stroke mode
The offset was applied in stroke mode and this was wrong.
2022-08-19 17:52:12 +02:00
78e0c936c1 Merge branch 'blender-v3.3-release' 2022-08-19 17:32:55 +02:00
8f9b812d79 Fix build error on i386 due to wrong use of float_t
Was supposed to be float, likely copy paste error from int32_t.
2022-08-19 17:29:02 +02:00
0c8749788c Fix build error on mips64el architecture
Same as D12194, name "mips" conflicts on such systems.
2022-08-19 17:28:51 +02:00
Loren Osborn
db46251209 Fix ubsan warnings about indexing into null pointers
Ref T99382

Differential Revision: https://developer.blender.org/D15390
2022-08-19 16:27:22 +02:00
Nathan Vegdahl
a06c9b5ca8 Cycles: add Sobol-Burley sampling pattern
Based on the paper "Practical Hash-based Owen Scrambling" by Brent Burley,
2020, Journal of Computer Graphics Techniques.

It is distinct from the existing Sobol sampler in two important ways:
* It is Owen scrambled, which gives it a much better convergence rate in many
  situations.
* It uses padding for higher dimensions, rather than using higher Sobol
  dimensions directly. In practice this is advantagous because high-dimensional
  Sobol sequences have holes in their sampling patterns that don't resolve
  until an unreasonable number of samples are taken. (See Burley's paper for
  details.)

The pattern reduces noise in some benchmark scenes, however it is also slower,
particularly on the CPU. So for now Progressive Multi-Jittered sampling remains
the default.

Differential Revision: https://developer.blender.org/D15679
2022-08-19 16:27:22 +02:00
35a41a49a8 Merge branch 'blender-v3.3-release' 2022-08-19 16:25:41 +02:00
1608406600 Fix: nurbs basis cache not computed before it is used 2022-08-19 16:24:24 +02:00
Germano Cavalcante
e4f1d71908 Fix T89399: Mouse wrapping causes erratic movement
As mentioned in T89399, "the source of this bug is that cursor wrap
moves the cursor, but when it later checks the mouse position it hasn't
yet been updated, so it re-wraps".

As far as I could see, this happens for two reasons:
1. During the first warp, there are already other mousemove events in the queue with an outdated position.
2. Sometimes Windows occasionally and inexplicably ignores `SetCursorPos()` or `SendInput()` events. (See [1])

The solution consists in checking if the cursor is inside the bounds right after wrapping.
If it's not inside, it indicates that the wrapping either didn't work or the event is out of date.
In these cases do not change the "accum" values.

1. f317d619cc/src/video/windows/SDL_windowsmouse.c (L255))

Maniphest Tasks: T89399

Differential Revision: https://developer.blender.org/D15707
2022-08-19 10:09:58 -03:00
d94aadf235 Fix: Crash when realtime compositor node is unlinked
The realtime compositor crashes when some nodes are unlinked.

This happens for GPU material nodes if it was compiled into its own
shader operation. Since it is unlinked, the shader operation will have
no inputs, a case that the current code didn't consider.

This patch fixes this by skipping code generation for inputs if no
inputs exist for the shader operation.
2022-08-19 15:03:14 +02:00
1eeb174e72 Cleanup: update comment about undo & smooth-view 2022-08-19 21:04:57 +10:00
188f7585a1 Fix T100323: Outliner: Do not allow to delete objects from an override collection. 2022-08-19 12:42:52 +02:00
ab3e9c47d8 Merge branch 'blender-v3.3-release' 2022-08-19 16:24:51 +10:00
5c9bea25d0 Fix crash accessing PyEval_GetFrame from Python's crash handler
Check the thread-state before accessing PyEval_GetFrame, since this is
a crash handler, the state of the Python interpreter isn't known.
2022-08-19 16:23:29 +10:00
9855264c8d UI: increase range of font size for text editor & console
Useful when using different DPI & UI scales.
2022-08-19 15:54:24 +10:00
0322802314 Cleanup: minor changes to BLF API
- Use upper-case for defines.
- Use u-prefix for unsigned types.
- Use snake case for struct members.
- Use const struct for unicode_blocks & arguments.
- Use doxy style comments for struct members.
- Add doxy sections for recently added code.
- Correct code-comments (outdated references).
- Remove 'e' prefix from struct UnicodeBlock/FaceDetails
  (normally used for enums).
2022-08-19 14:46:45 +10:00
1a3bc09e89 Cleanup: spelling in comments 2022-08-19 13:49:13 +10:00
2a15040777 Merge branch 'blender-v3.3-release' 2022-08-19 13:46:37 +10:00
97f9015ed0 Cleanup: unused argument warning 2022-08-19 13:41:49 +10:00
0491ba09c2 Cleanup: Remove data duplication from BLI_any.hh support variables
Use `inline constexpr` instead of `static constexpr` to prevent these
variables from being duplicated in each translation unit that includes
the BLI_any.hh header.

Differential Revision: https://developer.blender.org/D15698
2022-08-18 19:40:46 -07:00
cd516d76b6 Cleanup: replace uint cd_loop_uv_offset with int
See https://wiki.blender.org/wiki/Style_Guide/C_Cpp#Integer_Types
2022-08-19 14:19:13 +12:00
e80a9d2645 Cleanup: lint, unused_vars 2022-08-19 13:44:55 +12:00
a5c696a0c2 UV: respect uv selection for smart uv, cube, sphere and cylinder projection
Differential Revision: https://developer.blender.org/D15711
2022-08-19 13:35:03 +12:00
529f0427fc Cleanup: spelling in comments 2022-08-19 11:29:32 +10:00
aa82f91c92 Cleanup: uvedit_*_select, replace BMEditMesh* with BMesh*
Change `cd_loop_uv_offset` from signed to unsigned, forcing
a crash if passed invalid input.

Differential Revision: https://developer.blender.org/D15722
2022-08-19 13:00:48 +12:00
4f8c15daf4 Fix logical errors in RNA_path_array_index_token_find
This function never succeeded as an off by one error checking the last
character always indexed the null byte.
The 'for' loop was broken as of [0] since the unsigned number could wrap
around with some RNA paths causing out of bounds memory access.

This is an example where tests would have caught the problem early on,
RNA path tests are planned as part of D15558.

[0]: 11b4d0a3c3
2022-08-19 10:54:45 +10:00
Germano Cavalcante
f5aac6662d Fix GPUShader.format_calc documentation
`format_calc` instead of `calc_format`.
2022-08-18 20:03:07 -03:00
d772e11b5a BLF: Gamma Correction
Gamma correction for glyph coverage values.

See D13376 for details and examples.

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

Reviewed by Julian Eisel
2022-08-18 12:34:23 -07:00
9707080a9d Cleanup: Remove unused outliner function
This is unused, and I don't see a need for it.
2022-08-18 21:14:54 +02:00
9961aae1e6 Merge branch 'blender-v3.3-release' 2022-08-18 20:31:34 +02:00
d2255aa4ed Outliner: Refactor outliner tree-hash interfaces with C++
- Turn storage into an object with "automatic" memory management (RAII)
  so freeing is implicit and reliable.
- Turn functions into member functions, to have the data and its
  functions close together with controlled access that increases
  encapsulation and hiding implementation details.
- Use references to indicate null is not an expected value.
- Related minor cleanup (comments, use const etc.)

Couldn't spot any changes in performance.
2022-08-18 20:22:55 +02:00
75cca8360f Outliner: Add commented out benchmarking calls for tree rebuilding
This way you can benchmark the tree rebuilding by simply commenting out
a single line. Not that it was difficult before, but this makes it as
easy as it gets, with basically no knowledge of existing benchmarking
tools required.
2022-08-18 20:22:55 +02:00
de794adc0c Outliner: Use C++ container for tree hash element storage
Simplifies code quite a bit, since this was doing the typical work of
such a container. I may remove this vector entirely as I'm working on
performance fixes, not sure, but simplifying this helps reason about the
design.

Couldn't spot performance differences in some benchmarks, and I wouldn't
expect any. Maybe some minor onces thanks to the small buffer
optimization of `blender::Vector`.
2022-08-18 20:22:55 +02:00
5148e1c60c Cleanup: General style improvements for Outliner tree hashing code
- Use C++ nullptr instead of C's NULL (clang-tidy warns otherwise)
- Use early exit/continue to avoid indentation (helps readability
  because visual scope of no-op branches is minimized).
- Use const for local variables, to separate them clearly from the
  mutable ones.
- Avoid struct typedef, this is not needed in C++
2022-08-18 20:22:55 +02:00
6a4f4810f3 Fix T100246: Cycles GPU render error when adding AO node during viewport render 2022-08-18 20:04:22 +02:00
e11c899e71 Cycles: disable Metal inlining optimization on Apple GPUs
This gave a 1.1x speedup, however also leads to very long compile times
that make it seems like Blender has stopped working.

This can be brought back in the future behind an option that users can
explicitly enabled.

Fix T100102

Ref D14923, D14763, T92212
2022-08-18 20:01:29 +02:00
790d57b88a Fix build error when not using unity build 2022-08-18 18:56:17 +02:00
b375019ebc Merge branch 'blender-v3.3-release' 2022-08-18 17:26:54 +02:00
f2f680d82d Fix T100475: Crash on undoing the created override from ID template.
We only need to 'manually' remap RNA ID pointer property to the newly
created override if the owner itself was not already a local override.

Also some more minor tweaks to notifiers sent when creating the
override.
2022-08-18 17:26:12 +02:00
885e7abed1 Realtime Compositor: Implement bilateral blur node
This patch implements the bilateral blur node for the realtime compositor.

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

Reviewed By: Clement Foucault
2022-08-18 17:16:14 +02:00
d8be33333f Merge branch 'blender-v3.3-release' 2022-08-18 17:09:52 +02:00
96206aa98a Enable oneAPI AoT kernels for Release on Linux
Windows still needs some work on the buildbot side, so keep
that disabled for the time being.
2022-08-18 17:03:59 +02:00
7d4aa0db9e Realtime Compositor: Implement despeckle node
This patch implements the despeckle node for the realtime compositor.

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

Reviewed By: Clement Foucault
2022-08-18 16:53:16 +02:00
41dd5a6c38 GPencil: Fix wrong material index in previous commit 2022-08-18 16:35:04 +02:00
aa7b2f1dd9 GPencil: New operator to convert strokes to perimeter.
This operator converts any stroke of gpencil with a center line into a stroke with the perimeter.

It's possible to assign the active material, keep current or create a new material for all perimeters.

The conversion is only done for strokes with a material using `Stroke`. Only `Fill` strokes are not converted.

Known issues: As the perimter has not boolean implementation, some perimeters can be overlaped. This could be solved in the future when a new 2D boolean library will be developed.

Reviewed By: mendio, pepeland, frogstomp

Differential Revision: https://developer.blender.org/D15664
2022-08-18 16:30:27 +02:00
4d4a84bbeb Merge branch 'blender-v3.3-release' 2022-08-18 15:50:05 +02:00
582704a758 LibOverride: Preserve active object when creating overrides. 2022-08-18 15:49:50 +02:00
a149c4aaee LibOverride: Fix more crashes when creating overrides from IDTemplates.
Assigning to RNA ID pointer properties will not _always_ trigger a
rebuild of the outliner tree, so try to enforce this when actually
creating overrides.
2022-08-18 15:49:50 +02:00
9a65dca37c Merge branch 'blender-v3.3-release' 2022-08-18 15:26:30 +02:00
8a799b00f8 Fix T100423: Addon's custom context menu entries get overridden by other addons
This introduces a new `UI_MT_button_context_menu` class which is
registered at startup. Addons can append/prepend draw functions to this
class, in order to add their custom context menu entries.

The new class replaces the old `WM_MT_button_context` class, thus
requiring a small change in addons using this feature. This is done
because addons were previously required to register the class
themselves, which caused addons to override each other's context menu
entries.

Now the class registration is handled by Blender, and addons need only
append their draw functions. The new class name ensures that addons
using the old method don't override menu entries made using the new
class.

Menu entries added with the legacy `WM_MT_button_context` class are
still drawn for backwards compatibility, but this class must not be used
going forward, as any addon using it still runs the risk of having its
menu entries overridden, and support for the legacy class is subject to
removal in a future version.

Reviewed By: campbellbarton

Maniphest Tasks: T100423

Differential Revision: https://developer.blender.org/D15702
2022-08-18 14:46:30 +02:00
a7652bf2f7 Fix T100470: Crash when changing the domain type 2022-08-18 14:29:56 +02:00
756308f9e4 Merge branch 'blender-v3.3-release' 2022-08-18 12:36:41 +02:00
c375750423 Fix T100476: Shift click to create overrides on objects not working.
Case where object was directly linked and not owned by a linked
collection was not properly handled, added some level of support for it
now.

Note that the behavior may not always be ideal in cases where the linked
object would be linked in many different local collecitons, hard to get
best solution always from this Editor given limited hierarchy data
available here.
2022-08-18 12:24:54 +02:00
80b7902a56 Fix (unreported) outliner not redrawing on 'removed ID' notification.
Could lead to crahses in some cases, with outliner drawing code
accessing freed ID data in its tree.
2022-08-18 12:23:47 +02:00
1854d31321 Realtime Compositor: Implement directional blur node
This patch implements the directional blur node for the realtime compositor.

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

Reviewed By: Clement Foucault
2022-08-18 12:20:18 +02:00
b828d453e9 Realtime Compositor: Implement filter node
This patch implements the filter node for the realtime compositor.

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

Reviewed By: Clement Foucault
2022-08-18 12:00:14 +02:00
6cb0a122df Realtime Compositor: Implement bokeh image node
This patch implements the bokeh image node for the realtime compositor.

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

Reviewed By: Clement Foucault
2022-08-18 11:53:08 +02:00
0aaff9a07d WM: optimize adding notifier duplication check
Use a GSet to check for duplicate notifiers, for certain Python scripts
checking for duplicate notifiers added considerable overhead.

This is an alternative to D15129 with fewer chances to existing logic.
2022-08-18 15:55:45 +10:00
7be1c8bbae Cleanup: de-duplicate notifier add function 2022-08-18 14:45:49 +10:00
fcd72756ab Cleanup: early return, reduce right-shift 2022-08-18 14:45:47 +10:00
f5234474bd Fix T97618: Clipped text labels intermittently missing ellipses
The offending line was attempting to artificially add width to the
length of the string in order to "avoid ellipsing text that nearly
fits". The line doesn't actually appear to do anything beneficial, and
it causes the nasty text bug.

Old:
{F13029695}

New:
{F13327308}

Reviewed By: campbellbarton

Ref D15585
2022-08-18 11:01:53 +10:00
2a2ca3292a CMake: always unset CMAKE_REQUIRED_* variables after use
Always unset these variables after use as they could interfere with
other checks made afterwards.
2022-08-18 10:01:27 +10:00
cfe5bf4b22 Cleanup: spelling, format 2022-08-18 08:46:24 +10:00
listout
f197b1a1f1 CMake: support building with musl libc
Instead of using macros like GLIBC we can use the CMake build
systems internal functions to check if some header or functions are
present on the running system's libc.

Add ./build_files/cmake/have_features.cmake to add checks for
platform features which can be used to set defines for source
files that require them.

Reviewed By: campbellbarton

Ref D15696
2022-08-18 08:12:56 +10:00
0a84cc691d Cleanup: Move subdiv_mesh.c to C++ 2022-08-17 18:11:01 -04:00
f60b47f2c8 UI: Fix inconsistency use of uppercase/capitalization
Since VBO stands for vertex buffer object it should always be uppercase.

"Vertex" in "vertex buffer object" should only be capitalized at the
beginning of a sentence.
2022-08-17 22:23:48 +02:00
646ef6e157 UI: Avoid the word "Use" in checkbox labels
As per the writing styles guidelines.
https://wiki.blender.org/wiki/Human_Interface_Guidelines/Writing_Style
2022-08-17 22:14:28 +02:00
0be6427429 Outliner: Compile outliner tree-hashing files in C++
Some performance issues were found here with a heavy production file and
we want to look into using some C++ to improve things for this ancient
code.
2022-08-17 21:00:22 +02:00
d8223bdc38 Cleanup: Improvements to Outliner tree writing code, add assert
Comments there weren't really helpful, took me a while to get what they
try to say. This attempts to add a better explanation. Also add an
assert for a previous, implicit (but commented) assumption, and some
minor cleanups.
2022-08-17 20:27:52 +02:00
ecf4a7835d Outliner: Avoid unnecessary Outliner storage copy
Was always creating a copy of `SpaceOutliner`, even though it's only
needed for one conditional branch. This is a shallow copy, so shouldn't
be that expensive, still trivial to avoid.
2022-08-17 20:27:52 +02:00
f6a6665947 deps/windows: bzip2 1.0.8 for python
backport of python PR 31735 [1]

[1] https://github.com/python/cpython/pull/31735
2022-08-17 12:16:22 -06:00
31279d522b Fix: Compiler warning in macro after recent C++ conversion
The iterator parameters struct should be initialized to zero in both
C and C++. Using memset seems to be the only reliable way to do that.
2022-08-17 13:16:48 -04:00
27f2ff6b5b Cleanup: Remove redundant use of evaluated non-mesh objects
Metaball, curve, text, and surface objects use the geometry component
system to add evaluated mesh object instances to the dependency graph
"for render engine" iterator. Therefore it is unnecessary to process
those object types in these loops-- it would either be redundant work
or a no-op.
2022-08-17 13:02:45 -04:00
04a04e9f69 Merge branch 'blender-v3.3-release' 2022-08-17 18:08:37 +02:00
244ef1f0f5 LibOverride: Remove the 'make all editable' user preferences.
This behavior is now implicitely controlled by the 'Make' operations,
based either on context or selected items.
2022-08-17 18:08:18 +02:00
9a67aac8d7 Cleanup: Fix outdated comment 2022-08-17 12:05:20 -04:00
a73cc81646 Cleanup: Remove unused function
Also remove two DispList references I missed in the previous commit.
2022-08-17 12:03:26 -04:00
6718afdc8a Cleanup: Fix outdated comments referring to DispList 2022-08-17 11:57:21 -04:00
316194c384 Merge branch 'blender-v3.3-release' 2022-08-17 11:13:13 -04:00
92493a5fa7 Fix: Node editor context path for curves objects
The object data path item wasn't added properly.
Also remove some of the unnecessary variables and forward declarations.
2022-08-17 11:11:28 -04:00
eaa87101cd Metaball: Evaluate metaball objects as mesh components
With the ultimate goal of simplifying drawing and evaluation,
this patch makes the following changes and removes code:
- Use `Mesh` instead of `DispList` for evaluated basis metaballs.
- Remove all `DispList` drawing code, which is now unused.
- Simplify code that converts evaluated metaballs to meshes.
- Store the evaluated mesh in the evaluated geometry set.

This has the following indirect benefits:
- Evaluated meshes from metaball objects can be used in geometry nodes.
- Renderers can ignore evaluated metaball objects completely
- Cycles rendering no longer has to convert to mesh from `DispList`.
- We get closer to removing `DispList` completely.
- Optimizations to mesh rendering will also apply to metaball objects.

The vertex normals on the evaluated mesh are technically invalid;
the regular calculation wouldn't reproduce them. Metaball objects
don't support modifiers though, so it shouldn't be a problem.
Eventually we can support per-vertex custom normals (T93551).

Differential Revision: https://developer.blender.org/D14593
2022-08-17 10:20:25 -04:00
71f091a631 Cleanup: Remove unused Outliner search element storage
This is old code to keep track of an active search element, so you could
step through the search results. This isn't used anymore, and not needed
since searching now filters the tree to only show matches. If we ever
wanted to have support for stepping through elements again, that should be
done via the active element instead.
2022-08-17 16:15:03 +02:00
db054b447d Cleanup: Move view3d_select.c to C++
Almost entirely adding casting and standard clang tidy changes.
Also switch to `blender::Vector` instead of the macro-based `BLI_array`.
2022-08-17 09:54:01 -04:00
923e10d751 Fix: Crash if Movie Clip node has an empty movie
The movie clip GPU texture free function doesn't do null checks, so make
sure the movie clip is not null before freeing.
2022-08-17 15:11:35 +02:00
f4040da3ef install_deps: replace libglew by libepoxy.
Should have been part of D15291/rBa296b8f694d1.

ref. T99618
2022-08-17 14:23:17 +02:00
1e427e224b Merge branch 'blender-v3.3-release' 2022-08-17 14:15:33 +02:00
224869acc5 Use report warning opening file written by newer Blender binary
handle_subversion_warning() was reporting with RPT_ERROR type, replaced
with RPT_WARNING.

RPT_ERROR would stop python scripts opening files written by newer
Blender binary with bpy.ops.wm.open_mainfile(), preventing further code
from running. This does not seem right since Blender itself still loads
the files.

Ran into this checking T100446 in 2.93.

Differential Revision: https://developer.blender.org/D15712
2022-08-17 14:11:51 +02:00
517d622057 Cleanup: conversion warnings in GCC 2022-08-17 21:34:13 +10:00
6ab5bced61 Merge branch 'blender-v3.3-release' 2022-08-17 13:01:09 +02:00
1c63e4233d Cleanup: Fix "unused m_system" warnings
The dummy `m_system` variable is not needed in the GHOST_NULL classes
2022-08-17 12:54:46 +02:00
fec2543648 LibOverride: Add Make/Reset/Clear entries to IDTemplate contextual menu.
Matches main operations exposed in View3D and the Outliner.
2022-08-17 12:10:31 +02:00
a078262804 Merge branch 'blender-v3.3-release' 2022-08-17 17:07:31 +10:00
839ece6477 Fix T100411: Invert Axis Pan option ignored for Lock Camera Pan/Zoom 2022-08-17 17:06:09 +10:00
a123fc9e22 GHOST/EGL: Only draw grey into buffers attached to windows
Avoid redundant drawing, match GHOST/GLX behavior.
2022-08-17 16:21:13 +10:00
b1d3097fa9 WM: update comment about window redraw for thumbnails 2022-08-17 15:56:00 +10:00
e52fd904e8 Merge branch 'blender-v3.3-release' 2022-08-17 15:45:25 +10:00
288cd705eb Merge branch 'blender-v3.3-release' 2022-08-17 15:44:30 +10:00
95fd163074 Cleanup: spelling in comments 2022-08-17 15:43:17 +10:00
a1f10b10b6 Fix freed memory access checking events with debug builds
Pressing escape when rendering a viewport animation would
access the freed even and crash (with ASAN enabled).

Always check the context's window before the event as this is a signal
a file was loaded or the window was closed (and it's events freed).
2022-08-17 15:33:30 +10:00
04dba9349d Fix: build issue with MSVC
empty initializers are not allowed in C99
introduced by rB2481be90e38d36abc06501c395105fa1833baf1c
2022-08-16 22:09:58 -06:00
5fab3bc630 Merge branch 'blender-v3.3-release' 2022-08-17 05:12:34 +02:00
06a01168f6 Fix T100079: Encoding with DNxHD fails due to bad parameters
Constant_rate_factor mode was not updated when choosing DNxHD codec in
RNA update function.

Ensure `FFM_CRF_NONE` is set.
2022-08-17 04:58:45 +02:00
48da8c4040 Fix T98462: Save Screenshot (glReadPixels) fails under Wayland
Use an off-screen buffer for the screen-shot operator.

Reading from the front-buffer immediately after calling swap-buffers
failed for GHOST/Wayland in some cases.
While EGL can request to preserve the front-buffer while drawing,
this isn't always supported. So workaround the problem by avoiding
use of the front-buffer entirely.
2022-08-17 12:58:17 +10:00
54827bb7cd Cleanup: shadow warning 2022-08-17 12:57:30 +10:00
2481be90e3 WM: ensure AlembicImportParams are always initialized
Initialize all members before assignment, ensuring newly added
members are never left uninitialized.
2022-08-17 12:51:07 +10:00
1f2a5fea87 Cleanup: strip blank lines around comment blocks 2022-08-17 12:51:07 +10:00
9d2136f272 Cleanup: add missing doxy sections 2022-08-17 12:51:07 +10:00
26d6b27ebc Cleanup: quiet shadow warning 2022-08-17 12:51:07 +10:00
836c07f29c UV: grab tool supports live unwrap
Differential Revision: https://developer.blender.org/D15709
2022-08-17 14:47:35 +12:00
74ea0bee9c UV: add geometry driven uv relax brush
Differential Revision: https://developer.blender.org/D15530
2022-08-17 14:11:57 +12:00
29c1d736c4 Cleanup: compiler warnings, clang-tidy 2022-08-17 11:57:53 +10:00
413c399ab8 Cleanup: Move view layer array utils from macros to functions
These macros don't compile in C++ because of taking an address of a
temporary and use of designated initializers. Besides that, using
functions can improve debugging and type safety.

Differentil Revision: https://developer.blender.org/D15693
2022-08-16 21:25:14 -04:00
d39abb74a0 BLF: FreeType Optional Caching
Implementation of the FreeType 2 cache subsystem, which limits the
number of concurrently-opened FT_Face and FT_Size objects, as well as
caching information like character maps to speed up glyph id lookups.
This time with the option of opening FontBLFs that are not cached.

See D15686 for more details.

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

Reviewed by Brecht Van Lommel
2022-08-16 15:02:56 -07:00
09640ab291 Fix T99872: Crash Loading Embedded Fonts - Master
Commit rBc0845abd897f to 3.4 (master) uses font's filepath without
checking if it exists, therefore crashing on embedded fonts since
they do not have a filepath (loaded from memory).

See D15703 for more details

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

Reviewed by Brecht Van Lommel
2022-08-16 12:43:10 -07:00
ccf31810d6 Cleanup: use a structure for Alembic import parameters
Also renammed some parameters and sprinkled a dash of documentation.
2022-08-16 19:59:22 +02:00
a3b3871ca1 Merge branch 'blender-v3.3-release' 2022-08-16 18:54:27 +02:00
233c9b3cad Cleanup: Unused parameters. 2022-08-16 18:54:04 +02:00
879ebcec7e Merge branch 'blender-v3.3-release' 2022-08-16 18:40:08 +02:00
669c924e07 Fix (unreported) bug in liboverride 'leaves' detection.
Loopback ID pointers should be ignored here as well, otherwise they are
very efficient at preventing proper detection of 'leaf' override IDs in
a hierarchy.
2022-08-16 18:39:47 +02:00
Fynn Grotehans
cdfe2e1c3f UI: Add View pie to File Browser
Adds a pie menu to the File Browser for convenient switching between vertical list, horizontal list and thumbnail view.

Uses the same shortcut as other View pie menus (`ACCENT_GRAVE`).

{F12811673}

Reviewed By: #user_interface, pablovazquez, Severin

Differential Revision: https://developer.blender.org/D13874
2022-08-16 18:10:18 +02:00
b247588dc0 Cleanup: some refactoring in mapped mesh extraction
* Flip the logic to first detect if we are dealing with an unmodified mesh
  in editmode. And then if not, detect if we need a mapping or not.
* runtime.is_original is only valid for the bmesh wrapper. Rename it to clarify
  that and only check it when the mesh is a bmesh wrapper.
* Remove MR_EXTRACT_MAPPED and instead check only for the existence of the
  origindex arrays. Previously it would sometimes access those arrays without
  MR_EXTRACT_MAPPED set, which according to a comment means they are invalid.

Differential Revision: https://developer.blender.org/D15676
2022-08-16 18:09:27 +02:00
74d716ce23 Fix error/crash in hidden edge drawing after recent changes
Mistake in 2480b55 using the wrong array.
2022-08-16 18:09:27 +02:00
fefe229de3 Merge remote-tracking branch 'origin/blender-v3.3-release' 2022-08-16 18:08:46 +02:00
5f2667aa71 Licenses: Attribution document for Blender 3.3
A few libraries were updated and a few added.

There are a few depedencies to intel oneAPI which I did not include, since we
refer already to Intel oneAPI already.
2022-08-16 18:08:09 +02:00
ed2d2cbdd2 Licenses: Attribution document for Blender 3.2
A few libraries were updated, a few were added, and a few were missing
from the previous license document.
2022-08-16 18:06:35 +02:00
e08f06c7a6 Merge branch 'blender-v3.3-release' 2022-08-16 16:36:18 +02:00
8cf52e8226 Fix T98773: GPU subdivision issues with UV editor display
This fixes missing selection updates in UV editor, both with GPU subdivision
and with the Modified Edges display option for modifiers in general.

It also fixes the UV editor incorrectly showing the cage mesh with deformed
coordinates. These are not yet supported by the UV selection system.

Changes:

* Always read selection state from the editmesh when building batches. The
  flags in the evaluated mesh can be outdated as selection bypasses depsgraph
  evaluation for performance, and instead may just clear the batches.
* runtime.is_original is only valid for the bmesh wrapper. The check for
  building the UV cage should only use that if the mesh is a bmesh wrapper.
* Don't create cage batches for objects whose mesh is in edit mode, but that
  are not themselves in edit mode, there is no need.

Differential Revision: https://developer.blender.org/D15658
2022-08-16 16:01:01 +02:00
a1b8013cc3 Cleanup: compiler warning 2022-08-16 16:00:40 +02:00
850126ab44 Merge branch 'blender-v3.3-release' 2022-08-16 15:43:24 +02:00
a42896a8a1 LibOverride: Refactor of menu entries in the View3D.
Move override creation into their own menu, add entries for reset and
clear operations.
2022-08-16 15:42:04 +02:00
Jeroen Bakker
8af983ba78 EEVEE-Next: Reduce image bindings.
This change combines the diffuse/specular light passes into a single texture
array, freeing up an image binding for cryptomatte.

When diffuse/specular light pass and/or requested a
texture array will be allocated. Only when specular light is requested 2 images will always be allocated. This increases the
memory overhead when viewing the specular light renderpass in the viewport. For final rendering it is a common scenario that none
or both are requested.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D15701
2022-08-16 15:10:21 +02:00
a70eace19b Merge branch 'blender-v3.3-release' 2022-08-16 14:39:34 +02:00
8aa094263b Fix T100412: LibOverride: shift click on the modifier link button do not create override
Add support for the (geometry)node tree case.

Also add warning about not being implemented for other types.
2022-08-16 14:36:58 +02:00
90c14b1e44 Merge branch 'blender-v3.3-release' 2022-08-16 14:21:33 +02:00
a93f6a5429 LibOverride: Tweaks to new menus in Outliner.
Also add new outliner liboverride operators mapping to the manual,
though this is useless currently as this feature is not working in many
part of the UI, including the Outliner contextual menu.
2022-08-16 14:20:29 +02:00
e650cdd72a Fix T100375: Renaming items from the outliner does not update the despgraph.
Only object renaming was properly depsgraph-tagged, now all IDs (and
their sub-data like bones etc.) should be properly handled.
2022-08-16 14:14:21 +02:00
1221a4049c Merge branch 'blender-v3.3-release' 2022-08-16 13:50:19 +03:00
efdcef7855 Fix T100421: OBJ importer in 3.3 does not keep the vertex order
While fixing T100302 (rBd76583cb4a1) I did not realize that the
change in imported vertex order would actually matter. Turns out, it
does for morph targets / mesh shape keys. So redo the fix in a way
that does not change the vertex order. Fixes T100421.
2022-08-16 13:49:37 +03:00
7bfd78d450 Merge branch 'blender-v3.3-release' 2022-08-16 18:33:23 +08:00
accf38c1d1 Fix T100435: Use evaluated material for line art loading.
Materials can be changed by other evaluations like geometry nodes,
now handles that kind of situation.
2022-08-16 18:32:43 +08:00
42179fed71 GPU: ShaderCreateInfo: Use variadic template instead of default arguments
This should reduce the issue described in T100431.
This is also cleaner and without arbitrary argument limit.
2022-08-16 11:55:10 +02:00
66822319d3 UV: add constrain-to-bounds support for uv relax, uv grab and uv pinch
Differential Revision: https://developer.blender.org/D15683
2022-08-16 18:26:04 +12:00
3c351da89f UV: improve uv sculpt tools with boundary support and pin support
Fix boundary conditions for the Relax UV tool with the Laplacian method.

Add Pinned UV support to Relax UV tool (all modes) and Pinch UV tool.

Differential Revision: https://developer.blender.org/D15669
2022-08-16 17:16:45 +12:00
8841bd9660 GHOST/Wayland: Add NDOF support
Logic for NDOF devices is shared with X11, process events using
GHOST_NDOFManagerUnix when WITH_INPUT_NDOF is enabled.
2022-08-16 12:27:42 +10:00
3a8c57cf9d Support Ctrl-C to cancel rendering with headless builds
The original intention from [0] was to force background-mode when built
WITH_HEADLESS or WITH_PYTHON_MODULE, with the else clause setting the
signal handler for Ctrl-C. Since WITH_PYTHON_MODULE now disables all
signal handlers this check no longer makes sense.

[0]: 9d9c05a101
2022-08-16 10:51:14 +10:00
9d9c05a101 Cleanup: spelling in comments 2022-08-16 10:38:26 +10:00
c4eb70e543 Cleanup: format 2022-08-16 10:38:26 +10:00
75e652027c Cleanup: warnings 2022-08-16 10:38:26 +10:00
c22256f387 Merge branch 'blender-v3.3-release' 2022-08-15 17:18:33 -07:00
2d19038c6c Sculpt: Fix T100379: Anchored brush tags all nodes for update
Node tagging needed to happen after the undo node's null check.
2022-08-15 17:17:27 -07:00
f80f600b8e Sculpt: Fix T100379: Anchored brush tags all nodes for update
Node tagging needed to happen after the undo node's null check.
2022-08-15 17:13:45 -07:00
7f3eb055dd Sculpt: Improve sculpt debug draw
* Fixed crash in debug draw code.  Apparently this is
  only used by PBVH draw?
* Debug draw code can now be forcibly enabled in release
  mode (i.e. RelWithDebugInfo) by uncommenting a commented
  out #define.
* Fixed colors in debug draw mode.
* PBVH node boxes in debug mode now flash a different color
  when they are updated.
2022-08-15 17:01:17 -07:00
c5feb4e6fe Sculpt: Write documentation in sculpt_undo.c 2022-08-15 15:16:27 -07:00
3f9299e45d Sculpt: Fix redo panel bugs
SCULPT_undo_push_begin no longer takes an explicit
name.  Instead it takes a wmOperator pointer and uses
op->type->name for the name.  This is necassary for
the redo panel to work and should fix the entire class
of bugs related to misspelled undo push names.

Cases where the calling operator is not registered
may use SCULPT_undo_push_begin_ex if desired; it
takes a name string as before.
2022-08-15 14:52:02 -07:00
6b49b54bb1 Sculpt: Blank out redo panel for stroke operator
Unfortunately we do need the panel enabled to prevent
undo bugs.
2022-08-15 13:20:09 -07:00
74e6218c35 Fix T100106: Cycles poor playback performance with still image and auto refresh
The auto refresh option should be ignored in this case.
2022-08-15 19:30:31 +02:00
b43b62191c EEVEE-Next: HiZ Buffer: New implementation
This new implementation does all downsampling in a single compute shader
dispatch, removing a lot of complexity from the previous recursive
downsampling.

This is heavilly inspired by the Single-Pass-Downsampler from GPUOpen:
https://github.com/GPUOpen-Effects/FidelityFX-SPD
However I do not implement all the optimization bits as they require
vulkan (GL_KHR_shader_subgroup) and is not as versatile (it is only
for HiZ).

Timers inside renderdoc report ~0.4ms of saving on a 2048*1024 render for
the whole downsampling. Note that the previous implementation only
processed 6 mips where the new one processes 8 mips.
```
EEVEE ~1.0ms
EEVEE-Next ~0.6ms
```

Padding has been bumped to be of 128px for processing 8 mips.

A new debug option has been added (debug value 2) to validate the HiZ.
2022-08-15 18:36:19 +02:00
3195a38120 Introduce headless OpenGL rendering on Linux
With this patch true headless OpenGL rendering is now possible on Linux.
It changes the logic of the WITH_HEADLESS build flag.

The headless backend is now always available with regular builds and
Blender will try to fall back to it if it fails to initialize other
backends while in background mode.

The headless backend only works on Linux as EGL is not used on Mac or Windows.
libepoxy does support windows and mac, so this can perhaps be remedied in the future.

Reviewed By: Brecht, Jeroen, Campbell

Differential Revision: http://developer.blender.org/D15555
2022-08-15 16:54:29 +02:00
8ffc11dbcb Cleanup OpenGL linking and related code after libepoxy merge
This cleans up the OpenGL build flags and linking.
It additionally also removes some dead code.

One of these dead code paths is WITH_X11_ALPHA which actually never was
active even with the build flag on. The call to use this was never
called because the default initializer for GHOST was set to have it off
per default. Nothing called this function with a boolean value to enable it.

These cleanups are needed to support true headless OpenGL rendering.
Without these cleanups libepoxy will fail to load the correct OpenGL
Libraries as we have already linked them to the blender binary.

Reviewed By: Brecht, Campbell, Jeroen

Differential Revision: http://developer.blender.org/D15554
2022-08-15 16:47:20 +02:00
a296b8f694 GPU: replace GLEW with libepoxy
With libepoxy we can choose between EGL and GLX at runtime, as well as
dynamically open EGL and GLX libraries without linking to them.

This will make it possible to build with Wayland, EGL, GLVND support while
still running on systems that only have X11, GLX and libGL. It also paves
the way for headless rendering through EGL.

libepoxy is a new library dependency, and is included in the precompiled
libraries. GLEW is no longer a dependency, and WITH_SYSTEM_GLEW was removed.

Includes contributions by Brecht Van Lommel, Ray Molenkamp, Campbell Barton
and Sergey Sharybin.

Ref T76428

Differential Revision: https://developer.blender.org/D15291
2022-08-15 16:10:29 +02:00
3551b0a672 Fix T99255: Strips inserting incorrectly
When dropping file to sequencer timeline, coordinates for strip position
and overlap handling are used even if not set.

Reset internal state in on_drag_start callback and set is_modal
variable only if coordinates are updated. This way when dragging file
from external file browser, strip is added at current frame as before
modal operator was implemented.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D15333
2022-08-15 14:20:38 +02:00
90be364ca9 Merge branch 'blender-v3.3-release' 2022-08-15 14:01:34 +02:00
3897ff105e Fix T99955: Crash with 'Cache Result' and all render layers are disabled
Ensure render passes are allocated in the result prior to writing them.

Alternative could be to not write empty passes, but that is kind of
different from perspective of s one who reads the file.

Differential Revision: https://developer.blender.org/D15692
2022-08-15 14:01:18 +02:00
3aeacb9ab3 Merge branch 'blender-v3.3-release' 2022-08-15 13:53:42 +02:00
12e5b92c9c Cleanup: fix typos
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D15680
2022-08-15 13:48:50 +02:00
e949d6da5b Cycles: simplify handling of ray differentials
* Store compact ray differentials in ShaderData and compute full differentials
  on demand. This reduces register pressure on the GPU.
* Remove BSDF differential code that was effectively doing nothing as the
  differential orientation was discarded when making it compact.

This gives a 1-5% speedup with RTX A6000 + OptiX in our benchmarks, with the
bigger speedups in simpler scenes.

Renders appear to be identical except for the Both displacement option that
does both displacement and bump.

Differential Revision: https://developer.blender.org/D15677
2022-08-15 13:48:02 +02:00
8c77fa558a Cleanup: make format 2022-08-15 13:47:14 +02:00
7be7280c57 Fix build error in libc_compat when using musl libc
Checking for the existence of and using __GLIBC_PREREQ can't be done in the
same conditional.

Contributed by listout.

Differential Revision: https://developer.blender.org/D15690
2022-08-15 13:46:13 +02:00
d8841d0aa3 Fix T100394: Regression: Duplicating a modifier causes a crash
Need to update relations when modifiers are added or removed
since those create nodes in the dependency graph.

Added an assert statement to point at possible culprit so
that issues can be fixed more quickly.
2022-08-15 12:19:27 +02:00
3c9956fe55 Cleanup: Suppress compilation warning in eevee_lights.
Temporarily commented out LightModule::input_depth_tx until it is used to hide a
compilation warning.
2022-08-15 11:58:19 +02:00
Damien Picard
8a205b4036 Fix status bar keymap items during modal operations
The status bar keymap items still don't get translated because the
TIP_ translation introduced by rBe1974ae30e46 uses the wrong context:
it uses the default context, while the extraction introduced in
rB630b961f234e uses ID_WINDOWMANAGER.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15684
2022-08-15 09:51:20 +02:00
Damien Picard
e79312df6e I18n: translate recent files and bookmarks in the file browser
This is not dynamic: it only happens when the dir is added to the
list--automatically for recent files, and by the user for bookmarks.
Entries can then be manually renamed like other dirs. They will
keep the same name if the language is changed afterwards.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15629
2022-08-15 09:48:47 +02:00
77c867a5ee Cleanup: simplify sin_cos_from_fraction
Multiply numerator and denominator by 8 to split circle into octants.
Use symmetry and negation to increase precision.
2022-08-15 15:47:02 +12:00
4a11c0aabb Fix regression: crash with uv constrain to bounds without image
Merge confusion between cc1daa9b76 and 0d62e963b0.
2022-08-15 15:05:57 +12:00
659b63751d EEVEE-Next: Light: Add light evaluation support
This is the same implementation as the old one.
2022-08-14 20:40:04 +02:00
67d7792503 EEVEE-Next: Light: New light module
Compared to the previous implementation this has a limit of 65536 lights
per scene. Lights exceeding this limit will be ignored.

This also introduce fine grained GPU light culling, making rendering
many lights in a scene more efficient as long they don't overlap much.

Compatible light panels have been unhidden.

Note: This commit does not include surface evaluation, only light culling.
2022-08-14 20:40:04 +02:00
1226f5848d DRW: Add intersection and shape libraries for GLSL
These are meant to provide easy shape and AABB operation for culling.

They are currently incomplete but can be extended as one see fits.

The `common_debug_shape_lib.glsl` contains helper to draw thoses shapes.
2022-08-14 20:40:04 +02:00
0f7a5c4070 DRW: Debug: Fix print template
It was impossible to print literals like `drw_print(5)`.
2022-08-14 20:40:04 +02:00
89a2cb9297 DRW: Debug: Fix drw_debug_sphere not positioning and scaling the sphere
It was an oversight.
2022-08-14 20:40:04 +02:00
c81c5358ac GPencil: Engine: Make GL lights declaration optional
This avoid some macro name clashing with other engines where this struct
is not needed.
2022-08-14 20:40:04 +02:00
4b14fea38e GPU: Fix shader builder compilation
Was missing a stub.
2022-08-14 20:40:04 +02:00
407f11c55f Cleanup: Move object_vgroup.c to C++ 2022-08-14 14:32:54 -04:00
39bad22008 Cleanup: Add comments about deprecated flags 2022-08-14 09:19:40 -04:00
64f0c25a46 Fix: Incorrect access of mesh hide layers
Mistake in 2480b55f21
2022-08-13 22:34:11 -04:00
c2c019dda8 Fix Cycles MetalRT compile error 2022-08-13 19:55:38 +02:00
b5e92c3dfe Merge branch 'blender-v3.3-release' 2022-08-12 18:55:28 -03:00
ffd4f4a486 Fix T100354: Home key being the grave accent in french keyboard layout
I'm still not sure how the `0xFF` value came about, but it's not a
valid virtual key code.

Therefore it should not be used in `MapVirtualKey`.
2022-08-12 18:54:39 -03:00
dcfe7f795c BLF: Adjustments to Static Font Details
Adjust static font details so that we can properly display Arabic
contextual letter forms. And so that alphabetical ligatures are loaded
from language-specific fonts.

See D15678 for more details

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

Own Code.
2022-08-12 11:57:53 -07:00
3de18e16dd Merge branch 'blender-v3.3-release' 2022-08-12 17:57:10 +02:00
c1c0473a7e Fix out of bounds read in LineArt if there are only interestion edges
In this case the array allocation would allocate an array of size zero.
This would then later lead to out of bounds memory reads.

Now the code will skip zero length allocations.
2022-08-12 17:56:36 +02:00
0efb6d8a83 Merge branch 'blender-v3.3-release' 2022-08-12 12:13:52 -03:00
82fe475f06 Fix T100370: Depth choice for "Add Cube" tool always using Surface
As the surface normal is calculated along with the coordinates, the
surface depth was always being used when surface orientation was set.

Therefore, even calculated, ignore the surface depth when it is not
required.

Also promote an optimization when neither orientation nor depth is required.
2022-08-12 12:13:24 -03:00
6c6e59e846 Merge branch 'blender-v3.3-release' 2022-08-12 16:23:28 +02:00
fd57f520ac Py API doc: Add warning that py-defined property accessor callbacks may be called in threaded context.
At least Depsgraph evaluation and liboverride diffing do process IDs in
parallel, so python code in py-defined properties should not access any
data outside of their owner ID.

Ref. T100203.
2022-08-12 16:23:12 +02:00
62eb21e3ce Fix T100203: Freeze using override_hierarchy_create with Object level property with custom getter function.
As suggested by @brecht, use the `BPy_BEGIN`/`END_ALLOW_THREADS` macros.

Note that there may be other bits of code needing this too.
2022-08-12 16:23:12 +02:00
d13ed3c157 Merge branch 'blender-v3.3-release' 2022-08-12 16:14:51 +02:00
515a15f200 Fix syntax error introduced in previous commit 2022-08-12 16:13:09 +02:00
e7908c0790 Merge branch 'blender-v3.3-release' 2022-08-12 16:04:42 +02:00
79787bf8e1 Cycles: Improve denoiser update performance when rendering with multiple GPUs
This patch causes the render buffers to be copied to the denoiser
device only once before denoising and output/display is then fed
from that single buffer on the denoiser device. That way usually all
but one copy (from all the render devices to the denoiser device)
can be eliminated, provided that the denoiser device is also the
display device (in which case interop is used to update the display).
As such this patch also adds some logic that tries to ensure the
chosen denoiser device is the same as the display device.

Differential Revision: https://developer.blender.org/D15657
2022-08-12 16:00:54 +02:00
8af5267495 Merge branch 'blender-v3.3-release'
Conflicts:
	source/blender/editors/space_outliner/tree/tree_element_overrides.cc
2022-08-12 15:22:12 +02:00
27105af938 Cleanup: unused debug variable. 2022-08-12 15:20:43 +02:00
110356d8ad Merge branch 'blender-v3.3-release' 2022-08-12 15:18:37 +02:00
47af1ce8ac Cleanup: leftover debug prints. 2022-08-12 15:18:10 +02:00
4e5f9bbd34 Merge branch 'blender-v3.3-release'
Conflicts:
	source/blender/editors/space_outliner/outliner_tools.cc
2022-08-12 15:17:12 +02:00
c73cc15e07 LibOverride: Rework Outliner contextual menu.
Follow-up to design discussions here at the studio, add liboverride
operations into their own sub-menu, with three main entries:
- Create: Create, or enable for user editing, override hierarchies.
- Reset: Keep overrides data, but reset all local changes to the
  reference linked data values.
- Clear: like reset, but also turn editable overrides back to system
  overrides (aka non user editable).

Those three options can all operate either on the selected items, their
content only, or both.

Advanced operations are moved into a "Troubleshoot Hierarchy" sub-menu,
where one can resync, resync enforced, and fully delete library
overrides. Those operations always affect a whole override hierarchy,
regardless of which items are selected or not.
2022-08-12 15:11:59 +02:00
886768a699 CMake: correct linking order regression
Library sorting from [0] caused WITH_GPU_BUILDTIME_SHADER_BUILDER
to fail. It's possible there are missing dependencies that caused
the change in order to break, for now revert that change.

[0]: 19b5524d1c
2022-08-12 22:13:50 +10:00
223d623891 Cleanup: remove use_normals arugment to MOD_deform_mesh_eval_get
Accessing the normals creates them on demand so there was no need
to pass an argument requesting them.
2022-08-12 22:10:02 +10:00
afc71a0512 Merge branch 'blender-v3.3-release' 2022-08-12 21:51:18 +10:00
f4aec3719f Merge branch 'blender-v3.3-release' 2022-08-12 21:51:16 +10:00
4dc9a8a21e Fix T100191: Crash with the wave modifier using normals in edit-mode 2022-08-12 21:49:06 +10:00
4d2e2a6691 Fix T100350: missing brush falloff preview in sculpt mode 2022-08-12 13:46:34 +02:00
d42b61014b Merge branch 'blender-v3.3-release' 2022-08-12 12:42:35 +02:00
e0e4005582 Cleanup: Typos in comments. 2022-08-12 12:42:03 +02:00
74645d969b Merge branch 'blender-v3.3-release'
Conflicts:
	source/blender/blenkernel/BKE_lib_override.h
2022-08-12 12:40:46 +02:00
afd2e9ebc3 Fix (unreported) infinite tie building Outliner liboverride hierarchy tree.
In complex scenes featuring thousands of connections between IDs in
their liboverride hierarchies (e.g. Heist files), the time required to
check if tree items were available (before allocated a new one) would
become insanely long (O(n^2)).

This commit brings it back to roughly a constant time, only re-checking
the whole array for unused items once in a while (once every 10k times
currently), since in almost all cases is the index after `lastused`
value is not unused, and you have reached the end of the currently used
array of items, you actually need to 'allocate' a new one anyway.

It also improves the handling of `lastused` index, in particular in
`tse_group_add_element`.

This makes switching to the Outliner override hierarchy view in Heist
scenes from virtually infinite time (more than 30mins for sure) to about
20 seconds on my machine. Still far from being effectively usable.

Note that this is only a bandaid fix anyway, root of the issue is that
this view has to deal with way too many items in its tree, current code
is not designed for that. Either outliner has to improve its tree
handling (by only building subsets of the whole tree maybe?), or we have
to cull/filter out some of the ID relationships between overridden IDs
to make this view actually usable. Maybe limit the depth of the tree?
2022-08-12 12:37:10 +02:00
7f44dc79a6 Fix (unreported) crashes in Outliner override hierarchy view.
Fix wrong assumption that 'embedded' IDs are only ever used by their
owners. This is especially not true with shape keys.

Also small optimization by adding an eraly abort when both IDs are the
same (i.e. an ID has a pointer to itself).
2022-08-12 12:37:10 +02:00
12b3616895 IDType get_owner: add an optional hint about owner ID.
In some cases, there is a chance code already knows who might be the
owner of the given ID, in which case it can be more efficient to check
it first (especially in cases like embedded node trees or scene
collections, where the only other way is to loop over all possible
owners currently).

Will be used in next commit in some Outliner fix.
2022-08-12 12:37:10 +02:00
498e26fa0f Fix T100138: Use double for LineArt intersection record.
The use of `float` for intermediate intersection record led to some
inaccuracy which caused flickering in intersection lines. Now fixed.
2022-08-12 15:40:58 +08:00
7f733e294d Merge branch 'blender-v3.3-release' 2022-08-12 14:43:53 +10:00
95cc5c6081 Fix T96885: Drag Fallback on Tweak is using Move instead
Since [0] (fix for T95591), the tweak tools fallback action used tweak
instead of press.

This was enabled so tools such as "Measure" & "Add Cube" could use
fallback tools (otherwise is wasn't possible to add a new ruler without
also selecting for e.g.), however this is of limited use since both
tools support dragging anywhere to activate, making them less useful
with other selection tools beside tweak (box/lasso for e.g.).

Resolve by disabling the fallback option for tools where using the
tweak tool to select is undesirable. Selection by clicking with
"Measure" & "Add Cube" is still supported as this is also set in the
3D view's key-map.

[0]: 0e51defcf4
2022-08-12 14:24:31 +10:00
b751275af2 Cleanup: repeated words in strings 2022-08-12 12:46:31 +10:00
996cb4008d Cleanup: repeated words in comments 2022-08-12 12:38:54 +10:00
266a125b11 Cleanup: use sizeof() for better readability 2022-08-12 12:21:47 +10:00
f145366ae0 Cleanup: add missing braces, quite warnings by casting 2022-08-12 12:13:45 +10:00
a6d2fcef9f Cleanup: group translation imports 2022-08-12 12:07:52 +10:00
a1926c04b4 Cleanup: remove unnecessary ifdef 2022-08-12 11:25:10 +10:00
269e037ff4 Cleanup: replace misleading use of 'true' for the bit-field size
Also use a bit-field for SnapObjectParams.keep_on_same_target
2022-08-12 11:20:56 +10:00
c321572456 Cleanup: screw modifier comments & naming
Rename dist to dist_sq as it's the squared distance,
also prefer __func__ in temporary allocated arrays.
2022-08-12 11:18:00 +10:00
408687c75f Cleanup: use 'filepath' for fill paths 2022-08-12 11:14:31 +10:00
fe63124c3e Cleanup: add missing braces in GHOST 2022-08-12 11:13:07 +10:00
7347252f0f Cleanup: remove unnecessary icon assignment 2022-08-12 11:05:45 +10:00
d99ec7ff9e Cleanup: clang-tidy GHOST Context/Event/TimerManager 2022-08-12 11:04:21 +10:00
75c5b21a1c Cleanup: update comments in MANTA_main.cpp 2022-08-12 11:03:24 +10:00
42698b2dd9 Cleanup: use enum type for argument 2022-08-12 11:02:37 +10:00
dfd2570d28 WM: define WM_OT_drop_blend_file path as a file-path, skip-save
File paths have special handling of non-utf8 characters, so it's
best to use the FILE_PATH sup-type for all file-paths.
2022-08-12 10:59:14 +10:00
d4a082bc70 Cleanup: use short names for verts & polys as they're unambiguous
Follow conventions used in most existing code.
2022-08-12 10:56:27 +10:00
0c0c361123 Cleanup: replace magic number with flag 2022-08-12 10:48:15 +10:00
8649ac0ca8 Cleanup: early exit ui_but_extra_operator_icon_mouse_over_get
Early exit when the button has no extra icons, avoiding a redundant
transformation from mouse to button coordinates.
2022-08-12 10:41:39 +10:00
a2247c271c Cleanup: typo in selection check
In practice this is harmless as in most cases checking selected
vertices is enough, however as the intention is to check all 3 elements
it's best to do so.
2022-08-12 10:37:28 +10:00
282a861e11 Fix incorrect custom-data layer access for hide layers
Error in [0], missed in review.

[0] 2480b55f21
2022-08-12 09:16:09 +10:00
62d1ed0120 Cleanup: replace term face with poly
Be consistent with naming to avoid mixing MPoly/MFace.
2022-08-12 08:57:38 +10:00
344919240c Fix: Broken mesh hide status RNA accessors
Mistake in 2480b55f21.
Also deduplicate some of the code to find the indices of mesh elements.
2022-08-11 17:56:08 -04:00
d2b1e4712d BLF: Mutex Lock Glyph Cache Per Font, Not Global
Only lock access to our glyph caches per-font, rather than globally.
Also upgrade from spinlocks to mutexes.

See D15644 for more details.

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

Reviewed by Brecht Van Lommel
2022-08-11 12:52:07 -07:00
2fc7e15164 Fix: Use of uninitialized variable in recent commit
Mistake in 2480b55f21.
2022-08-11 14:40:42 -04:00
c9d821294f Cycles: take into account time limit for progress bar
This change allows the Cycles progress report system to take into conderation
the time limit property. This allows for more accuracte progress reports for
high sample count renders with short time limits.

Contributed by Alaska.

Differential Revision: https://developer.blender.org/D15599
2022-08-11 19:37:18 +02:00
ef5a44df2d Merge branch 'blender-v3.3-release' 2022-08-11 19:28:03 +02:00
6161b8dc63 Fix T100130: animation player crash on exit
GPU_exit is now expected to run within an active GPU context.

Also run BLF_exit and IMB_exit first they can use GPU resources and gave
ASAN errors. And remove redundant GPU_shader_free_builtin_shaders already
handled by GPU_exit.
2022-08-11 19:23:15 +02:00
90e027e594 Curve: Simplify legacy curve conversion to mesh
Build the mesh directly instead of returning arrays which need to be
copied to a new mesh. Also decrease the scope of some variables.
2022-08-11 13:09:55 -04:00
2480b55f21 Mesh: Move hide flags to generic attributes
This commit moves the hide status of mesh vertices, edges, and faces
from the `ME_FLAG` to optional generic boolean attributes. Storing this
data as generic attributes can significantly simplify and improve code,
as described in T95965.

The attributes are called `.hide_vert`, `.hide_edge`, and `.hide_poly`,
using the attribute name semantics discussed in T97452. The `.` prefix
means they are "UI attributes", so they still contain original data
edited by users, but they aren't meant to be accessed procedurally by
the user in arbitrary situations. They are also be hidden in the
spreadsheet and the attribute list by default,

Until 4.0, the attributes are still written to and read from the mesh
in the old way, so neither forward nor backward compatibility are
affected. This means memory requirements will be increased by one byte
per element when the hide status is used. When the flags are removed
completely, requirements will decrease when hiding is unused.

Further notes:
 * Some code can be further simplified to skip some processing when the
   hide attributes don't exist.
 * The data is still stored in flags for `BMesh`, necessitating some
   complexity in the conversion to and from `Mesh`.
 * Access to the "hide" property of mesh elements in RNA is slower.
   The separate boolean arrays should be used where possible.

Ref T95965

Differential Revision: https://developer.blender.org/D14685
2022-08-11 12:59:06 -04:00
5cbfdaccd0 Cleanup: minor changes to DebugFlags
Use C++11, remove unused running_inside_blender and move viewport_static_bvh
to BlenderSync.
2022-08-11 17:03:10 +02:00
4cbd799373 obj: support importing multiple files at once
Implemented the same way as STL or GPencil SVG importers: loop over
the input files, import one by one.

Has been requested by the community for quite a long time
(e.g. https://blender.community/c/rightclickselect/Jhbbbc/), as well
as 3rd party addons to implement just this
(https://github.com/p2or/blender-batch-import-wavefront-obj).
2022-08-11 17:05:54 +03:00
c4a0438522 Merge branch 'blender-v3.3-release' 2022-08-11 15:54:04 +03:00
0a096f2be2 Fix T98781: OBJ exporter wrongly writing default material socket values when textures are present
Report T98781 and part of T97642: the MTLMaterial info only captures
image nodes and the default socket values. When the image information
is present, do not emit the socket defaults - the .MTL spec states
they are multiplied together, but the default value is not used
in blender when the socket is connected.

Also contains svn tests repository update to extend the test coverage,
and update test expectation outputs.
2022-08-11 15:51:36 +03:00
aa0ca3aefa GHOST/Wayland: support setting modifiers on window activation
Take advantage of Waylands wl_keyboard_listener.enter callback which
takes an array of keys that are pressed when a window is activated.

Resolves T74684 under Wayland.
2022-08-11 16:48:55 +10:00
1c716cbeb7 Cleanup: access modifier keys by index under Wayland
This simplifies accessing modifiers as there is no need to perform
a string lookup each time (which may fail).
2022-08-11 16:48:08 +10:00
8bc76bf4b9 Fix T66088: Modifier keys ignored when the window doesn't have focus
Always use modifier keys from the active window, as changes to the
modifiers aren't sent to inactive windows.

Also resolves modifier keys being lost on window de-activation.
Activating the window again would check the previous state of the
modifiers which was always cleared as of [0],
now clearing is no longer needed.

[0]: 472595f1d3
2022-08-11 15:59:40 +10:00
51381c94d8 BLF: Fallback Broken After Cache Removal
Font fallback feature not working after reverting the implementation
of the cache system. Missing an blf_ensure_face before
FT_Get_Char_Index. Otherwise glyphs not found in fonts without faces.

Own Code
2022-08-10 20:50:49 -07:00
f35d671f46 Cleanup: refactoring uvislands to prepare for python api
Add element_map->island_total_uvs.
Add element_map->island_total_unique_uvs.
Simplify callers based on new members.
Add comments.

Resolves: D15598
2022-08-11 14:20:44 +12:00
d52d71b834 Cleanup: doxy parameters, use static set instead of tuple 2022-08-11 11:17:24 +10:00
fb8e604ff4 Merge branch 'blender-v3.3-release' 2022-08-11 11:10:13 +10:00
ed55054e57 Fix T100204: RMB select (with "Select Tool") causes edit-mesh conflict
When RMB select activated the selection tool, Alt-RMB would both
tweak and loop-select.

Fix/workaround this by passing though 'enumerate' unless the option
can be used (when selecting objects or armatures).
2022-08-11 11:06:54 +10:00
9015cba5ce Cleanup: clang-tidy uv_parametrizer.cc 2022-08-11 11:03:23 +10:00
d1e2988a12 Cleanup: missing newline in GHOST_PRINT 2022-08-11 10:58:41 +10:00
d9c2922a14 Cleanup: remove redundant MEM_SAFE_FREE
MEM_SAFE_FREE isn't necessary when the memory is known to be allocated
and clearing the value afterwards isn't necessary.
2022-08-11 10:57:14 +10:00
4641d6d7b0 Cleanup: check if the camera was moved before auto-key in smooth-view
There is no need to attempt to auto-key when the camera isn't moved.
2022-08-11 10:31:50 +10:00
b9b45c2036 Cleanup: pass const arguments to smooth-view functions
Also move region redraw tag out of view3d_smoothview_apply_with_interp
as it's not always needed.
2022-08-11 10:05:21 +10:00
07deb9a71b Cleanup: replace magic number 2022-08-11 09:52:49 +10:00
32c8a28720 Cleanup: spelling in comments 2022-08-11 09:51:19 +10:00
d68018cf10 License headers: add missing license header 2022-08-11 09:35:02 +10:00
fb7ef40006 Cleanup: refactoring uvislands to prepare for python api
Add #bm_uv_ensure_head_table

See also: D15598
2022-08-11 11:20:00 +12:00
e19986482f Cleanup: reduce asan lint and clang-tidy warnings on uv_parametrizer 2022-08-11 11:10:37 +12:00
13c5f6e08f Cleanup: refactoring uvislands to prepare for python api
Migrate island calculation to #bm_uv_build_islands.
Simplify connectedness calculation.
Reduce memory pressure.
No functional changes.

See also: D15598
2022-08-11 08:24:37 +12:00
bb3174e15b Merge branch 'blender-v3.3-release' 2022-08-10 18:06:13 +03:00
8c59b93505 obj: Also find .mtl images by their basename, if all else fails (T77801)
While T77801 itself is working as expected in the new C++ obj
importer, the repro file there uses absolute paths to material images,
yet the images themselves are right there in the current folder.

The old python based importer did find them, since it was doing a
really complex image search. My understanding is that while C++
importer was developed, it was decided to not do that -- however
just the "basename file in the mtl directory" sounds simple enough
and gets the repro case file work correctly.
2022-08-10 18:03:39 +03:00
5689dda6f7 Compositor: Limit C linkage of cryptomatte functions
Most of the functions in the compositor cryptomatte file are declared
with extern "C" linkage, which can cause symbol conflict even when
functions exist in separate namespaces. This is not actually necessary,
as the declaration of the few functions that require C linkage are
already declared as such in the header file, so this patch removes the
extern C scope from that file.

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

Reviewed By: Clement Foucault
2022-08-10 14:58:51 +02:00
27b9538e44 Realtime Compositor: Fix missing include in Displace node
The displace node was missing an include, which sometimes compiled fine
due to unity builds. This patch adds that missing include.
2022-08-10 14:10:07 +02:00
9596907363 Realtime Compositor: Allow in material preview mode
This patch allows the viewport compositor to operate in Material Preview
mode.

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

Reviewed By: Clement Foucault
2022-08-10 13:30:31 +02:00
79953d5482 Realtime Compositor: Fix clang tidy warnings
Fix a number of warnings reported by Clang Tidy in the realtime
compositor's code.

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

Reviewed By: Clement Foucault
2022-08-10 13:04:36 +02:00
f9589fab60 Render: remove camera shift hard limits
There is no need for these to be limited to -10..10, soft limits are enough.

Contributed by fundorin.

Differential Revision: https://developer.blender.org/D15650
2022-08-10 13:02:32 +02:00
089216067f Merge branch 'blender-v3.3-release' 2022-08-10 13:36:48 +03:00
d76583cb4a Fix T100302: New OBJ importer produces too many vertices when faces don't span a continuous range
As part of the previous fix (D15410), the importer got code to track
min & max vertex indices used as part of the mesh faces. However, if
faces refer to a "sparse" (i.e. non-contiguous) subset of all vertices,
then the imported mesh would contain all the vertices between min & max
range.

Replace that with proper tracking of actually used vertex indices
for each imported mesh. Fixes T100302.

This does affect import performance a tiny bit, e.g. importing Blender
3.0 splash scene goes 21.7s -> 22.1s, and importing rungholt.obj
goes 2.37s -> 2.48s.

Importer related tests have a bunch of vertex changes in them, since
now vertices are added in the order that the faces are referring
to them. Which incidentally matches the order that the Python based
importer was creating them too.
2022-08-10 13:34:58 +03:00
54c26f58d0 Cleanup: Fix warning in release builds 2022-08-10 11:02:38 +02:00
f12f7800c2 Depsgraph: Optimize evaluation of dependencies of disabled modifiers
Solves long-standing issue when dependencies of disabled modifiers are
evaluated.

Simple test case: no drivers or animation. Manually enabling modifier
is expected to bring FPS up, enabling modifier will bring FPS (sine
evaluation can not be avoided)

F13336690

More complex test case: modifier visibility is driven by an animated
property. In am ideal world FPS during property being zero is fast
and when property is 1 the FPS is low.

F13336691.

Differential Revision: https://developer.blender.org/D15625
2022-08-10 11:02:38 +02:00
cfbe11563a Depsgrapg: Add per-modifier graph nodes
No functional changes expected.
2022-08-10 11:02:38 +02:00
fad112be1c Realtime Compositor: Add stub unsupported nodes
This patch adds a stub implementation for all unsupported nodes. The
inputs are passed through to the outputs where it make sense, while
other outputs will be allocated a single zero value.

This seems to be preferred by users as opposed to stopping execution and
displaying an error message.

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

Reviewed By: Clement Foucault
2022-08-10 10:36:57 +02:00
40c45985a9 Realtime Compositor: Add basic distort nodes
This patch implements the following nodes for the realtime compositor:

- Crop node.
- Flip node.
- Lens distort node.
- Rotate node.
- Transform node.
- Translate node.

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

Reviewed By: Clement Foucault
2022-08-10 10:30:27 +02:00
c014021802 Realtime Compositor: Add basic matte nodes
This patch implements the following nodes for the realtime compositor:

- Box mask node.
- Channel matte node.
- Chroma matte node.
- Color matte node.
- Color spill node.
- Difference matte node.
- Distance matte node.
- Ellipse matte node.
- Luminance matte node.

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

Reviewed By: Clement Foucault
2022-08-10 10:21:18 +02:00
b5df7a02ac Realtime Compositor: Add basic convert and vector nodes
This patch implements the following nodes for the realtime compositor:

- Map range node.
- Map value node.
- Math node.
- Normal node.
- Alpha convert node.
- Separate color node.
- Combine color node.
- Separate XYZ node.
- Combine XYZ node.
- Separate RGBA node.
- Combine RGBA node.
- Separate HSVA node.
- Combine HSVA node.
- Separate YCCA node.
- Combine YUVA node.
- Set alpha node.
- Switch node.
- Switch view node.
- RGB to BW node.
- Color ramp node.

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

Reviewed By: Clement Foucault
2022-08-10 10:09:35 +02:00
6109ad6cce Realtime Compositor: Add basic color nodes
This patch implements the following nodes for the realtime compositor:

- Alpha over node.
- Bright contrast node.
- Color balance node.
- Color correction node.
- Exposure node.
- Gamma node.
- Hue correct node.
- Hue saturation value node.
- Invert node.
- Mix node.
- Posterize node.
- Time curve node.
- Vector curve node.

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

Reviewed By: Clement Foucault
2022-08-10 09:58:44 +02:00
865204fef0 Realtime Compositor: Add basic input nodes
This patch implements the following nodes for the realtime compositor:

- Image node.
- Movie clip node.
- Render layers node.
- RGB node.
- Scene time node.
- Value node.

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

Reviewed By: Clement Foucault
2022-08-10 09:45:28 +02:00
365fbb447e Realtime Compositor: Add basic output nodes
This patch implements the following nodes for the realtime compositor:

- Composite node.
- Viewer node.
- Split viewer node.

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

Reviewed By: Clement Foucault
2022-08-10 09:40:07 +02:00
624b0ac656 Realtime Compositor: Add evaluator and engine
This patch adds the core realtime compositor evaluator as well as a
compositor draw engine powered by the evaluator that operates in the
viewport. The realtime compositor is a new GPU accelerated compositor
that will be used to power the viewport compositor imminently as well as
the existing compositor in the future.

This patch only adds the evaluator and engine as an experimental
feature, the implementation of the nodes themselves will be committed
separately.

See T99210.

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

Reviewed By: Clement Foucault
2022-08-10 09:14:22 +02:00
169216684a Merge branch 'blender-v3.3-release' 2022-08-10 16:43:33 +10:00
b114993305 Fix T99963: Fallback actions are used in RCS on left click
Regression in [0].

Disable fallback tools for the 3D cursor so other shortcuts are
available such as lasso-select.

[0]: b0847eff2a
2022-08-10 16:39:29 +10:00
77f41da5f1 Cleanup: spelling 2022-08-10 16:23:11 +10:00
72f388c85e Cleanup: format 2022-08-10 16:15:45 +10:00
39f706a76c Cleanup: fix attr_nonnull error found by asan 2022-08-10 16:55:43 +12:00
1150dcf93e make_update: quiet warning when SVN lib/ contains hidden files
make_update attempted to update hidden local files, skip them instead.
2022-08-10 12:11:04 +10:00
9ef0f25a80 Merge branch 'blender-v3.3-release' 2022-08-09 21:27:14 -04:00
07ac26f0a5 Update RNA to User manual mappings 2022-08-09 21:26:48 -04:00
68e2084b07 Merge branch 'blender-v3.3-release' 2022-08-09 19:10:13 -05:00
bdb85bdd98 Fix T100308: Removing scene time node does not update relations
Similar to the fix in 734c6a4405.
2022-08-09 19:09:43 -05:00
31e06a8c73 Fix T99661: Use after free converting edit mode curve object to mesh
The fix from c0fdf16561 was missing in one place. We don't
want to free the edit mode pointers, those are just copied because the
edit mode changes aren't present in the actual original data-block.
2022-08-09 18:24:44 -05:00
90b7c3d05e Fix T99661: Use after free converting edit mode curve object to mesh
The fix from c0fdf16561 was missing in one place. We don't
want to free the edit mode pointers, those are just copied because the
edit mode changes aren't present in the actual original data-block.
2022-08-09 17:49:41 -05:00
a9a7460570 DRW: DebugDraw: Fix unguarded drw_debug_draw()
This might create nullptr dereference in some cases.
2022-08-09 23:05:07 +02:00
11bdc321a2 Sculpt: Register sculpt brush op so it clears last operator panel
Needed to prevent changing values in the last operator panel
from destructively undoing brush steps.
2022-08-09 12:54:24 -07:00
1d68318e97 Cleanup: Add function for creating object dupli with separate data 2022-08-09 14:44:47 -05:00
edd6d301c7 Cleanup: Move mball.c to C++
Facilitates changes in D14593
2022-08-09 13:49:09 -05:00
f8b1483566 Cleanup: Remove unused object batch cache API function
Remove the "tag batch cache dirty" function specifically  for object data,
since it isn't used. Ref D14593
2022-08-09 13:03:35 -05:00
c15a63d21e Cleanup: MIscellaneous improvements to pointcloud draw cache
- Use references
- Reorder functions to remove unnecessary prototype
- Use the attribute API
- Use const where possible
- Split no-radius extraction a bit more, add multithreading
2022-08-09 12:37:09 -05:00
752fb5dd08 Merge branch 'blender-v3.3-release' 2022-08-09 19:19:54 +02:00
79f1cc601c Cycles: improve ray tracing precision near triangle edges
Detect cases where a ray-intersection would miss the current triangle, which if
the intersection is strictly watertight, implies that a neighboring triangle would
incorrectly be hit instead.

When that is detected, apply a ray-offset. The idea being that we only want to
introduce potential error from ray offsets if we really need to.

This work for BVH2 and Embree, as we are able to match the ray-interesction
bit-for-bit, though doing so for Embree requires ugly hacks. Tiny differences
like fused-multiply-add or dot product intrinstics in matrix inversion and ray
intersection needed to be matched exactly, so this is fragile.

Unfortunately we're not able to do the same for OptiX or MetalRT, since those
implementations are unknown (and possibly impossible to match as hardware
instructions). Still artifacts are much reduced, though not eliminated.

Ref T97259

Differential Revision: https://developer.blender.org/D15559
2022-08-09 18:42:01 +02:00
1e8e70a90c Cleanup: Remove file mistakenly kept in C++ conversion 2022-08-09 11:15:59 -05:00
4ab6baefb1 Cleanup: Move draw_cache_impl_pointcloud.c to C++ 2022-08-09 11:10:44 -05:00
230f9ade64 Cycles: make transform inverse match Embree exactly
Helps improve ray-tracing precision. This is a bit complicated as it requires
different implementation depending on the CPU architecture.
2022-08-09 16:59:05 +02:00
286e535071 Cleanup: simplify CPU instruction checking
The performance of this will be slightly more important for upcoming changes.
Also removed an unused function and changed includes so these system.h can
be included in more places.
2022-08-09 16:59:05 +02:00
Andrii Symkin
d832d993c5 Cycles: add new Spectrum and PackedSpectrum types
These replace float3 and packed_float3 in various places in the kernel where a
spectral color representation will be used in the future. That representation
will require more than 3 channels and conversion to from/RGB. The kernel code
was refactored to remove the assumption that Spectrum and RGB colors are the
same thing.

There are no functional changes, Spectrum is still a float3 and the conversion
functions are no-ops.

Differential Revision: https://developer.blender.org/D15535
2022-08-09 16:49:34 +02:00
7921faa651 Merge branch 'blender-v3.3-release' 2022-08-09 16:45:28 +02:00
9644740230 Fix T99949: Crash when last input from File Output node is deleted
Regression since e4278b72bb.

Need to check inputs exist prior to requesting first input as it
might not exist.
2022-08-09 16:44:36 +02:00
1988665c3c Cleanup: make vector types make/print functions consistent between CPU and GPU
Now all the same ones are available on CPU and GPU, which was previously not
possible due to lack of operator overloadng in OpenCL. Print functions are
no-ops on some GPUs.

Ref D15535
2022-08-09 16:07:23 +02:00
9990792e87 Compositor: Rename compositor build option
Currently, the compositor can be disabled using the WITH_COMPOSITOR
build option. Since, we intent to always build the realtime compositor,
we need to make the distinction between both compositors clear.

So this patch renames the option to WITH_COMPOSITOR_CPU. Additionally,
the check for the option was moved inside the compositor modules' own
CMake file in preparation for the realtime compositor code.

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

Reviewed By: Jeroen Bakker, Ray Molenkamp
2022-08-09 15:59:56 +02:00
cefd6140f3 Fix T100119: Cycles light object's parametric vector distorted
Caused by 38af5b0501.

Adjust barycentric coordinates used for intersection result in the
ray-to-rectangle intersection check.

Differential Revision: https://developer.blender.org/D15592
2022-08-09 15:56:03 +02:00
f6639cc4fc DRW: DebugDraw: Port module to C++ and add GPU capabilities
This is a complete rewrite of the draw debug drawing module in C++.
It uses `GPUStorageBuf` to store the data to be drawn and use indirect
drawing. This makes it easier to do a mirror API for GPU shaders.

The C++ API class is exposed through `draw_debug.hh` and should be used
when possible in new code.

However, the debug drawing will not work for platform not yet supporting
`GPUStorageBuf`. Also keep in mind that this module must only be used
in debug build for performance and compatibility reasons.
2022-08-09 15:45:46 +02:00
2e4727e123 GL: Fix error messages missing end of line 2022-08-09 15:45:46 +02:00
be50d526eb Merge branch 'blender-v3.3-release' 2022-08-09 21:07:50 +10:00
34c7f42c08 Merge branch 'blender-v3.3-release' 2022-08-09 21:07:47 +10:00
19b74f8120 Merge branch 'blender-v3.3-release' 2022-08-09 21:07:44 +10:00
8aa98d1043 Merge branch 'blender-v3.3-release' 2022-08-09 21:07:41 +10:00
541f9dbfd2 Merge branch 'blender-v3.3-release' 2022-08-09 21:07:38 +10:00
Damien Picard
af59e32c13 I18n: make more parts of the UI translatable
- "Name collisions" label in mesh properties
- "Threshold" labels in Vertex Weight Edit modifier
- "Particle System" label in Particle Instance modifier
- Slot number in the Shader Editor

- Status bar keymap items during modal operations:
  add TIP_() macro to status bar interface template

- On dumping messages, sort preset files so their messages are stable
  between runs

Ref. T43295

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15607
2022-08-09 21:07:32 +10:00
2de1b06287 I18n: add extraction of modal event names.
Alternative fix to the one proposed in D15607.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D15643
2022-08-09 21:07:32 +10:00
efc1d4bb9a WM Modal Keymaps: Add accessors to modal event values.
It is currently impossible to access modal keymaps' event values (from
`propvalue` enum) from python code (for API introspection).

This is needed for i18n messages extraction (see D15607).

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D15643
2022-08-09 21:07:32 +10:00
Damien Picard
a2bdd6a71a I18n: remove Window class from message extraction blacklist
Messages from the bpy.types.Window class were blacklisted in the
message extraction script.

This change allows a few new messages to be translated, including at
least two which show up in the UI. There are only 12 new messages in
the .po files, so even if some never need to be translated, that's not
too many.

Ref. T43295

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15628
2022-08-09 21:07:32 +10:00
7b0bc1573b Fix memory leak exporting to collada 2022-08-09 21:04:25 +10:00
Damien Picard
e1974ae30e I18n: make more parts of the UI translatable
- "Name collisions" label in mesh properties
- "Threshold" labels in Vertex Weight Edit modifier
- "Particle System" label in Particle Instance modifier
- Slot number in the Shader Editor

- Status bar keymap items during modal operations:
  add TIP_() macro to status bar interface template

- On dumping messages, sort preset files so their messages are stable
  between runs

Ref. T43295

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15607
2022-08-09 12:42:33 +02:00
630b961f23 I18n: add extraction of modal event names.
Alternative fix to the one proposed in D15607.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D15643
2022-08-09 12:22:30 +02:00
2682a59efe WM Modal Keymaps: Add accessors to modal event values.
It is currently impossible to access modal keymaps' event values (from
`propvalue` enum) from python code (for API introspection).

This is needed for i18n messages extraction (see D15607).

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D15643
2022-08-09 12:22:13 +02:00
Damien Picard
219b4dbc3c I18n: remove Window class from message extraction blacklist
Messages from the bpy.types.Window class were blacklisted in the
message extraction script.

This change allows a few new messages to be translated, including at
least two which show up in the UI. There are only 12 new messages in
the .po files, so even if some never need to be translated, that's not
too many.

Ref. T43295

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15628
2022-08-09 11:41:29 +02:00
fea8ee4c0b Cleanup: use static_cast in bmesh_mesh.cc 2022-08-09 14:27:49 +10:00
c7a7aee004 Cleanup: use own username in code-comment tags 2022-08-09 14:18:18 +10:00
eab988c9f6 Merge branch 'blender-v3.3-release' 2022-08-09 13:54:05 +10:00
90b2ed6c4b Fix T100277: Grease pencil lines don't start at click-start
Regression in b8960267dd.
2022-08-09 13:52:27 +10:00
dfbba7c0eb Cleanup: CMake file indentation 2022-08-09 13:37:29 +10:00
19b5524d1c Cleanup: sort cmake file-lists 2022-08-09 13:37:29 +10:00
d3c653c6d9 BLF: Revert FreeType Cache
Remove the FreeType cache implementation. Not multithreading correctly.

Original commit: 9d77b5a0ed

See D15647 for more details.

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

Own Code.
2022-08-08 20:33:43 -07:00
26b9c54b01 License headers: add missing license headers 2022-08-09 13:25:11 +10:00
a26b1a299f Cleanup: split smooth-view apply into 3 functions
Mixing view interpolation with finishing smooth-view caused arguments
to be passed in that only made sense for one of these cases.
This also makes the intention of the callers clearer.

- view3d_smoothview_apply_with_interp
- view3d_smoothview_apply_and_finish
- view3d_smoothview_apply_from_timer

Also rename 'step' to 'factor` and use `interpf` for blending values.
2022-08-09 10:53:19 +10:00
35b0a2f5e7 Merge branch 'blender-v3.3-release' 2022-08-09 10:51:03 +10:00
4915fc4547 Merge branch 'blender-v3.3-release' 2022-08-09 10:50:59 +10:00
8b3e3c1810 Fix T100242: Handle Flushed FT Sizes
Properly deal with FreeType cache flushing a font's ft_size. Set this
to NULL in finalizer, and add a blf_ensure_size to make sure it
exists only when needed.

See D15639 for more details.

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

Reviewed by Brecht Van Lommel
2022-08-08 17:23:25 -07:00
f5fc9a7edf Cleanup: compiler warnings 2022-08-09 09:42:02 +10:00
228f7cb5ce Fix viewport operators with a view locked camera
Smooth-view wasn't working properly with a locked-camera this could
animate from the wrong position if the camera wasn't in sync with the
underlying viewport transformation.

Resolve issues for:

- VIEW3D_OT_view_orbit
- VIEW3D_OT_view_roll
- VIEW3D_OT_zoom_border
2022-08-09 09:31:20 +10:00
8ed2abf856 Fix missing undo steps for smooth-view operators
Support pushing undo steps for smooth-view operations that manipulate
the camera. Now V3D_SmoothParams take optional undo arguments.

Used for:

- VIEW3D_OT_view_center_cursor
- VIEW3D_OT_view_center_pick
- VIEW3D_OT_view_orbit
- VIEW3D_OT_view_roll
- VIEW3D_OT_zoom_border

Follow up fix for T92099.
2022-08-09 09:31:18 +10:00
1e57ddf6ea Merge branch 'blender-v3.3-release' 2022-08-08 12:37:53 -03:00
b3fc8206be Revert "Fix T100280: GG not toggling the offset transform mode in tracker"
This reverts commits b72eddac61 and
f8b5706a1f.

And fixes T100265.

It brings more problems than solutions.
2022-08-08 12:37:25 -03:00
8d080013f5 Fix T100285: Shader value node always outputs zero
The shader value node always outputs zero in some cases even when its
value is not zero.

This is caused by b639e60864. In that
commit, the behavior of GPU node linking changed such that unlinked
sockets get their value from their associated GPU node stack instead of
the socket itself. But execution node stacks do not always have their
output values initialized, and since the value node stores its value in
its output, it follows that its uniform value will be wrong.

This patch fixes that by getting the value directly from the socket.
This is also done fro the RGBA node, since it is implemented similarly.
Finally, the GPU_uniformbuf_link_out function was removed since it is no
longer used and does not make sense anymore.

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

Reviewed By: Clement
2022-08-08 17:31:25 +02:00
bca20c10da Merge branch 'blender-v3.3-release' 2022-08-08 17:00:10 +02:00
2e6fcd9aad Fix Cycles crash after recent bugfix for image saving 2022-08-08 16:59:37 +02:00
c0b6aeeca7 Cleanup: fix source typo
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D15630
2022-08-08 16:13:32 +02:00
47f433c776 Merge branch 'blender-v3.3-release' 2022-08-08 11:00:10 -03:00
b72eddac61 Fix T100280: GG not toggling the offset transform mode in tracker
Caused by {rB791bfae1d64b}.

The solution was to create the special handle for the Move Clip and Mask
transformation.

One change that cannot be reversed is showing the `G` shortcut in the
statusbar.

But the description of this shortcut was not even correct before.
2022-08-08 10:59:29 -03:00
4b3315fc98 Fix T100281: image save after copy not using correct filepath
Always use the image datablock filepath for saving. The only apparent reason
use the image buffer file path is image sequences, for which the current frame
filepath is now computed.
2022-08-08 13:51:19 +02:00
1382514bf2 Fix: Error in oneAPI image code for texture access with clip extension 2022-08-08 10:47:11 +02:00
e22628c70b Cleanup: refactoring uvislands to prepare for python api
Fix copy+paste bug
2022-08-08 20:00:10 +12:00
bb8488c62c Cleanup: refactoring uvislands to prepare for python api
Rename vert -> vertex.
Add `BM_uv_element_get_head`.

See also: D15598
2022-08-08 17:18:15 +12:00
9b924b2a23 Fix: Typo in geometry node tooltip 2022-08-07 22:30:47 -05:00
64984126a2 Cleanup: refactoring uvislands to prepare for python api
Rename buf -> storage.

See also: D15598
2022-08-08 10:39:43 +12:00
387e7e9e8d Merge branch 'blender-v3.3-release' 2022-08-07 23:08:34 +02:00
e4938b163e Cycles: re-enable zebin format for Intel GPUs on Linux
zebin format is critical for the compatibility of AoT graphics binaries
across driver versions. It was previously disabled on Linux due to
runtime issues that are now fixed in
https://github.com/intel/compute-runtime/releases/tag/22.31.23852.
The minimum supported driver version isn't bumped to this one yet as
current codebase with current IGC compiler does actually run fine on
earlier drivers and is not running into these issues anymore.
2022-08-07 22:54:15 +02:00
344c53561a Fix: Incorrect field node deduplication for shortest path nodes
Mistake in c8ae1fce60.
2022-08-07 14:38:17 -05:00
341e9f7a7c Revert "Parallelize remesh reprojects"
This reverts commit 34009dfb23.
This was committed by accident an does not belong in master.
2022-08-07 20:09:20 +02:00
e207930350 Revert "Update grain size"
This reverts commit 31674b9d14.
This was committed by accident an does not belong in master.
2022-08-07 20:08:53 +02:00
6e8709caa3 Cleanup: Fix typo Propatation -> Propagation
Fixes the typo in the struct `DefaultPropatationMixerStruct`.
2022-08-07 19:48:28 +02:00
31674b9d14 Update grain size 2022-08-07 19:41:08 +02:00
34009dfb23 Parallelize remesh reprojects
Differential Revision: https://developer.blender.org/D15638
2022-08-07 19:41:08 +02:00
e441e21d74 Cleanup: refactoring uvislands to prepare for python api
See also: D15598
2022-08-07 16:11:47 +12:00
8b51bd61fd Cleanup: make format 2022-08-07 10:09:31 +12:00
b411011f9d Merge branch 'blender-v3.3-release' 2022-08-06 17:01:37 -05:00
800c7dbf41 Fix: Missing translation in deform curves on surface node
Also add an error message for when the node is used on non-curves
objects, since there's nothing in the UI to show why it doesn't work
except for that. And also use quotes when referring to attribute names.
2022-08-06 17:01:01 -05:00
a9b4b044e3 BLF: Remove Unwanted Font File
Remove "Material Icons" font file, mistakenly added.

See D15627 for details

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

Reviewed by Brecht Van Lommel
2022-08-06 12:53:23 -07:00
bf8b56a69e Cleanup: Const in headers, standardize variable names 2022-08-06 14:31:57 -05:00
ce352e6d00 Cleanup: Remove unused function 2022-08-06 14:24:47 -05:00
fecef2ae74 Merge branch 'blender-v3.3-release' 2022-08-06 13:16:34 -04:00
d58476049e Fix T98025: Revert "Fix Bevel intersection continuity."
This reverts commit 94866ef84f
A number of reports of bevel regressions came after the
commit to fix bevel intersection continuity.
Since the fix for some of those regressions is not obvious
we will revert the continuity improvement and do it as
part of the Bevel V2 project.
2022-08-06 12:40:11 -04:00
8f915f0efb Merge branch 'blender-v3.3-release' 2022-08-06 15:18:12 +10:00
8dadc091d0 LineArt: Usability improvement for "Enclosed Shapes".
This patch removes the [rather confusing] separate checkbox for enclosed
shapes in favour of integrating that option into illumination filtering,
with the benefit of not limiting the selection to cached result.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D15327
2022-08-06 12:20:15 +08:00
Pratik Borhade
befe38fe1d Fix T92099: No undo when moving viewport with camera locked to view
Supports undo step generation while navigating in locked camera view.
NDOF & track-pad navigation are not included for now.

Actions that uses smooth view can be supported but are outside
the scope of this change, includes undo push for:

- VIEW3D_OT_view_pan
- VIEW3D_OT_dolly
- VIEW3D_OT_fly
- VIEW3D_OT_move
- VIEW3D_OT_rotate
- VIEW3D_OT_walk
- VIEW3D_OT_zoom

Reviewed by: campbellbarton

Ref D15345
2022-08-06 12:57:06 +10:00
fcd61d2056 Cleanup: Move uv_parametrizer.c to C++
Differential Review: https://developer.blender.org/D15618
2022-08-06 13:54:40 +12:00
0d62e963b0 Cleanup: Simplify NULL handling for BKE_image_find_nearest_tile
Differential Revision: https://developer.blender.org/D15616
2022-08-06 09:52:23 +12:00
Laurynas Duburas
476de3b463 Surfaces: Enhanced edit mode extrude tool for NURBS
Adds support for extrusion from more than one edge and from inner
lattice legs. Also fixes extrusion from one point. Implemented in two
steps. At first so called "copy intervals" are calculated according to
selected control points. Then those are used to copy control points to
the new surface patch. See the differential revision for a video.

Differential Revision: https://developer.blender.org/D15524
2022-08-05 13:17:08 -05:00
74336cee38 Merge branch 'blender-v3.3-release' 2022-08-05 12:55:33 -05:00
74f983738a Fix T100143: RNA path information of Curves datablock incorrect 2022-08-05 12:53:27 -05:00
fafd1ab9d3 Merge branch 'blender-v3.3-release' 2022-08-05 19:49:12 +02:00
4181d82ad1 Fix T99812: Audio scrubbing freezes Blender 3.2.1
Bug was caused by a change in ffmpeg's API.
2022-08-05 19:40:39 +02:00
18b703dc05 Fix T99991: Cycles wrong intercept with new hair curves
Copy the improved hair curves sync implementation from D14942. That patch is
not ready as a whole but this part was verified to match the old hair particles
can be used already.
2022-08-05 19:33:53 +02:00
d95100e821 Fix T98769: Cycles crash with multi-device rendering and BVH refits 2022-08-05 17:19:19 +02:00
Chris Clyne
e437997174 Fix: compositor stats in background mode subject to race conditions
Evaluating a compositor node tree in background mode causes the stats callback
to be called from multiple threads, leading to garbled output. This was causing
major problems with render-farm scripts.

Differential Revision: https://developer.blender.org/D15633
2022-08-05 16:45:50 +02:00
43a124bc1c Fix T99179: holdout does not affect transparency without transparent background
This was by design, but maybe not so useful in practice. It's always possible to
set alpha to 1 in compositing if needed.
2022-08-05 16:32:13 +02:00
fa514564b0 Fix T99201: Cycles render difference with 3D hair curves between OptiX and Emrbee
It should consistently use the Cycles pirmitive ID for self intersection detection,
not the one from the OptiX or Embree acceleration structure.

Differential Revision: https://developer.blender.org/D15632
2022-08-05 15:03:47 +02:00
91250022d0 EEVEE-Next: Depth Of Field: Avoid Framebuffer setup cost for each redraw
Using 2 framebuffer, if the temp textures are the same across redraws,
we can avoid the setup cost.
2022-08-05 14:45:49 +02:00
f6ce2c1f78 EEVEE-Next: Depth Of Field: Add comment about failed optimization attempt 2022-08-05 14:45:39 +02:00
c944dca127 EEVEE-Next: Depth Of Field: Fix black tiles when max blur radius is low
There was a missing clamp in `dof_slight_focus_coc_tile_get()`
and a couple of wrongly handled corner cases.
2022-08-05 14:45:39 +02:00
2a4cc0c81c EEVEE-Next: Depth Of Field: Use random sampling in slight focus gather
This replace the previous square rings approach by sampling a disk the
footprint of the search area. This avoids sampling in areas in corners
where there isn't any weight.

This results in much less samples needed to acheive a good enough result.
The max number of samples for an area of 11x11 px is hard coded to 16 and
still gives good results with the final clamp.

The number of samples is adaptative and is scaled by the search area (max
CoC).

The High Quality Slight Defocus is not required anymore. If there is a
quality parameter to add, it would be sample count option. But I consider
the temporal stability enough for viewport work and render can still
render many full scene samples. So I don't see a need for that yet.
2022-08-05 14:45:39 +02:00
3690dad40a EEVEE-Next: Depth Of Field: Fix reduce pass
The indexing during mipmap downsampling was wrong, leading to incorrect
bilateral downsampling.
2022-08-05 14:45:39 +02:00
72cdb0ed2d EEVEE-Next: Depth Of Field: Improve image stability
This adds anti-flicker pass to the slight focus region by using the
temporaly stable output from stabilize pass.

This also fixes the bilateral weight factor which was reversed.
2022-08-05 14:45:09 +02:00
897aa777c5 EEVEE-Next: Depth Of Field: Fix glitch on foreground scattered bokeh
This was caused by a missing synchronization.
The background gather pass was writting to the same occlusion texture
before the end of the scatter draw.
2022-08-05 14:45:09 +02:00
49d85dc8b5 EEVEE-Next: Depth Of Field: Improve Temporal stability
This implement a full TAA pass on the depth of field input.
An history buffer is kept for each view needing Depth of field.
This uses a swap with a `TextureFromPool` in order to not always 2
textures allocated.

Since this uses luma weighting without any input, the firefly parameter is
now obsolete and has been removed.

There is some tiny difference with the Film TAA so the implementation is
mostly copy pasted.

Also this implementation uses a LDS cache to speedup the TAA computations.
2022-08-05 14:45:09 +02:00
8659e62d1e EEVEE-Next: Depth Of Field: Make slight focus max coc more accurate
This moves the slight focus max in tile from the setup pass to the
resolve pass. This reduces complexity as there is no need for an extra
component in the tile textures.

This also avoids skipping any pixels and makes sure the local max matches
the dispatched local group size. This should make the resolve pass a little
bit faster.
2022-08-05 14:45:09 +02:00
c5526dc6f4 DRW: GPU Wrapper: add possibility to swap Texture and TextureFromPool
Ownership is transfered from the pool to the `Texture` and vice versa.
This allows to have history buffers with only 1 persistent texture.
2022-08-05 14:45:09 +02:00
1ae767be9f Cleanup: DRW: Remove void function argument 2022-08-05 14:45:09 +02:00
65561a0573 Merge remote-tracking branch 'origin/blender-v3.3-release' 2022-08-05 12:09:24 +02:00
45f483681f Fix T100093: Channel selection and grouping issues
Channel selection in graph editor was broken by rB3c5620aabd33 because
the selection took into account grease pencil channels. Such channels
are now removed from selection in containers that does not use them (NLA
and Graph Editor).

Grouping was broken from a similar issue. The grouping operation now
completely filters out grease pencil channels since the operator is only
defined for f-curve channels.

Reviewed By: sybren

Maniphest Tasks: T100093

Differential Revision: https://developer.blender.org/D15601
2022-08-05 12:06:03 +02:00
8362c57b21 Merge branch 'blender-v3.3-release' 2022-08-05 11:04:43 +02:00
f8d13a1b58 Cleanup: Use c++ casting in liboverride BKE code.
No functional change expected here!
2022-08-05 11:03:57 +02:00
4c340f9bd4 Cleanup: Remove outdated comment 2022-08-04 23:41:57 -05:00
fd0c27944f Cleanup: Reduce indentation 2022-08-04 23:35:37 -05:00
359aca8d4c Cleanup: Spelling, remove double negative 2022-08-04 23:02:02 -05:00
53c0c3cbd7 Cleanup: spelling, unused arg warning 2022-08-05 13:34:26 +10:00
16ede6584e Cleanup: format 2022-08-05 13:34:10 +10:00
0d476bcacd Merge remote-tracking branch 'origin/blender-v3.3-release' 2022-08-04 19:46:51 -07:00
bd467100dd Fix T100142: Compare correct render_slot variable during clear operation
In {rB0ef8a6179d2a773b2570352bd0cb7eb18b666da2} the parameter name was
changed to match the header declaration (slot) but it missed updating
the variable name inside the function correctly in one instance.

This prevents slot 0 from being cleared if the last slot to be rendered
was not also 0.

Differential Revision: https://developer.blender.org/D15620
2022-08-04 19:41:03 -07:00
9da0cfb86e Python: Add more useful information when attempting to pass incorrect attributes to GPUVertBuf.attr_fill
This simply adds the name of the incorrect parameter to the error message.

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

Reviewed by Jeroen Bakker
2022-08-04 15:54:00 -07:00
5b8143287b Fix: Build error after recent commit
A second try after 8b46731396.
2022-08-04 17:20:10 -05:00
5b8c07dc50 Cleanup: Remove outdated code for mesh normals
After recent refactors to mesh normals (cfa53e0fbe), they are no
longer stored in CustomData. A mechanism to compute them eagerly
should be implemented another way.
2022-08-04 17:05:46 -05:00
8b46731396 Fix Build Warnings in blf_font.c
Function made static, unused argument, type conversion

Introduced in 9d77b5a0ed

Own Code.
2022-08-04 14:40:11 -07:00
9d77b5a0ed BLF: Implement FreeType Caching
Implementation of the FreeType 2 cache subsystem, which limits the
number of concurrently-opened FT_Face and FT_Size objects, as well as
caching information like character maps to speed up glyph id lookups.

See D13137 for much more detail.

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

Reviewed by Brecht Van Lommel
2022-08-04 13:05:19 -07:00
fca7cb0101 Cleanup: Remove incorrect comment 2022-08-04 13:49:07 -05:00
77047d2088 Merge branch 'blender-v3.3-release' 2022-08-04 13:48:41 -05:00
bae2ce0695 Nodes: Disable link drag search for deprecated nodes 2022-08-04 13:43:26 -05:00
9ea9fc1f34 Fix T100099: Cycles crash baking vertex colors in edit mode
This was not supported, added now.
2022-08-04 20:14:50 +02:00
b29d6de77a Fix T99055: Cycles vertex color bake + denoising gives bad result
No denoising is supported in this case, it only works on images.
2022-08-04 19:28:09 +02:00
1c2c468abc Fix T100134: Cycles faceted triangle normals with motion blur
After recent changes to change barycentric coordinate convention.
2022-08-04 19:08:45 +02:00
91d365f6df Fix T100205: Cycles wrong volume shading with two materials in object
Assume that all faces using the smae material form a closed mesh, so that
joining meshes gives the same result as separate meshes.

It does mean that using different materials on different sides of one
closed mesh do not work, but the meaning of that is poorly defined anyway
if there is a volume interior.
2022-08-04 19:02:25 +02:00
dd4c47314e Merge branch 'blender-v3.3-release' 2022-08-04 18:56:16 +02:00
11b4d0a3c3 Attempt to fix build errors on MSVC
Same as 03cd794119, but using a different cast (see 9b9417b661).
2022-08-04 18:54:32 +02:00
56848fe967 Merge branch 'blender-v3.3-release' 2022-08-04 10:47:54 -05:00
d730940fdb Fix: Store named attribute node incorrect link drag search 2022-08-04 10:47:31 -05:00
4655ddf3a2 T90535: import UDIM textures from USD
Added logic to the USD Preview Surface importer to
convert UDIM textures.

Reviewed by: Sybren and Jesse

Differential Revision: https://developer.blender.org/D15379
2022-08-04 11:30:48 -04:00
3faf5d3252 Merge branch 'blender-v3.3-release' 2022-08-04 17:06:05 +02:00
Damien Picard
aa53eca6b5 I18n: make several parts of the UI translatable
- batch rename
- keyframe settings
- tool name in Tool properties header
- tool name in Tool properties Drag (fake) enum

- new file templates
- new preset
- new text datablock
- new collection datablock
- new geometry nodes (modifier and node group)
- new grease pencil data (layers and materials)

Ref. T43295

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15533
2022-08-04 17:05:34 +02:00
34912b0586 Merge branch 'blender-v3.3-release' 2022-08-04 09:34:52 -05:00
0844781961 Fix: Crash on instance on points node with empty mesh 2022-08-04 09:15:26 -05:00
50513e6964 Cleanup: Better const correctness and inlined key construction in depsgraph 2022-08-04 16:14:31 +02:00
d2a30abff0 Outliner: Use UI names and grouping for library overrides properties
NOTE: This is committed to the 3.3 branch as decided by Bastien, Dalai
and me. That is because these are important usability fixes/improvements
to have for the LTS release.

Part of T95802.

Showing properties with an RNA path in the UI isn't very user friendly.
Instead, represent the RNA path as a tree, merging together parts of the
RNA path that are shared by multiple properties. Properties and "groups"
(RNA structs/pointers) are now shown with their UI name and an icon if
any. The actually overridden properties still show the Library Overrides
icon. See the patch for screenshots.

Also: When a RNA collection item, like a modifier or constraint was
added via a library override, indicate that item and show all collection
items in the list, since the complete list of items and their orders may
be important context.

Differential Revision: https://developer.blender.org/D15606
2022-08-04 16:14:01 +02:00
585dd63c6e Cleanup: Move RNA path functions into own C++ file
NOTE: This is committed to the 3.3 branch as part of D15606, which we
decided should go to this release still (by Bastien, Dalai and me). That
is because these are important usability fixes/improvements to have for
the LTS release.

Adds `rna_path.cc` and `RNA_path.h`.

`rna_access.c` is a quite big file, which makes it rather hard and
inconvenient to navigate. RNA path functions form a nicely coherent unit
that can stand well on it's own, so it makes sense to split them off to
mitigate the problem. Moreover, I was looking into refactoring the quite
convoluted/overloaded `rna_path_parse()`, and found that some C++
features may help greatly with that. So having that code compile in C++
would be helpful to attempt that.

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

Reviewed by: Brecht Van Lommel, Campbell Barton, Bastien Montagne
2022-08-04 16:13:00 +02:00
27d31c15e8 UI: Pass modifier & constraint icon to the corresponding RNA base type
NOTE: This is committed to the 3.3 branch as part of D15606, which we
decided should go to this release still (by Bastien, Dalai and me). That
is because these are important usability fixes/improvements to have for
the LTS release.

This basically lets the UI use the constraint or modifier icon, whenever
refering to constraints/modifiers via RNA pointers. Used by D15606, so
that the "Modifiers" tree element to group the individual modifiers
together gets the right icon without hardcoded handling.
2022-08-04 16:11:14 +02:00
839422cf1c Cleanup: Remove unused ID from depsgraph time source 2022-08-04 16:09:47 +02:00
bd909ff990 Outliner: Add generic label element type
No user visible changes expected.

NOTE: This is committed to the 3.3 branch as part of D15606, which we
decided should go to this release still (by Bastien, Dalai and me). That
is because these are important usability fixes/improvements to have for
the LTS release.

We have a bunch of "base" element types, just to show a label element
for grouping together other elements. There is no reason to have these
tied to a case, just have a generic label type for this. It requires a
string to display, and can display an icon too. The new element type
isn't used yet, but will be in one of the following commits. Would be
nice if the existing base elements can be replaced by this.

Part of D15606.
2022-08-04 16:09:02 +02:00
665d3db3a4 Fix T99460: Allow creation new datablocks from evaluated
This changes makes it possible to copy evaluated result and put it
to the original bmain.

Prior to this change from the API point of view there was false
perception that it is possible, while in practice it was very fragile:
it only worked if the ID did not reference any evaluated IDs.

This change makes it so `id.copy()` Python API call will make it so
the copied ID only references original data-blocks. This sounds a bit
implicit, so here is motivational aspect why it is considered better
approach to all other:

- There needs to be a way to support the described scenario, in the
  lest fragile way. Requiring to always use an explicit function call
  or an argument is too verbose and is easy to be missed.

- The `id.copy()` is already doing implicit thing: it always adds the
  result to the bmain. So it might as well ensure the copied result
  does not reference evaluated data-blocks.

- Added clarity in the documentation should address possible confusion.

The limitation of this change is that the copy() of evaluated geometry
will clear its reference to the shape key. This is because the key is
only referenced for validness of RNA paths for drivers and the key
itself might not match topology of evaluated geometry due to modifiers.

Differential Revision: https://developer.blender.org/D15611
2022-08-04 16:02:44 +02:00
39a68b27b9 Depsgraph: More clear function name for transform dependnecy
The name was confusing to a level that it sounded like the relation
goes the opposite direction than it is intended.
2022-08-04 16:02:44 +02:00
0828361889 Cleanup: Redundant check in depsgraph builder
The build_object_data_geometry() is never called on armatures.
2022-08-04 16:02:44 +02:00
67b92418ee Outliner: Use UI names and grouping for library overrides properties
Part of T95802.

Showing properties with an RNA path in the UI isn't very user friendly.
Instead, represent the RNA path as a tree, merging together parts of the
RNA path that are shared by multiple properties. Properties and "groups"
(RNA structs/pointers) are now shown with their UI name and an icon if
any. The actually overridden properties still show the Library Overrides
icon. See the patch for screenshots.

Also: When a RNA collection item, like a modifier or constraint was
added via a library override, indicate that item and show all collection
items in the list, since the complete list of items and their orders may
be important context.

Differential Revision: https://developer.blender.org/D15606
2022-08-04 15:57:08 +02:00
79955e5f85 Docs: Note storage behavior of override operations in comment
It's not obvious that override property operations are recreated on undo
pushes, which caused me some confusion. Comment on this, so it's clear
that pointers to the operations shouldn't be stored.
2022-08-04 15:57:08 +02:00
8e3eea372d UI: Pass modifier & constraint icon to the corresponding RNA base type
This basically lets the UI use the constraint or modifier icon, whenever
refering to constraints/modifiers via RNA pointers. Used by D15606, so
that the "Modifiers" tree element to group the individual modifiers
together gets the right icon without hardcoded handling.
2022-08-04 15:57:08 +02:00
735b26053e Outliner: Add debugging utility to print an elements path
No user visible changes expected.

Adds a function that prints the "path" of an element, that is, the
ancestor elements starting from the root, separated by slashes. This can
be useful for debugging. The function isn't used.
2022-08-04 15:57:08 +02:00
2a3e4d8bcd Outliner: Add generic label element type
No user visible changes expected.

We have a bunch of "base" element types, just to show a label element
for grouping together other elements. There is no reason to have these
tied to a case, just have a generic label type for this. It requires a
string to display, and can display an icon too. The new element type
isn't used yet, but will be in one of the following commits. Would be
nice if the existing base elements can be replaced by this.

Part of D15606.
2022-08-04 15:57:08 +02:00
Germano Cavalcante
f8b5706a1f Fix T100129: Status bar incorrectly shows "[G] Move" after pressing G once in Edit Mode
Add specific modal keyitem for Vert/Edge Slide or TrackBall.

Note that there is a workround to avoid repeated keys in the status bar.

Reviewed By: campbellbarton

Maniphest Tasks: T100129

Differential Revision: https://developer.blender.org/D15597
2022-08-04 10:56:47 -03:00
Germano Cavalcante
791bfae1d6 Fix T100129: Status bar incorrectly shows "[G] Move" after pressing G once in Edit Mode
Add specific modal keyitem for Vert/Edge Slide or TrackBall.

Note that there is a workround to avoid repeated keys in the status bar.

Reviewed By: campbellbarton

Maniphest Tasks: T100129

Differential Revision: https://developer.blender.org/D15597
2022-08-04 10:54:29 -03:00
1ffb011d67 Fix T100171: GPencil toggle caps operator does not support multiframe
This was a missing feature.
2022-08-04 15:03:10 +02:00
c67d4117d4 Fix broken build due to missing include.
Caused by rBa95103f6f4abda2b. Please build blender before committing!
2022-08-04 14:52:51 +02:00
6af963ca81 Fix leak when the cursor leaves the window while dragging in Wayland 2022-08-04 22:33:28 +10:00
a10cac413e Fix the menu popup location when dropping blend files under Wayland
Even though the event's location matched the drop event,
the `wmWindow.eventstate` was not updated which was used for the
pop-up menu location.
2022-08-04 22:33:26 +10:00
ff286a9fcf Fix double-free after drag & drop with GHOST/Wayland
Resolve crash on exit after drag & drop in Wayland.
2022-08-04 22:33:25 +10:00
a95103f6f4 GHOST/Wayland: support URL decoding for file drag & drop
Paths that contained characters that needed escaping as URL's failed
to import.

Move URL decoding to a new file (GHOST_PathUtils), shared with X11 but
maybe be useful for other platforms too.
2022-08-04 22:33:23 +10:00
727cc426bc Fix drag & drop in Wayland with some applications
Drag & drop worked with GTK3 apps but not QT5 (pcmanfm-qt for eg)
as files are separated by '\n' instead of '\r\n'.

Resolve by supporting both (follow up to T99737).
2022-08-04 22:33:22 +10:00
cdd718dbb2 GHOST/Wayland: improve logging for drag & drop
Log the response for dropping events to simplify troubleshooting
drag & drop failure.
2022-08-04 22:33:20 +10:00
28e0cc424d Guarded allocator: Function to rename block for debugging
We have plenty of sorta generic functions, that allocate memory with
some generic name for debugging. When such a function is called and the
memory leaks, it may be unclear which call to it allocated the unfreed
memory (and thus which execution path leads to the leak).

The added function is only available if `NDEBUG` is not defined.

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

Reviewed by: Sergey Sharybin, Bastien Montagne
2022-08-04 11:26:57 +02:00
fdd282021a Cleanup: Fix compile warnings 2022-08-04 00:45:25 -07:00
550ebc5c8f Cleanup: quiet unused warning 2022-08-04 17:00:19 +10:00
72ab6faf5d Fix T97251: Store generated type information for each UDIM tile
Various situations can lead to un-saved UDIM tiles potentially losing
their contents. The most notable situation is a save and re-load of a
.blend file that has "generated" UDIM tiles that haven't been written to
disk yet. Normal "generated" images are reconstructed on demand in these
circumstances but UDIM tiles do not retain the information required for
reconstruction and empty tiles are presented to the user.

This patch stores the generated type information for each tile to solve
this particular issue. It also shifts the Image generation info into the
1st tile. The existing DNA fields are deprecated but RNA was modified as
to not break API compat.

There's two broad changes here that merit special callout:
- How to distinguish between a tile that should be reconstructed vs.
a tile that should remain empty because loading failed for the UDIMs
- How to better handle Image Source changes

The first issue is addressed as follows:
- Each time a tile is filled with generated content we set a new
IMA_GEN_TILE flag
- Each time a tile is saved to disk we remove the IMA_GEN_TILE flag
- When requesting an ibuf: If the ibuf is null, we check to see if
IMA_GEN_TILE is set. If it is set, go ahead and re-create the tile.
Otherwise, do nothing.

The second set of changes have to do with ensuring that information is
carried along as far as possible when the, sometimes destructive, act of
changing an Image Source is performed. Behavior should be a bit more
natural and expected now; though users will rarely, or should rarely, be
modifying this property. The full table describing the behavior is in
the differential.

Differential Revision: https://developer.blender.org/D14885
2022-08-03 22:00:52 -07:00
646207c9af Cleanup: Remove unused function 2022-08-03 22:06:07 -05:00
2083b9ae54 Cleanup: simplify uv parametrizer in preparation for C++
No functional changes.

Add casts required by C++. Simplify types.
2022-08-04 11:20:39 +12:00
dcf50cf046 Fix T100132: Disable winding when calculating islands for uv sculpt tools
Winding was originally added to island detection in 5197aa04c6.
However the sculpt tools can flip faces, potentially creating orphaned
islands if winding is enabled.

Differential Revision: https://developer.blender.org/D15600
2022-08-04 11:11:41 +12:00
8288017635 Merge branch 'blender-v3.3-release' 2022-08-03 15:18:25 -07:00
Ethan-Hall
177bc80748 Fix: add attribute with empty string name crash
Due to a recent change, empty strings are unhandled. This results
in Blender crashing.

This patch fixes the crash but a discrepancy still exists...
Prior to the regression, the empty string would be replaced by the
name of the data type. This patch uses "Attribute" for the default
name regardless of type. Restoring the previous behavior would
require making and/or modifying API methods.

Regression introduced in: rBeae36be372a6

Reviewed By: Joseph Eagar & Campbell Barton
Differential Revision: https://developer.blender.org/D14734
Ref D14734
2022-08-03 15:16:46 -07:00
f7e5a3b816 Merge branch 'blender-v3.3-release' 2022-08-03 15:06:15 -07:00
b65ab29310 Sculpt: Fix T99294: Voxel Remesher text is resized based on object scale 2022-08-03 15:05:56 -07:00
bc15812e0d Merge branch 'blender-v3.3-release' 2022-08-03 17:03:16 -05:00
1cc11e32e4 Fix: Avoid OBJ importer assert seting normals on mesh with no faces 2022-08-03 16:59:03 -05:00
6089a96be2 Cleanup: spelling, code-blocks 2022-08-04 07:54:29 +10:00
1ec7f75b2a Cleanup: format 2022-08-04 07:41:03 +10:00
cc1daa9b76 Cleanup: quiet nonnull-compare warning for GCC
All callers ensure this is not NULL.
2022-08-04 07:31:42 +10:00
Ramil Roosileht
a217e56575 Sculpt: Support gradient color mode in sculpt paint brush
T99614

Support for gradient mode in sculpt paint brush

{F13316165}

Reviewed By: Joseph Eagar & Julian Kaspar
Differential Revision: https://developer.blender.org/D15502
Ref D15502
2022-08-03 14:09:37 -07:00
Ramil Roosileht
6f62a388df Sculpt: Support gradient color mode in sculpt paint brush
T99614

Support for gradient mode in sculpt paint brush

{F13316165}

Reviewed By: Joseph Eagar & Julian Kaspar
Differential Revision: https://developer.blender.org/D15502
Ref D15502
2022-08-03 14:08:23 -07:00
9d7aac6d66 Cleanup: Use generic utility to retrieve attributes to transfer 2022-08-03 15:37:57 -05:00
a5a60d0f4f Cleanup: Fix doxygen section for custom data type 2022-08-03 13:20:01 -05:00
09df97e897 Merge branch 'blender-v3.3-release' 2022-08-03 19:55:12 +02:00
cc12f3e0ba Cleanup: fix various typos
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D15588
2022-08-03 19:28:05 +02:00
Liu Deyuan
411b4ed6ed Fix T96247: Principled BSDF roughness different in startup blend and new node
Change startup roughness to 0.5.

Differential Revision: https://developer.blender.org/D15586
2022-08-03 19:24:25 +02:00
f6ca44efd6 Fix T100106: image movie/sequence auto refresh affects still image performance 2022-08-03 19:24:09 +02:00
81d75affb1 Cleanup: Use const arguments in definition, add helper variable 2022-08-03 11:59:16 -05:00
ac32f5ac4f Merge branch 'blender-v3.3-release' 2022-08-03 19:09:57 +03:00
10c4734978 Fix T100173: fix missing removal of old name in BLO_update_defaults_startup_blend
If a screen had to be renamed, the old name was not removed from
the name map. Fixes T100173.
2022-08-03 19:09:21 +03:00
Iliay Katueshenock
55a332da64 Attribute Math: Improve performance of mixer in some cases
The `DefaultMixer` for mixing generic data types has some issues:
1. The full buffer is always zeroed, even if only some is used.
2. Finalizing also works on all values, even if only some are used.
3. "mixing" doesn't allow setting the first value, requiring that
everything is cleared beforehand.

This commit adds the following functionality:
1. Constructor with the specified `IndexMask` for preliminary zeroing.
2. `set` method to overwrite the value.
3. `finalize` with the specified mask to process a subset of values.

This is useful in situations where you want to use the
DefaultMixer without having to overwrite all the values many times.

A performance improvement was observed for NURBS curve evaluation and
attribute interpolation from the point to curve domain of about 15% and
35% respectively (100,000 curves).

Differential Revision: https://developer.blender.org/D15434
2022-08-03 10:18:02 -05:00
144027d70f Fix sequencer viewport render not respecting the "use_stamp" option
The sequencer OpenGL viewport renders would not render the metadata into
the image even if the option was on.

Did minor cleanups in the render function as well.
2022-08-03 17:15:19 +02:00
42f9430a3a Fix: Warning from incorrect use of macro
From d52551401e, exposed by recent C++ conversion.
2022-08-03 09:41:01 -05:00
9c8998ed11 Merge branch 'blender-v3.3-release' 2022-08-03 09:25:28 -05:00
06b6c004f5 Fix T100168: Sculpt positions undo not working after recent commit
efe0e2b183 used the "normals_update" for applying positions from
an undo step, which doesn't set the necessary flags for a redraw.
2022-08-03 09:18:13 -05:00
bdc30bd0fb Fix T100171: GPencil toggle caps operator does not support multiframe
This was a missing feature.
2022-08-03 15:45:08 +02:00
9896dd4d16 Merge branch 'blender-v3.3-release' 2022-08-03 10:49:45 +02:00
25517f36bc Cleanup: Improve doc of the BKE_id_copy functions. 2022-08-03 10:49:20 +02:00
d269fb1d72 Fix assert failures in the dependency graph
Happens after recent changes in the area.

The asserts were a bit too strict and were against the way how the
ID_RECALC_ALL is handled. So remove them with explanation why things
needs to be silent.
2022-08-03 09:31:05 +02:00
e3913ec6c1 Merge branch 'blender-v3.3-release' 2022-08-03 09:51:34 +03:00
89f0fedb5c Fix T97769: new OBJ exporter does not replace spaces in object names
The Python based exporter was replacing spaces with underscores
in object/group names, mostly to handle cases where names could begin
or end with spaces. The new exporter was not doing that. Note: spaces
in material names were already handled by the new exporter.

Fixes T97769. Updated test coverage expectations; one of the test
files has an object with a space in the name.
2022-08-03 09:49:56 +03:00
c9821b6c01 Fix compile issue in recent commit.
fallthrough in case statement.
2022-08-03 08:25:41 +02:00
Angus Stanton
ea70687dd5 Image: Display GPU layout in uiTemplateImageInfo
Add IMB_gpu_get_texture_format and GPU_texture_format_description to
retrieve and 'stringify' an eGPUTextureFormat. These are then used in the
image info panel used in several areas across blender.

New Information:
{F13330937}

Reviewed By: jbakker

Maniphest Tasks: T99998

Differential Revision: https://developer.blender.org/D15575
2022-08-03 08:15:12 +02:00
abc46d5aeb Fix: Timeline marker names are not correctly clipped in some cases
Timeline marker names are now correctly clipped instead of messily
overlapping each other and being unreadable. This change affects all
the animation editors (graph editor, NLA, action editor etc.) as well
as the VSE.

This also makes a change to when text is elevated. In the previous
behavior, a marker's text would be elevated if it was selected or if
the current frame was <= 4 frames away from the marker. This seems
like a completely arbitrary thing (probably added in to alleviate text
overlapping for markers that the user would be interested in). This
patch changes the behavior such that the marker's text will be elevated
if it is either selected or it is the last marker encountered relative
to the current frame.
2022-08-02 20:59:44 -07:00
84b1607196 Cleanup: make format 2022-08-03 13:27:13 +12:00
68c1eb86a6 Fix unreported: Add tie-break conditions for udim search with integers
When searching for closest UDIM with integer co-ordinates, several UDIMs
can be equidistant. Previously, of all closest UDIMs, the one which was
earliest in the list would be used. Now, "half-open interval" rules are
used to break the tie.

Motivated by 0fcc04e7bf

Differential Revision: https://developer.blender.org/D15590
2022-08-03 13:20:54 +12:00
43918ec28d Geometry Nodes: Speed up reading attribute with different type
The virtual array created by the implicit conversions had a lot of
overhead when converting many values. Implement "materialize"
functions to avoid a virtual function call for every element.
This gave me a 20x improvement when copying the values
from a float attribute as a boolean, though I doubt there are
any real world situations where it's that noticible.
2022-08-02 19:23:13 -05:00
fc1a53eb7b Cleanup: Remove unused function uv_poly_copy_aspect 2022-08-03 09:51:55 +12:00
18377c4f5e UI: Improve circle drawing of cursor for uv sculpting
Calculate segments based on radius.

Differential Revision: https://developer.blender.org/D15591
2022-08-03 09:44:06 +12:00
8081a05015 Tests: Remove deprecated/removed operators from tests
44aa9e40ff
2022-08-02 16:26:38 -05:00
f4fe3fb09b EEVEE-Next: Depth Of Field: Port implementation to compute shader
This is a port of the previous implementation but using compute
shaders instead of using the raster pipeline for every steps.

Only the scatter passes is kept as a raster pass for obvious performance
reasons.

Many steps have been rewritten to take advantage of LDS which allows faster
and simpler downsampling and filtering for some passes.

A new stabilize phase has been separated from another setup pass in order
to improve it in the future with better stabilization.

The scatter pass shaders and pipeline also changed. We now use indirect
drawcall to draw quads using triangle strips primitives. This reduces
fragment shader invocation count & overdraw compared to a bounding
triangle. This also reduces the amount of vertex shader invocation
drastically to the bare minimum instead of having always 3 verts per
4 pixels (for each ground).
2022-08-02 21:53:17 +02:00
2ea4754109 EEVEE-Next: Cleanup: Remove static references for swapchains
Those are no longer necessary.
2022-08-02 21:53:17 +02:00
335dbccc33 EEVEE-Next: Fix GL errors when rendering with transparent materials
For now, we need to always bind the render pass images even if not used.
2022-08-02 21:53:17 +02:00
75dda90030 EEVEE: Depth of field: Fix incorrect variance occlusion
The change is likely not noticeable.
2022-08-02 21:53:17 +02:00
04d43e8dbb GL: Remove lingering image binds
This updates image bind tracking to be the same as texture binds.
Adding a new bind flag to avoid conflict when the texture is used in
both slots.
Fixes a gl error in glBindImageTextures about invalid image binds.
2022-08-02 21:53:17 +02:00
d629402054 GL: Compute: Fix indirect compute barrier and unbind
This path is not used by any existing code so it isn't necessary to
backport.
2022-08-02 21:53:17 +02:00
35762cea91 DRW: common_math_lib.glsl: Fix weighted_sum macro
This avoids issue when the macro is followed by another operator.
Example:
`float result = weighted_sum(a,b,c,d,w) * 5.0;`
2022-08-02 21:53:17 +02:00
8a0f804e2b DRW: Add image unbind in debug mode
This allows finding missing binds more easily as the missing binds slots
won't be populated with previous texture binds.
2022-08-02 21:53:17 +02:00
24a0015dbd DRW: Add DRW_shgroup_call_procedural_indirect()
Replaces `DRW_shgroup_call_procedural_triangles_indirect`.
This makes the indirect drawing more flexible.
Not all primitive types are supported but it is just a matter of adding
them.
2022-08-02 21:53:17 +02:00
9a52f1f720 DRW: Add DRW_shgroup_call_procedural_triangles_indirect
Just like the name suggest, this adds a way to draw a series of proceduraly
positioned triangles using and indirect buffer.
2022-08-02 21:53:17 +02:00
710609a2e0 DRW: GPU Wrapper: Fix invalid cached texture view when ensure() reallocs 2022-08-02 21:53:17 +02:00
22143b351f DRW: GPU wrapper: Make SwapChain renference work
This make using texture reference easier. But now, it makes it mandatory
for the wrapped type to implement the `swap()` static method.
2022-08-02 21:53:17 +02:00
04160ffd12 DRW: GPU wrappers: Expose more ease of use functions and cleanup style 2022-08-02 21:53:17 +02:00
1e5ab041d7 GPUBatch: Add GPU_batch_draw_indirect
This allows rendering a batch with parameters computed by the GPU.

Contains GL backend implementation.
2022-08-02 21:53:17 +02:00
7220619554 EEVEE-Next: Expose Motion blur shutter curve in render panel
It is now fully supported.
Also reorder panels to keep EEVEE-Next panels in the same ordered as
EEVEE's ones.
2022-08-02 21:53:17 +02:00
c5b361335a Cleanup: Simplify functions for adding and removing color attributes
The specific functions for vertex colors and and sculpt vertex colors
can be replaced by more generic attribute functions internally.
Also remove a paramter from one function.
2022-08-02 14:43:36 -05:00
44aa9e40ff Cleanup: Remove unused sculpt and vertex color operators
The "Color Attributes" system from f7bbc7cdbb has replaced
both "Sculpt Vertex Colors" and "Vertex Colors" in the UI. The Operators
for adding and removing them are unused now.

This commit does not break backwards compatibility with the Python
API, it only removes the operators, which generally aren't used by
addons anyway. The mesh RNA properties will be removed in 4.0 (T100153).

Differential Revision: https://developer.blender.org/D15077
2022-08-02 14:17:20 -05:00
a48e5c53a5 Cleanup: Simplify const cast in virtual array construction 2022-08-02 13:44:07 -05:00
2ba2efc296 Cleanup: Simplify arguments to sculpt draw functions
Instead of passing pointers to specific mesh data, rely on
retrieving that data from the mesh internally. This makes
it easier to support retrieving additional data from Mesh
(like active attribute names in D15101 or D15169). It also makes
the functions simpler conceptually, because they're drawing
a mesh with an acceleration strcture on top.

The BKE_id_attribute_copy_domains_temp call was unnecessary
because the GPU_pbvh_mesh_buffers_update function was only
called when Mesh/PBVH_FACES is used in the first place.

Differential Revision: https://developer.blender.org/D15197
2022-08-02 13:32:45 -05:00
e4fd2d5754 Fix T99812: Audio scrubbing freezes Blender 3.2.1
Bug was caused by a change in ffmpeg's API.
2022-08-02 20:17:46 +02:00
5ddaf2fa7b Merge branch 'blender-v3.3-release' 2022-08-02 21:01:54 +03:00
ead8260a49 Object: move collection resync after empty duplicate early-out
As pointed out in rB02b1a209be88 comment, the BKE_main_collection_sync
should be after "nothing to duplicate" early-out.
2022-08-02 21:01:25 +03:00
b010985e4a Fix T99255: Strips inserting incorrectly
When dropping file to sequencer timeline, coordinates for strip position
and overlap handling are used even if not set.

Reset internal state in on_drag_start callback and set is_modal
variable only if coordinates are updated. This way when dragging file
from external file browser, strip is added at current frame as before
modal operator was implemented.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D15333
2022-08-02 19:36:42 +02:00
2d4498e457 Merge branch 'blender-v3.3-release' 2022-08-02 11:11:20 -05:00
efe0e2b183 Fix T96810: Invalid sculpt normals after some operations
Mask and color brushes were using the existing PBVH vertex "update tag"
to mark their modifications. This was mostly unnecessary, and causes
unnecessary calculation of normals. It also caused errors though,
because they didn't tag the corresponding PBVH node for normal
recalculation, causing problems on the borders of nodes, since one
node might accumulate into another's vertex normals, but the other
node wouldn't also accumulate and normalize the normals.

The solution is to only use the update tag for tagging deformed
vertices that need recalculated normals. Everything else is handled at
the PBVH node level (which was already the case, but it wasn't clear).

The update tag was also used for undo to tag the nodes corresponding to
changed vertices. This was wrong though, because normals and visibility
would also be recalculated for just color or mask undo steps. Instead,
just use local arrays to map from vertices to nodes.

Differential Revision: https://developer.blender.org/D15581
2022-08-02 11:00:57 -05:00
ac9d9c993a Merge branch 'blender-v3.3-release' 2022-08-02 17:57:12 +02:00
97b226ac51 Fix T100049: Crash when render finishes
Caused by NULL dereference of `Editing` before NULL check was done.
2022-08-02 17:52:40 +02:00
09ac5f97a7 GPencil: Fix compiler warning
The variable can never be NULL and the comparison was wrong.
2022-08-02 17:03:33 +02:00
dadfdc8226 Merge branch 'blender-v3.3-release' 2022-08-02 09:51:08 -05:00
d3eef4d22a Fix: Use evaluated materials in OBJ exporter
Since 1a81d268a1, materials on object data can change during
evaluation. But a different function is necessary to retrieve materials
taking that into account.

Solves part of T96721.

Differential Revision: https://developer.blender.org/D15595
2022-08-02 09:49:51 -05:00
Pratik Borhade
074ce49de0 Automated testing: Add operators tests
Part of {T84999}
This patch adds test for
- `dissolve_limited`
- `dissolve_mode`
- `merge_normals`

Updated blend file:
{F13162744}

Reviewed By: zazizizou, mont29

Differential Revision: https://developer.blender.org/D15187
2022-08-02 16:43:42 +02:00
84aa8b85a2 Merge branch 'blender-v3.3-release' 2022-08-02 15:07:54 +02:00
e4dd644d6b LibOverride: Add 'editable/clear' toggle to ID template.
Now when an ID template is set to an override ID, `Shift-Click` on the
right button toggles between making it user-editable (if it's a system
override), or clearing any user edit and setting it back to system override.
2022-08-02 15:07:33 +02:00
2a7e83ce18 LibOverride: Expose in public API the utils to get actual override data.
This is useful when input ID is a 'non-override' one (like embedded IDs
or shapekeys), to get override data and 'owner' ID pointer.
2022-08-02 15:07:33 +02:00
0830320a7c CMake: Check if freetype is compiled with brotli support
Because of the recent changes to our core fonts,
Freetype has to support Woff2 fonts or Blender will segfault on startup.

This adds an explicit check for this to inform people compiling Blender
about this requirement.
2022-08-02 14:50:38 +02:00
25a0124bc8 Fix T100119: Light object's parametric vector distorted in blender 3.4
Caused by 38af5b0501.

Adjust barycentric coordinates used for intersection result in the
ray-to-rectangle intersection check.

Differential Revision: https://developer.blender.org/D15592
2022-08-02 14:17:10 +02:00
588791df63 Fix compilation error after recent DNA changes
Apparently, Clang allows to specify underlying enum type in C
but onot GCC. The latter one is actually closer to the standard.
2022-08-02 14:15:53 +02:00
4e2af28bc7 Merge branch 'blender-v3.3-release' 2022-08-02 13:42:14 +02:00
78ad9ebed3 Fix T99715: Only force optimal display during on cage editing.
This loosens the current implementation a bit to only force optimal
display when editing on cage. It used to be any editing mode.

Brings GPU based subdivision closer to the CPU version.
2022-08-02 13:38:34 +02:00
33e4ecc750 Merge branch 'blender-v3.3-release' 2022-08-02 12:55:29 +02:00
33d0b7c5bd Fix T100133: Crash when linking an evaluated object to a collection.
Note that ideally, we should have a protection mechnism at global RNA
level, making e.g. any evaluated data read-only... But for now, give
better (and more consistent) protection for the collections' link/unlink
of children collections  and objects.
2022-08-02 12:54:08 +02:00
fdf34666f0 Fix Unreported : add F-curves only filter to functions only appliable to F-curves channels.
The filter was missing in some places that are using channel data as if it was f-curve channel.
There seems to be no related issue or bug, but still it would be best to have them there.

Reviewed By: sybren

Differential Revision: http://developer.blender.org/D15505
2022-08-02 12:27:53 +02:00
bb7747e7ca Fix undefined behavior in dependency graph tagging
The tagging code was iterating over bits set in the ID_RECALC_ALL and
was casting the flag to IDRecalcFlag. This was triggering an undefined
behavior warning in Clang since the bit might not have a corresponding
value in the enumerator.

The solution is to pre-define all reacalc flags for all bits. While
this seems a bit annoying this seems to be the least fragile solution
from all suggested ones.

Differential Revision: https://developer.blender.org/D15602
2022-08-02 11:50:54 +02:00
1c90ab7bf2 Depsgraph: Make naming and recalc flag sign consistent
Always use unsigned int for the recalc flags. This allows to use
all 32 bit of integer for the flags without worrying about the
sign. Use full notation of `unsigned int` instead of short `uint`
to avoid pulling more headers in.

Whenever depsgraph API allows passing combined recalc flags call
the variable `flags` and use `unsigned int` type for it. For a
single flag use `IDRecalcFlag` flag.

No functional changes expected.
2022-08-02 11:38:16 +02:00
670ced9758 GPencil: Allow import several SVG at time
For SVG is very convenient to be able to import several SVG in one operation. Each SVG is imported as a new Grease Pencil object.

Also, now the SVG file name is used as Object name.

Important: As all SVG imported are converted to Grease Pencil object in the same location of the 3D cursor, the SVG imported are not moved and the result may require a manual fix of location. The same is applied for depth order, the files are imported in alphabetic order according to the File list.

Reviewed By: mendio, pepeland

Differential Revision: https://developer.blender.org/D14865
2022-08-02 09:46:32 +02:00
f263334529 Merge branch 'blender-v3.3-release' 2022-08-02 09:28:38 +03:00
02b1a209be Fix T100118: Crash after Shift+D with nothing selected and then making new object
Regression from rB2d041fc46823, the "nothing to do, return" code path
was not re-enabling layer collection sync. Fixes T100118.
2022-08-02 09:28:17 +03:00
1ac956a9f9 Cleanup: simplify uv parametrizer in preparation for C++
No functional changes.

Add casts required by C++. Simplify destructors. Simplify types.
2022-08-02 10:53:16 +12:00
1dc503b33a Nodes: Remove node after link drag search cancel
Remove the node if the transform operation is cancelled rather than
confirmed. This is consistent with the regular search menu.
2022-08-01 17:03:21 -05:00
2c00889d3e Cleanup: simplify function for adding node to editor
Split it into two functions, one for static node types,
and another for ID names.
2022-08-01 16:32:43 -05:00
6b6d3b86d5 Merge branch 'blender-v3.3-release' 2022-08-01 21:19:27 +03:00
2542fda14d Fix T99502: OBJ/MTL import: behavior changed for missing texture files
Python based OBJ importer, as well as glTF2 importer, are creating
"placeholder" images for texture images that can't be found. These
are empty textures (displayed as magenta), but with their file paths
set so that File > External Data > Report Missing Files can report
them as missing.

Make the new C++ OBJ importer do the same as well. Fixes T99502.
2022-08-01 21:14:14 +03:00
0fade955dd USD import: Handle material purpose
This is a partial fix for T90535.

USD allows binding materials generically as well as for a
specific purpose. I.e., purpose may be generic (unspecified)
or one of

- Full: truest representation of the scene
- Preview: lightweight material for preview

Curently, only generically bound materials, with unspecified
purpose (allPurpose), are imported. This issue is preventing
preview materials from being imported in the Alab scene.

This patch adds logic to attempt to fall back on importing
preview or full materials, in that order, if there is no
generic material bound to the mesh.

Reviewed by: Sybren

Differential Revision: https://developer.blender.org/D15352
2022-08-01 12:14:05 -04:00
Pratik Borhade
3e8bd1f6e4 Fix T100040: Crash when transform applied on multi-user image
Affected by rB8621fdb10dc4
Crash if single-user data is created when we apply transform
on multi-user image data. Crash occurs because creation of new copy
was not handled in `single_obdata_users` for empty objects (image for example)

Reviewed By: dfelinto, mont29

Maniphest Tasks: T100040

Differential Revision: https://developer.blender.org/D15587
2022-08-01 17:16:30 +02:00
99f2b59fe6 Merge branch 'blender-v3.3-release' 2022-08-01 16:53:06 +02:00
4d8018948d Fix T99820: missing 'no more mising' tagging on reloaded libraries.
Can be also backported to 2.93LTS.
2022-08-01 16:52:45 +02:00
577a2a5dbe Merge branch 'blender-v3.3-release' 2022-08-01 15:24:48 +02:00
f08ea76db5 GPU: Fix failing compute tests.
Tests created GPUTextures with incorrect mipmaps.
2022-08-01 15:23:53 +02:00
e0603f77af Merge branch 'blender-v3.3-release' 2022-08-01 15:02:31 +02:00
e9586b14b7 Eevee: Add support of rendering curves with cryptomatte.
There were 2 errors.
1. hair code was used to draw curves
2. vertex shader wasn't aware of curves and failed to compile.
2022-08-01 15:00:47 +02:00
33e5a66f67 Merge branch 'blender-v3.3-release' 2022-08-01 14:48:44 +02:00
55c5eb3312 Eevee: Fix compilation error in eevee-next.
Although eevee-next is disabled in Blender 3.3 there is an error that is
visible when compiling shaders using the shader builder.

This is because of an error in a preprocessing directive (defined should
be define).
2022-08-01 14:47:18 +02:00
19a7a013ce Merge branch 'blender-v3.3-release' 2022-08-01 14:37:16 +02:00
afd1357aa8 tweaks & fixes to UI messages. 2022-08-01 14:36:06 +02:00
Damien Picard
3239cea726 I18n: make presets translatable
Presets are used all over the Blender UI, but were so far untranslatable.

This adds the translation code as well as a new `dump_preset_messages()` function in the message extraction. This goes over all bundled preset file names and extracts them.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15570
2022-08-01 14:09:41 +02:00
Damien Picard
543b47f162 I18n: make newly added constraints' names translatable.
This is the same principle as D15418 and D15532, but this time it's
only really needed for "IK".

Nevertheless it's probably good to add them anyway in case they get
renamed and don't share a translation with other messages somewhere
else in the code, for instance if it is decided that new constraint names
shouldn’t include spaces, like other data do.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15571
2022-08-01 14:08:53 +02:00
Damien Picard
1875c5d24c I18n: make Grease Pencil modifiers and shader FX translatable.
Pretty much like D15418: add `N_()` macro around names for
Grease Pencil modifiers and shader FX.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15532
2022-08-01 13:58:23 +02:00
76169472d3 Cycles: Resolve recent performance regression in oneAPI implementation for Intel® Arc™ GPUs
Recently, performance with oneAPI have regressed due some recent
changes in Blender itself. This commit's changes is resolving this
and also improve compilation time for oneAPI backend first
execution (or Blender compilation time in case of AoT).

Regression have appeared after 5152c7c152 and not related to the
changes itself, but increase of kernels complexity introduced with
it. Changes in this commit is marking some Blender functions as
noinlined for oneAPI backend, which helps GPU compiler to deal with
this complexity without any negative side-effects on performance.
2022-08-01 12:45:34 +02:00
0adedaa4cc Merge branch 'blender-v3.3-release' 2022-08-01 13:39:59 +03:00
e2be6bc03f Fix T100076: OBJ import: new importer doesn't use //relative/image/paths
The Python based importer had logic to immediately turn image paths
into relative-to-blender-file paths, if user preference for relative
paths is used (which is on by default). The new importer code did not
have that. Fixes T100076.
2022-08-01 13:39:08 +03:00
Jeroen Bakker
3393b7137e RenderReport: Add option to add platform specific overrides.
Reference images in the reference_override_dir will be chosen before
images in reference_dir. This allows platform specific reference
images, with a common base.

Ignored when set to None. The caller is responsible
of setting the reference override dir as the unit test is more aware
what the definition of a platform is.

Patch adds `gpu.platform.device_type_get` function to get the device
type that blender has detected.

Reviewed By: brecht

Maniphest Tasks: T99046

Differential Revision: https://developer.blender.org/D15265
2022-08-01 10:57:32 +02:00
6749a4a8f0 Cleanup: missing braces warning 2022-08-01 11:02:18 +10:00
ca172677b1 Cleanup: simplify uv parametrizer in preparation for C++
Replace `PChart` allocation with simpler calloc/free
2022-08-01 09:46:39 +12:00
17567c235a Cleanup: Remove mesh edge "tmp tag"
Ref T95966. Also fixes modification of input mesh,
which should be considered constant.
2022-07-31 11:56:44 -05:00
5b1ad3d7cf Merge branch 'blender-v3.3-release' 2022-07-31 18:32:26 +03:00
bea5281919 Fix T100075: OBJ import: images loaded multiple times instead of being reused
The new OBJ/MTL importer was creating a new image for any referenced
texture, even if another material (or another property of the same
material) already referenced the same texture. Make it use
BKE_image_load_exists function just like Collada or USD importers do.

Fixes T100075. Extended test coverage to count imported images;
without the fix import_cubes_with_textures_rel would have incorrectly
created 5 images instead of 4.
2022-07-31 18:10:48 +03:00
8c8c744f9d Merge branch 'blender-v3.3-release' 2022-07-31 13:19:35 +02:00
27e6962bed Fix T100086: GPencil Bezier curve edit not updated after smoothing
The stroke was recalculated, but the curve data was not updated.
2022-07-31 13:19:09 +02:00
a49b49d934 Cleanup: simplify uv parametrizer in preparation for C++
Replaces PCHART_HAS_PINS with `bool has_pins`.
2022-07-31 19:17:46 +12:00
3c5620aabd Cleanup: Move interface_region_tooltip.c and header to C++ 2022-07-30 16:40:41 -05:00
af6f0f1757 Fix failing blenlib test from previous commit
Commit 310be2e37c did not update UI_MENU_ARROW_SEP used in tests.
2022-07-30 09:27:32 -07:00
310be2e37c UI: UI_MENU_ARROW_SEP Unicode Character
Use a smaller arrow text character as menu item separator.

See D15578 for examples and details.

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

Reviewed by Julian Eisel
2022-07-30 07:54:12 -07:00
a581460728 UV: Add options for uv select similar in island mode
In island selection mode, add new options for uv select similar:

* Area UV
* Area 3D
* Face (number of faces in island)

See also https://developer.blender.org/T47437
Differential Revision: https://developer.blender.org/D15553
2022-07-30 23:24:11 +12:00
d31886b3fe Cleanup: braces around statements in OBJ parser 2022-07-30 13:10:35 +03:00
1a0fab56b4 Merge remote-tracking branch 'origin/blender-v3.3-release' 2022-07-29 23:23:07 -07:00
8ae14bc1d7 Fix 100035: Make UDIM detection less aggressive
There's been a handful of reports where "obviously" not a UDIM filenames
were detected as such during image open.[1]

This change makes the detection less aggressive by enforcing that the
4-digit sequence be delineated on both sides by one of the following 3
characters ., -, _

This fixes the problem for such filenames as:
"screenshot-1080p.png", "Image-1920x1080.png", "(1999) Photo.png", and
"antiguaChestnut_X_1240Wx814H.png"

[1] T97366 T98918 T99154 T100035

Differential Revision: https://developer.blender.org/D15573
2022-07-29 23:17:41 -07:00
aa7734c9da Cleanup: Clang tidy 2022-07-29 23:23:50 -05:00
599a7ddf17 Cleanup: Move five interface files to C++
Builds on all four platforms on the buildbot. Includes clang tidy fixes.
2022-07-29 23:22:31 -05:00
e6b1e97dd7 Sculpt: fix broken triangle/vertex count for DynTopo 2022-07-29 19:12:40 -07:00
d7cfb6ac71 Sculpt: Opaque vertex type for sculpt
This is a port of sculpt-dev's `SculptVertRef` refactor
(note that `SculptVertRef was renamed to PBVHVertRef`)
to master. `PBVHVertRef` is a structure that abstracts
the concept of a vertex in the sculpt code; it's simply
an `intptr_t` wrapped in a struct.

For `PBVH_FACES` and `PBVH_GRIDS` this struct stores a
vertex index, but for `BMesh` it stores a direct pointer
to a BMVert.  The intptr_t is wrapped in a struct to prevent
the accidental usage of it as an index.

There are many reasons to do this:

* Right now `BMesh` verts are not logical sculpt verts;
  to use the sculpt API they must first be converted to indices.
  This requires a lot of indirect lookups into tables, leading to performance
  loss.  It has also led to greater code complexity and duplication.
* Having an abstract vertex type makes it feasible to have one unified
  temporary attribute API for all three PBVH modes, which in turn
  made it rather trivial to port sculpt brushes to DynTopo in
  sculpt-dev (e.g. the layer brush, draw sharp, the smooth brushes,
  the paint brushes, etc).  This attribute API will be in a future patch.
* We need to do this anyway for the eventual move to C++.

Differential Revision: https://developer.blender.org/D14272
Reviewed By: Brecht Van Lommel
Ref D14272
2022-07-29 19:03:51 -07:00
27a16abe81 Sculpt: fix name collision in DynTopo temp attributes
The attributes PBVH_BMESH uss to store the owning node
for vertices and faces were being created with the same
name, which is no long allowed.
2022-07-29 18:58:36 -07:00
9b9417b661 Cleanup: Replace reinterpret_cast<> with static_cast<> in UI code 2022-07-29 18:45:12 +02:00
03cd794119 Fix attempt for MSVC build error after 42ccbb7cd1 2022-07-29 18:10:26 +02:00
091156f64a Merge branch 'blender-v3.3-release' 2022-07-29 18:00:50 +02:00
Brecht Van Lommel
cfd16c04f8 Build: hide all symbols except a few required ones on Linux
Instead of specifying which symbols to hide, we hide all and make a few
visible. Some users may be relying on calling internal Blender functions,
but Windows is already hiding all of them and this is just not supported.

Fixes T99900: crash with some third-party Python libraries since OneAPI

Ref T76442

Differential Revision: https://developer.blender.org/D14971
2022-07-29 17:54:32 +02:00
42ccbb7cd1 Cleanup: Move RNA path functions into own C++ file
Adds `rna_path.cc` and `RNA_path.h`.

`rna_access.c` is a quite big file, which makes it rather hard and
inconvenient to navigate. RNA path functions form a nicely coherent unit
that can stand well on it's own, so it makes sense to split them off to
mitigate the problem. Moreover, I was looking into refactoring the quite
convoluted/overloaded `rna_path_parse()`, and found that some C++
features may help greatly with that. So having that code compile in C++
would be helpful to attempt that.

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

Reviewed by: Brecht Van Lommel, Campbell Barton, Bastien Montagne
2022-07-29 16:56:48 +02:00
187d90f036 Merge branch 'blender-v3.3-release' 2022-07-29 15:33:25 +02:00
1665e40e16 install_deps: Add handling of libaom, update ffmpeg build for it.
Ref T98555.
2022-07-29 15:32:02 +02:00
d3879e9aaa Merge branch 'blender-v3.3-release' 2022-07-29 15:17:40 +02:00
065dfe744c install_deps: bump IMath/OpenEXR to 3.1.5.
Ref T98555.
2022-07-29 15:17:15 +02:00
3a138a74e5 install_deps: add building of Alembic binaries.
Those are used by alembic regression tests.
2022-07-29 15:17:15 +02:00
Tianhao Chai
b862cf0b9f Fix Cycles build error with CUDA on arm64
Checking arm64 assembly support before CUDA/Metal would cause NVCC to
generate inline arm64 assembly.

Differential Revision: https://developer.blender.org/D15569
2022-07-29 14:57:09 +02:00
a679164cf6 Merge branch 'blender-v3.3-release' 2022-07-29 12:25:31 +02:00
ae0b8e904c Fix (unreported) lib-linking of ID properties not taking library parameter.
While this was not a critical issue (that lib pointer is only used for
some kind of sanity check that no linked data uses local ID pointers),
better to keep `IDP_BlendReadLib` in sync with all other lib-linking
code.
2022-07-29 12:25:15 +02:00
b639e60864 Realtime Compositor: Add needed GPU module changes
This patch implements the necessary changes to the GPU module that are
needed by the realtime compositor.

A new function GPU_material_from_callbacks was added to construct a GPU
material from a number of callbacks. A callback to construct the
material graph by adding and linking the necessary GPU material nodes.
And the existing code generator callback. This essentially allows the
construction of GPU materials independent of node trees and without the
need to do any node tree localization.

A new composite source output to the code generator was added. This
output contains the serialization of nodes that are tagged with
GPU_NODE_TAG_COMPOSITOR, which are the nodes linked to the newly added
composite output links.

Two new GPU uniform setters were added for int2 and matrix3 types.

Shader create info now supports generated compute sources.

Shaders starting with gpu_shader_compositor are now considered part of
the shader library.

Additionally, two fixes were implemented. First, GPU setter node
de-duplication now appropriately increments the reference count of the
references resources. Second, unlinked sockets now get their value from
their associated GPU node stack instead of the socket itself.

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

Reviewed By: Clement
2022-07-29 08:47:52 +02:00
c3ca487498 Render: Propagate view updates to draw engines
Currently, draw engines are not notified of view updates if a render
engine is active and was updated. It is unclear why this is the case
currently, but this behavior was part of the initial commit.

This patch propagates view updates regardless if the update was handled
by an active render engine. This is needed by the realtime compositor as
it implements logic for view updates, which currently does not execute
if Cycles is rendering for instance.

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

Reviewed By: Brecht
2022-07-29 08:30:51 +02:00
4815772fda Cleanup: quiet warnings in recent BLF and rna_ui changes 2022-07-29 13:48:09 +10:00
e9bd6abde3 BLF: New Font Stack for Better Language Coverage
Replace our existing two fonts with a stack of new fonts to increase
and improve language coverage and to add many new symbols and icons.
Covers glyphs of top 44 languages - 1.5 billion more potential users.

See D10887 for lots of details.

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

Reviewed by Brecht Van Lommel
2022-07-28 20:09:20 -07:00
c0845abd89 BLF: Fonts with FT_Face Optional
Allow FontBLFs to exist with NULL FT_Face, added only when actually
needed. Speeds up startup and unused fonts are not loaded.

See D15258 for more details.

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

Reviewed by Brecht Van Lommel
2022-07-28 17:50:34 -07:00
848dd4a40a BLF: Don't Print Empty Strings
Optimize font drawing by skipping empty strings.

See D15472 for more details.

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

Reviewed by Campbell Barton
2022-07-28 17:28:05 -07:00
e261290cb6 Merge branch 'blender-v3.3-release' 2022-07-28 17:40:42 -05:00
6ca602dd9f Fix T99761: Curves sculpt mode crash with empty curves
The virtual arrays may be null if the curves are empty,
it's simple to just skip the domain interpolation completely.
2022-07-28 17:39:10 -05:00
a9c74a0cd0 Fix set iterator test failure on macOS
This is a quite interesting case, where two arguments to a function are
evaluated in different order on Apple Clang than on GCC and I guess
MSVC. Left a comment on that.
2022-07-28 23:53:33 +02:00
3d91a853b2 Cleanup: Nodes: Store node group idname in tree type
There was already a utility to retrieve the correct node group idname
from the context, `node_group_idname`, but often it's clearer to
use lower-level arguments, or the context isn't accessible.
Storing the group idname in the tree type makes it accessible
without rewriting it elsewhere.
2022-07-28 16:34:17 -05:00
4757a5ad33 Cleanup: Make BKE_idprop.h self sufficient
It relied on uint, which is defined in a separate header.
2022-07-28 16:20:36 -05:00
eea1f9b1df Merge branch 'blender-v3.3-release' 2022-07-28 16:08:36 -05:00
1adeae56e6 Fix: Grammar mistake in info message 2022-07-28 16:08:20 -05:00
5c2fff306e Cleanup: Use LISTBASE_FOREACH macro 2022-07-28 16:02:46 -05:00
72d8a40a3d Cleanup: Use const context argument for UIList callbacks 2022-07-28 16:02:15 -05:00
cf61be6190 Cleanup: Use new IDProperty creation API for geometry ndoes modifier
Use the API from 36068487d0 instead
of the uglier `IDPropertyTemplate` API.
2022-07-28 15:50:39 -05:00
543ea41569 Cleanup: Remove unused node "add and link node" operator
The link drag search from 11be151d58 implements
this now. It was added in 3ebe7d970e but never used.
2022-07-28 15:40:32 -05:00
19528cfecd Merge branch 'blender-v3.3-release' 2022-07-28 21:31:14 +02:00
79ab76e156 Cleanup: simplifications and consistency for vector types
* OneAPI: remove separate float3 definition
* OneAPI: disable operator[] to match other GPUs
* OneAPI: make int3 compact to match other GPUs
* Use #pragma once
* Add __KERNEL_NATIVE_VECTOR_TYPES__ to simplify checks
* Remove unused vector3
2022-07-28 21:27:13 +02:00
fb42c5838c Revert "Fix T98773: GPU Subdivision breaks auto selection in UV edit mode"
This reverts commit e2c02655c7. It was already
reverted in the 3.2 branch, as it caused more serious issues than it solved.

Fixes T99805, T99323, T99296.
2022-07-28 21:20:51 +02:00
d094a3722c Fix wrong post-increment operators & test for BLI containers 2022-07-28 20:45:28 +02:00
9c65af2df0 Merge branch 'blender-v3.3-release' 2022-07-28 21:27:14 +03:00
68db023329 ID namemap: fix missing removal of old name in do_versions_rename_id
Was causing an assert that the old name exists in the name map, but
is not present in the actual database. Reported in #blender-coders
2022-07-28 21:26:30 +03:00
ae89fcfdaf Merge branch 'blender-v3.3-release' 2022-07-28 14:36:49 -03:00
fafb901baa PyDoc: fix 2D builtin shaders documentation
2D shaders require the `vec2` attribute for "pos" (not `vec3`)
2022-07-28 14:36:07 -03:00
2b9d4af261 EEVEE-Next: UI: Make Vector pass greyed out when motion blur is enabled
Also clears the render result to 0 to avoid invalid motion vectors.
2022-07-28 17:01:05 +02:00
53fc9add51 EEVEE-Next: Cleanup: Isolate render result readback and prototype progress
Still not working but the idea is to read the result and display the
first image sample so that user has a better feedback of the
rendering.
2022-07-28 17:01:05 +02:00
1e0aa2612c EEVEE-Next: Motion Blur new implementation
The new implementation leverage compute shaders to reduce the
number of passes and complexity.

The max blur amount is now detected automatically, replacing the property
in the render panel by a simple checkbox.

The dilation algorithm has also been rewritten from scratch into a 1 pass
algorithm that does the dilation more efficiently and more precisely.

Some differences with the old implementation can be observed in areas with
complex motion.
2022-07-28 17:01:05 +02:00
82327ce01d DRW: TextureFromPool: Change API to use acquire / release
This removes the quirk of having to call the sync function for each new
render loop.

# Conflicts:
#	source/blender/draw/engines/eevee_next/eevee_view.cc
2022-07-28 17:00:46 +02:00
0830ff55d8 EEVEE-Next: Fix Vector render pass 2022-07-28 16:58:01 +02:00
aacdaa7b1a Merge branch 'blender-v3.3-release' 2022-07-28 16:32:27 +02:00
ea23e937ce Cleanup/refactor: Readfile: Add dedicated function to insert ID pointers in libmap.
New `oldnewmap_lib_insert` does nothing special, it just wraps around existing
`oldnewmap_insert`, but it's the logical counter part of `oldnewmap_liblookup`.

It also helps tremendously when debuging complex ID pointers issues in
readfile.c code.
2022-07-28 16:29:57 +02:00
f3be8e66d7 Fix (studio-reported) crash in some rare cases in blendfile read code.
Crash would happen when a linked ID would become missing, that was
'pre-declared' and used only once as a 'weak link' in another library
stored before the one it came from.

In that case, the place-holder generated in read code would be freed in
`read_library_clear_weak_links`, when handling its 'owner' library, but
since all previous libraries in the list had already been 'lib_linked'
and their filedata (and related libmap) freed, the update of the libmaps
in `read_library_clear_weak_links` would not apply to data from those
previous libraries, leading to ID pointers there pointing to freed
memory.

This fix should also be backported to 2.93.
2022-07-28 16:29:57 +02:00
69bf74bd76 Merge branch 'blender-v3.3-release' 2022-07-28 16:40:37 +03:00
c49717a824 Fix T100017: OBJ: new importer does not import vertices that aren't part of any face
The Python based importer had a special case handling of "no faces in
the whole file at all", where it ended up treating the whole file
as essentially a point-cloud-like object (just loose vertices, no
faces or edges). The new importer code was missing this special case.

Fixes T100017. Added gtest coverage that was failing without the fix.
2022-07-28 16:39:42 +03:00
Iliay Katueshenock
07e201ec13 Geometry Nodes: add assert to check if node supports lazyness
Only nodes supporting lazyness can mark inputs as unused. For other
nodes, this is done automatically of all outputs are unused.

Differential Revision: https://developer.blender.org/D15409
2022-07-28 13:39:40 +02:00
d892f96cb1 Cleanup: Fix typo in comment 2022-07-28 12:52:20 +02:00
d034c28f51 Merge branch 'blender-v3.3-release' 2022-07-28 11:42:46 +02:00
ccb9d5d307 Curves: enable density brush when first entering curves sculpt mode
Previously, no tool was selected, which was a bug.
2022-07-28 11:41:36 +02:00
aa7d130347 Curves: improve handling of empty surface meshes 2022-07-28 11:37:35 +02:00
6ae9565d06 Cleanup: quiet GCC stringop-overflow warning 2022-07-28 16:08:59 +10:00
d41f0c7b15 Cleanup: unused header 2022-07-28 16:01:29 +10:00
a98102e32e Merge branch 'blender-v3.3-release' 2022-07-28 09:39:57 +10:00
8d4fa03e5c BLI_math: improve symmetrical values from sin_cos_from_fraction
When plotting equally distant points around a circle support an extra
axis of symmetry so twice as many exact values are repeated than
originally added in [0], see code-comments for a detailed explanation.
Tests to ensure accuracy and exact symmetry have been added too.

Follow up on fix for T87779.

[0]: 087f27a52f
2022-07-28 09:39:54 +10:00
397731d4df BLI_math: improve symmetrical values from sin_cos_from_fraction
When plotting equally distant points around a circle support an extra
axis of symmetry so twice as many exact values are repeated than
originally added in [0], see code-comments for a detailed explanation.
Tests to ensure accuracy and exact symmetry have been added too.

Follow up on fix for T87779.

[0]: 087f27a52f
2022-07-28 09:34:46 +10:00
ff048f5d27 Curves: Avoid virtual function overhead when finding selected curves
This showed up on a profile of sculpting with the comb brush.
Use a span instead of a virtual array.
2022-07-27 15:41:32 -05:00
165fa9e2a1 Merge branch 'blender-v3.3-release' 2022-07-27 21:26:18 +02:00
38af5b0501 Cycles: switch Cycles triangle barycentric convention to match Embree/OptiX
Simplifies intersection code a little and slightly improves precision regarding
self intersection.

The parametric texture coordinate in shader nodes is still the same as before
for compatibility.
2022-07-27 21:03:33 +02:00
69f2732a13 Cleanup: remove unnecessary bvh_instance_motion_pop 2022-07-27 21:02:21 +02:00
cd47d1b2ed Fix broken BVH2 on CPU after recent changes
Runtime switching between Embree and BVH2 got lost.
2022-07-27 20:58:02 +02:00
55fb2abc81 Curves: Bring back parallel copying of curve and point attributes
This was removed in cacdea7f4a to fix a bug, but copying point
and curve attributes should be fine as long as the attribute arrays are
retrieved before-hand.

Differential Revision: https://developer.blender.org/D15541
2022-07-27 11:52:11 -05:00
0dcfd93c6e Fix: curves edit hints not propagated in Join Geometry node
Found while investigating why crazy-space editing didn't work in T100026.
2022-07-27 18:38:45 +02:00
6e5eb46d73 Fix T100026: crash with zero-sized attributes
The problem was that zero-sized and non-existant attributes were
handled the same in some parts of the attribute API, which led to
unexpected behavior.

The solution is to properly differentiate the case when an attribute
does not exist and when it is just empty (because the geometry
is empty).

Differential Revision: https://developer.blender.org/D15557
2022-07-27 18:20:22 +02:00
d6b970dd7b Merge branch 'blender-v3.3-release' 2022-07-27 18:07:29 +02:00
84a3ff63d0 Fix: missing evaluated offsets in Resample Curve node
Differential Revision: https://developer.blender.org/D15556
2022-07-27 18:05:31 +02:00
84272ce19a Fix: add missing return
It was correct but less efficient without this early return.
2022-07-27 17:54:49 +02:00
5560da7ceb Revert "Blender 3.3 splashscreen"
This reverts commit d61ab45385.
2022-07-27 17:32:21 +02:00
37ebd66570 Revert "Blender 3.3 - Beta"
This reverts commit 32a9aac3b8.
2022-07-27 17:32:05 +02:00
3b71a62390 Merge branch 'blender-v3.3-release' 2022-07-27 17:31:49 +02:00
d61ab45385 Blender 3.3 splashscreen
Credits: Piotr Krynski
2022-07-27 17:25:56 +02:00
b2dd1f8f01 Fix build include for rna_curves.c
* Since curves are no longer experimental, this should be included at any time.
2022-07-27 17:19:15 +02:00
32a9aac3b8 Blender 3.3 - Beta
* BLENDER_VERSION_CYCLE set to beta
* Update pipeline_config.yaml to point to 3.2 branches and svn tags
* Update and uncomment BLENDER_VERSION in download.cmake
2022-07-27 17:14:21 +02:00
9015952c9c Blender 3.4 Alpha: Start of new release cycle. 2022-07-27 16:53:19 +02:00
83362f87bb Blender 3.3: Finalizing version bump. 2022-07-27 16:33:49 +02:00
415f88d8b0 Fix wrong fileversion usage in own recent rB9ac81ed6abfb. 2022-07-27 16:20:50 +02:00
ea4b1d027d Geometry Nodes: Rename "Field on Domain" to "Interpolate Domain"
This name doesn't require understanding of fields, and
is phrased as an action which is consistent with other nodes.
Discussed in the latest geometry nodes sub-module meeting.
2022-07-27 08:56:17 -05:00
Erik Abrahamsson
c8ae1fce60 Geometry Nodes: Shortest Paths nodes
This adds three new nodes:
* `Shortest Edge Paths`: Actually finds the shortest paths.
* `Edge Paths to Curves`: Converts the paths to separate curves.
  This may generate a quadratic amount of data, making it slow
  for large meshes.
* `Edge Paths to Selection`: Generates an edge selection that
  contains all edges that are part of a path. This can be used
  with the Separate Geometry node to only keep the edges that
  are part of a path. For large meshes, this approach can be
  much faster than the `Edge Paths to Curves` node, because
  less data is created.

Differential Revision: https://developer.blender.org/D15274
2022-07-27 15:38:44 +02:00
9ac81ed6ab Fix corrupted blend files after issues from new name_map code.
Add a version of #BKE_main_namemap_validate that also fixes the issues,
and call it in a do_version to fix recent .blend files saved after the
regression introduced in rB7f8d05131a77.

This is mandatory to fix some production files here at the studio, among
other things.
2022-07-27 15:33:29 +02:00
9f53272df4 Fix more issues with new name map and liboverrides.
Follow-up to rB13e17507c069, forgot to handle shapekeys...
2022-07-27 15:33:29 +02:00
58dcd20998 ID namemap: Fix more issues when changing libs.
Fix tests, and some issue when making an ID local.

There are probably a few more issues still though.
2022-07-27 15:33:29 +02:00
Amelie Fondevilla
4843b161d6 Fix T99870 : Prevents crash when rearranging channels in dopesheet
The function to rearrange channels only works for F-curves channels for now, adding the `FCURVESONLY` filter prevents the function to be called for grease pencil channels, thereby fixing the crash.

Reviewed by : sybren
Differential Revision: http://developer.blender.org/D15504
2022-07-27 11:40:44 +02:00
7324f32a94 ID namemap tests: Use consistency check, fix an issue.
Massively use the new consistency check in namemap regression tests, and
fix an issue with library data tests revealed by those checks.
2022-07-27 11:22:48 +02:00
18dc611b40 ID namemap: Add check for consistency.
Add a util function to check that content of a given Main and the
namemaps in it are consistent.

Add some asserts calling this check after file read, and after some
override operations.
2022-07-27 11:22:48 +02:00
1e55b58e4f UI: Sort tools in curves sculpting mode
The previous order was based on the order of when the tools were
developed. Instead we now cluster them based on similar functionality:

* Selection
* Add/Remove
* Deform/Transform
* Annotation

Done in collaboration with Pablo Vazquez.
2022-07-27 11:15:48 +02:00
13e17507c0 Fix crashes due to non-uniqueness in ID names in some cases.
Liboverrides are doing some very low-level manipulation of IDs in apply
code, to reduce over-head of name and sorting handling.

This requires specific care to ensure thatr the new namemap runtime data
remains up-to-date and valid. Otherwise, names of existing IDs would be
missing from the map, which would later lead to having several different
IDs with the same name. Critical corruption in Blender ID management.

Reported by animators at the Blender studio.

Regression from rB7f8d05131a77.
2022-07-27 11:10:45 +02:00
4dd409a185 Fix T99976: Animated visibility not rendering properly in viewport
A mistake in the 0dcee6a386 which made specific driven visibility
to work, but did not properly handle actual time-based visibility.

The basic idea of the change is to preserve recalculation flags of
nodes which were tagged for update but were not evaluated due to
visibility constraints. In the file from the report this makes it
so tagging which is done first time ID is in the dependency graph
are handled when the ID actually becomes visible. This is what
solved the root of the problem from the report: there was missing
geometry update since it was "swallowed" by the evaluation during
the object being invisible. In other configurations this change
allows to handle pending geometry updates due to animated modifiers
be handled when object becomes visible without time change.

This change also solves visibility issue of the synchronization
component which also started to be handled badly since the
previous fix attempt. Basically, the needed exception in its
visibility handling did not happen and a regular logic was used
for it.

Tested with files from the T99733, T99976, and from the Heist
project.

Differential Revision: https://developer.blender.org/D15544
2022-07-27 10:19:42 +02:00
d706d0460c Cycles oneAPI: simplify num_concurrent_states selection
The number of Execution Units and resident "threads" (simd width * threads
per EUs) are now exposed and used to select the number of states using
a simplified heuristic.
2022-07-27 09:45:33 +02:00
38e270ae30 Cleanup: Move wm_dragdrop.c to C++ 2022-07-26 23:15:33 -05:00
e67710b908 deps/oiio: fix build issue on windows
tiff now outputs tiffd.lib for debug builds
oiio was not informed about this and had
a build error because of it.
2022-07-26 20:59:44 -06:00
f43a8835dc deps/alembic: add missing imath dependency
if alembic builds before imath it'll cause a build error.
2022-07-26 20:54:27 -06:00
Jun Mizutani
2ca18e78f9 Sculpt: Remove debug printf
Reviewed By: Joseph Eagar
Differential Revision: D15547
Ref D15547
2022-07-26 14:25:58 -07:00
b75d0c7e7a Geometry Nodes: Implement link drag search for two nodes
It was never added for the field on domain and field at index nodes.
They need special handling because they have many what should be
a multi-type socket declaration.
2022-07-26 16:12:42 -05:00
f14f81e5ac Nodes: Allow using escape key to exit node resizing 2022-07-26 16:03:43 -05:00
faa0c7aa6f Cleanup: Move mesh_tessellate.c to C++ 2022-07-26 14:41:34 -05:00
Falk David
88f0d483bd Python: Expose property to mute action groups
This patch adds a `mute` RNA property on `ActionGroup`s that allows them to be easily muted/unmuted from python.
This uses the existing `AGRP_MUTED` flag which was also accessible from the user interface.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D15329
2022-07-26 21:32:05 +02:00
8571093f99 GPencil: Small UI change in overlay for consistency
To keep consistency is better add the word `Inactive` for `Fade Layers` and `Fade Objects`  to keep the same naming used in other areas of the overlay panel.

Reviewed by: Matias Mendiola
2022-07-26 16:39:17 +02:00
2b8e35eeb0 Fix T99984: Small GPencil overlay UI bugs in Edit Mode
This commit fixes the opacity for curves hiding the option.

Actually, the curve points and handles drawing is using the same code that mesh curves and the opacity is not supported. While this feature will be added for mesh curves and gpencil, now it's better to hide this option.

Reviewed: Matias Mendiola

Note: The handle problem reported in this task was fixed in  a separated commit: 203e7ba332
2022-07-26 16:34:27 +02:00
1998269b10 Refactor: Extract color attributes as generic attributes
Previously there was a special extraction process for "vertex colors"
that copied the color data to the GPU with a special format. Instead,
this patch replaces this with use of the generic attribute extraction.
This reduces the number of code paths, allowing easier optimization
in the future.

To make it possible to use the generic extraction system for attributes
but also assign aliases for use by shaders, some changes are necessary.
First, the GPU material attribute can now store whether it actually refers
to the default color attribute, rather than a specific name. This replaces
the hack to use `CD_MCOL` in the color attribute shader node. Second,
the extraction code checks the names against the default and active
names and assigns aliases if the request corresponds to a special active
attribute. Finally, support for byte color attributes was added to the
generic attribute extraction.

Differential Revision: https://developer.blender.org/D15205
2022-07-26 08:37:38 -05:00
5945a90df9 Fix T98788: bad first curve tangent when first points have same position 2022-07-26 15:25:59 +02:00
72f77598a2 Fix T98798: tag collection geometry when changing instance offset
Changing the instance offset moves the entire "collection geometry".
So other features that depend on the geometry should be reevaluated.
2022-07-26 14:59:40 +02:00
ac1554bcf6 Fix T98982: cannot change default value of some node group input types 2022-07-26 14:49:12 +02:00
5aba7f9774 Geometry Nodes: Hide value button for field at index node
Changing the value doesn't accomplish anything, since the retrieved
value would be the same for every index then. So it's best to hide it
to make the node clearer.
2022-07-26 07:42:32 -05:00
78b7140b02 deps: update TIFF and OpenEXR
* OpenEXR 3.1.4 -> 3.1.5, this fixes several issues OSS fuzz found.
* libtiff 4.3.0 -> 4.4.0, this fixes several CVE's.

This also converts the harvest of libtiff on windows to a post install handler,
there's a few left but Windows is getting close to being harvest free.

Differential Revision: https://developer.blender.org/D15478
2022-07-26 13:25:58 +02:00
aa788b759a deps: FFmpeg vpx/aom-av1 updates
This is a refresh of our current FFmpeg 5.0.0 (unchanged) version with the
following changes:

* libvpx all platforms: enable SSE3/4/AVX/AVX2 instruction sets. libvpx has a
  proper CPUID check in place and will not call the faster kernels unless it is
  sure the CPU supports it. So we can safely enable this, this partially
  resolves T95743 (completely on Linux and macOS).

* libvpx Windows - threading was disabled due to a shared dependency on
  libwinpthreads.dll which we prefer not to distribute. However when configure
  cannot find pthreads it will happily fall back on a win32 threads based
  emulation layer. This also resolves the final part of T95743.

* libaom-av1 - new dependency required for D14920, this is a somewhat odd
  dependency, it's cmake based, but still needs the perl environment setup, so
  we have to setup the env and call cmake our selves for the configure, build
  and install commands. This dep has the same libwinpthreads issue as vpx on
  Windows, however since it's cmake based, it's easier to prevent cmake from
  detecting it.

Differential Revision: https://developer.blender.org/D15399
2022-07-26 13:25:58 +02:00
caf907626d Fix T99271: modifier errors are not cleared 2022-07-26 13:01:30 +02:00
c5712c6795 Fix T99373: add some padding in spreadsheet vector columns
This improves readability in some cases (e.g. in T99373).
2022-07-26 12:36:44 +02:00
Nate Rupsis
b08c5381ac default N-panel open for animation editors
The Graph, Driver, and Dopesheet's (and sub modes) properties panel
(N-Panel) are now open by default. This includes the editors in the
default Animation workspace.

Note that, because the Timeline is implemented as a special mode of the
Dopesheet, switching between Timeline and Dopesheet will *not* change
the visibility of the properties panel.

Maniphest Tasks: T97980

Differential Revision: https://developer.blender.org/D14910
2022-07-26 11:43:05 +02:00
e4a779264c Partially revert "Build: Fix build of library dependencies on Linux aarch64"
This reverts the Flex-related parts of commit
rBef268c78933079137288e326704431432adf9ad9, as those caused a build
error on CentOS 7 (which is used for the precompiled Linux libraries).

CentOS 7 only has Automake 1.13, whereas after this commit version 1.15
seems to be required.

Since in its patch description (D15319) it's mentioned that this
"probably doesn't warrant changing", and it's actually blocking the
build of the precompiled libraries for Blender 3.3 now, I'll revert the
Flex-related part of the commit.
2022-07-26 11:43:05 +02:00
Iliay Katueshenock
c94ca54cda BLI: add use_threading parameter to parallel_invoke
`parallel_invoke` allows executing functions on separate threads.
However, creating tasks in tbb has a measurable amount of overhead.
Therefore, it can be benefitial to disable parallelization when
the amount of work done per function is small.

See D15539 for some benchmark results.

Differential Revision: https://developer.blender.org/D15539
2022-07-26 11:10:16 +02:00
203e7ba332 GPencil: Update curve handle display after change overlay option
The handles were not updated after changing the settings.

This is a partial fix of T99984
2022-07-26 11:07:28 +02:00
c597d6cb64 Fix T99979: GPencil strokes cannot be edited after set origin
The stroke points were changed but the bounding box calculation was not done and this produced a problem in any bounding box check done by different tools.
2022-07-26 10:53:08 +02:00
c869f54dcb Cleanup: Typo in comments: data-lock -> data-block. 2022-07-26 10:00:20 +02:00
bdb4ebebf1 Cleanup: quiet GCC cast-function-type warnings for gflags 2022-07-26 14:47:12 +10:00
c3bc53162a Cleanup: format 2022-07-26 13:23:45 +10:00
f1f89ca751 Cleanup: spelling in comments 2022-07-26 13:21:21 +10:00
3ae85a0d8f Fix Python SystemExit exceptions silently exiting
Any script that raised a SystemExit called by --python, --python-expr
command line args or by executing the text block would exit without
printing a message. This caused the error from T99966 to be hidden.

Add explicit handling for SystemExit to ensure the message is always
shown before exiting.

More details noted in code-comments.
2022-07-26 13:21:15 +10:00
37ad72ab23 Fix T99966: Python API docs fail to generate
The recent addition of "active_action" [0] required updating in the
API docs type information.

[0]: cd21022b78
2022-07-26 12:51:01 +10:00
4cf6524731 Fix Cycles Metal build errors after recent changes
float8 is a reserved type in Metal, but is not implemented. So rename to
float8_t for now.

Also move back intersection handlers to kernel.metal, they can't be in the
class that encapsulates the other Metal kernel functions.
2022-07-26 00:17:37 +02:00
f76a2c0d18 Fix: Fix attribute writer debug warnings in terminal
Use an imperfect solution, since this code will be replaced soon anyway.
2022-07-25 16:06:28 -05:00
462f99bf38 Sculpt: Fix T99779, pbvh gets wrong active vertex for multires
The recent multires winding fix missed a code branch.
2022-07-25 11:53:48 -07:00
fb9f12eeec UI: Nishita sky: Increase Sun Elevation UI sensitivity and remove min/max
This now use default angle precision which matches the sun rotation.
Feeling is much more natural.
2022-07-25 19:26:12 +02:00
46dbfce7fc Cycles: Nishita Sky: Fix sun disk imprecision for large elevation
The issue was introduced by rBad5e3d30a2d2 which made possible to use
unbounded elevation angle.

In order to not touch the shading code, we just remap the value to the
expected range the shading code expects. This means that elevation angles
above +/-PI/2 effectively flip the sun rotation angle.
2022-07-25 19:26:12 +02:00
703dff333c Fix T99459: GPencil: Fill tool on the surface not in the correct place
There is a 1 pixel error in the size registered for the buffer
dimensions.

NOTE: This issue indicates that the texture scale is different from the
region, so the mouse-based coordinates used are actually misaligned.
This misalignment will be fixed in another commit.

Regression probably introduced in rB1d49293b8044 + rB45f167237f0c8
2022-07-25 14:13:48 -03:00
00a3533429 Curves: Unify poll functions, add message with no surface
The "snap to surface" operators now have "disabled" poll messages
when there is no surface object.

The implementation in most curves operators is also unified.
The goal is to avoid having to define and use the poll failure messages
in multiple places, to reduce the boilerplate that tends to be
necessary to add an operator, and to increase the likelihood that
operators are implemented with proper poll messages.

Differential Revision: https://developer.blender.org/D15528
2022-07-25 11:59:33 -05:00
739136caca Fix: Assert in resample curve node with single point curve 2022-07-25 11:53:22 -05:00
f26aa186b2 Cleanup: remove __KERNEL_CPU__
This was tested in some places to check if code was being compiled for the
CPU, however this is only defined in the kernel. Checking __KERNEL_GPU__
always works.
2022-07-25 17:43:35 +02:00
Andrii Symkin
793d203139 Cycles: add math functions for float8
This patch adds required math functions for float8 to make it possible
using float8 instead of float3 for color data.

Differential Revision: https://developer.blender.org/D15525
2022-07-25 17:36:58 +02:00
7a74d91e32 Cleanup: move device BVH code to kernel/device/*/bvh.h
Having the OptiX/MetalRT/Embree/MetalRT implementations all in one file with
many #ifdefs became too confusing. Instead split it up per device, and also
move it together with device specific hit/filter/intersect functions and
associated data types.
2022-07-25 16:34:22 +02:00
Arye Ramaty
c6ce70855a Geometry Nodes: Add node descriptions/tooltips
This commit adds tooltips to the geometry nodes add menu.

Differential Revision: https://developer.blender.org/D15414
2022-07-25 08:56:24 -05:00
881ef0548a Fix wrong Cycles SSS intersection distance after ray distance changes
No need anymore to have a difference between CPU/GPU, all distances
remain in world space.
2022-07-25 15:19:29 +02:00
484ad31653 Cycles: simplify handling of ray distance in GPU rendering
All our intersections functions now work with unnormalized ray direction,
which means we no longer need to transform ray distance between world and
object space, they can all remain in world space.

There doesn't seem to be any real performance difference one way or the
other, but it does simplify the code.
2022-07-25 13:27:40 +02:00
023eb2ea7c Cycles: more closely match some math and intersection operations in Embree
This helps with debugging, and gives a slightly closer match between CPU
and CUDA/HIP/Metal renders when it comes to ray tracing precision.
2022-07-25 13:27:40 +02:00
d567785658 Fix T99816: renaming attribute works incorrectly
This fixes two issues:
* There was a crash when the new attribute name was empty.
* The attribute name was incremented (e.g. "Attribute.001") when
  the old and new name were the same.
2022-07-25 13:16:59 +02:00
332d547ab7 Fix T99850: incorrect tangents on evaluated bezier curves
Cyclic curves don't need the tangent correction based on the first
and last handle position.
2022-07-25 13:10:34 +02:00
b9e66af686 Fix T99851: Subdivide Curve node does not initialize attributes of end point 2022-07-25 12:45:04 +02:00
2c81b4d4cf Fix T99880: no node timing for frames in node groups 2022-07-25 12:27:45 +02:00
5feb3541f4 Fix T99889: Fillet Curve node uses wrong radius 2022-07-25 12:20:54 +02:00
Ramil Roosileht
cf9dd3c0d8 Fix T99036: hex color in "Add Color Attribute"
Proposed solution by @scurest The color attribute in the RNA was tagged as
 COLOR_GAMMA. This change will change it to a regular COLOR.

{F13217692}

Reviewed By: joeedh, jbakker

Maniphest Tasks: T99036

Differential Revision: https://developer.blender.org/D15272
2022-07-25 12:15:27 +02:00
6f1cdcba85 Fix T99929: lattice modifier looks up vertex group index in wrong place
It looked up the vertex group index based on the object instead of the
actual mesh that is currently used. Since geometry nodes, the number
and order of attributes can change in arbitrary ways during evaluation.
Therefore, this index has to be looked up on the mesh which contains
the most up-to-date information.

There are probably similar issues in other modifiers. That has to be
fixed step by step. Ideally by using the attribute api directly eventually.
2022-07-25 11:54:49 +02:00
c5afef1224 Fix missing disabled hint when dragging from Asset Browser in edit mode
When dragging assets into the 3D View while in any other mode than
object mode, dropping would be disabled and the cursor would indicate
that. However there was supposed to be an "Only supported in object
mode" message, that similar operators showed, but got forgotten when
this one was introduced.
2022-07-25 11:44:56 +02:00
1c05f30e4d Curves: add warning when invalid uv map is used when adding curves
UV maps that are used for surface attachment must not have overlapping
uv islands, because then the same uv coordinate would correspond to
multiple surface positions.

Ref T99936.
2022-07-25 11:42:27 +02:00
53113a2e57 Geometry: detect when the sample uv is in multiple triangles 2022-07-25 11:32:39 +02:00
c5394f3db8 EEVEE-Next: Fix float3 passes being incorrect 2022-07-25 11:25:24 +02:00
f814871e81 EEVEE-Next: Fix some Material compilation errors 2022-07-25 11:25:24 +02:00
47d1a7484c EEVEE-Next: Display compatible properties panels
Only a few are kept not available as their features are not yet supported.
2022-07-25 11:25:24 +02:00
cd9ebc816e Fix build error with WITH_CYCLES_KERNEL_NATIVE_ONLY on macOS Arm
-march=native is not supported for all architectures.
2022-07-25 11:23:25 +02:00
72fb92ded8 Fix T99961: crash when spreadsheet shows volume grids 2022-07-25 11:22:14 +02:00
cacdea7f4a Fix: crash when accessing attributes from multiple threads
Calling two non-const methods on a `MutableAttributeAccessor`
at the same time in multiple threads is not safe.

While I don't know what caused the crash here exactly, I do know
that it happens while looking up the attribute for writing, which
may modify the unterlying geometry. I couldn't reproduce the
bug with a debug build or without threading.
2022-07-25 11:14:42 +02:00
Alex Parker
44258b5ad0 Undo: Improve image undo performance
When texture painting a lot of time is spent in ED_image_paint_tile_find.
This fixes stores the PaintTiles in a blender::Map making ED_image_paint_tile_find an O(1) rather than O(n) operation.

When using threading the locking should happen during read as well,
still this gives a boost in performance as the read is now much faster.

Reviewed By: jbakker

Maniphest Tasks: T99546

Differential Revision: https://developer.blender.org/D15415
2022-07-25 08:14:32 +02:00
7808ee9bd7 Geometry Nodes: Improve UV Sphere primive performance
In a test producing 10 million vertices I observed a 3.6x improvement,
from 470ms to 130ms. The largest improvement comes from calculating
each mesh array on a separate thread. Besides that, the larger changes
come from splitting the filling of corner and face arrays, and
precalculating sines and cosines for each ring.

Using `parallel_invoke` does gives some overhead. On a small 32x16
input, the time went up from 51us to 74us. It could be disabled
for small outputs in the future. The reasoning for this parallelization
method instead of more standard data-size-based parallelism is that the
latter wouldn't be helpful except for very high resolution.
2022-07-24 20:03:16 -05:00
Lukas Stockner
6db059e3d7 Render: Update lightgroup membership in objects and world if lightgroup is renamed
As discussed, this only updates objects in and the world of the scene to which the view layer belongs, which also avoids the problem of not having a BMain available.

Differential Revision: https://developer.blender.org/D14740
2022-07-24 21:33:04 +02:00
f7d5aaa365 Alembic: speed up edge crease import
The Alembic importer uses a linear search over the mesh edges to find
the right edge when setting edge creases. Although the complexity is
`O(m * n)`, with `m` being the number of creased edges, and `n` being
the number of edges, this can lead to a quadratic complexity as `m`
approches `n`.

This patch uses `EdgeHash` to store and retrieve the edges, which
should bring complexity closer to `O(n)`, provided that lookup is
`O(1)`.

See differential for some timings. In most files, this is expected
to give at least a 2-3x speedup for this operation, but can lead
orders of magnitude speed increase for dense meshes with a significant
number of edge creases.

Differential Revision: https://developer.blender.org/D15521
2022-07-24 21:18:11 +02:00
d26c29d8e4 Fix T98367: Light group passes do not work when shadow catcher is used 2022-07-24 20:36:46 +02:00
31365c6b9e Attributes: Use new API for C-API functions
Use the C++ API to implement more of the existing C functions.
This corrects the cases where one tries to add a builtin attribute
with the wrong domain or type on curves, though a better warning
message would be helpful in the future, and also reduces duplication
of the internal logic. Not much more is possible without changing
the interface.
2022-07-24 12:46:28 -05:00
ad632a13d9 EEVEE-Next: Decorelate Large filter spiral sampling
This avoids correlation artifacts with the jitter pattern itself.
Also try to reduce the visible spiral pattern.
2022-07-24 19:24:50 +02:00
b1c49b3b2a EEVEE-Next: Fix depth accumulation and stability in viewport
The display depth is used to composite Gpencil and Overlays. For it to
be stable we bias it using the dFdx gradient functions. This makes
overlays like edit mode not flicker.

The previous approach to save the 1st center sample does not work anymore
since we jitter the projection matrix in a looping pattern when scene
is updated. So the center depth is only (almost) valid 1/8th of the times.
The biasing technique, even if not perfect, does the job of being stable.

This has a few cons:
- it makes the geometry below the ground plane unlike workbench engine.
- it makes overlays render over geometry at larger depth discontinuities.
2022-07-24 19:24:50 +02:00
a5bcb4c148 EEVEE-Next: Make animated viewport non jittered when disabling denoising 2022-07-24 19:24:50 +02:00
68101fea68 EEVEE-Next: Add back background opacity toggle 2022-07-24 19:24:50 +02:00
8ac5b1fdb3 EEVEE-Next: Make Anti-Flicker more strong
This might make the image a bit blurier but it reduces the flickering of
shiny surfaces during animation.

This uses the technique described in "High Quality Temporal Supersampling"
by Brian Karis at Siggraph 2014 (Slide 45): Reduce the exponential factor
when the history is close the bounding box border.
2022-07-24 19:24:50 +02:00
bd9bb56f18 EEVEE-Next: Fix Alt+B render borders
A few offsets were missing.
Reminder that this does not change the actual render resolution but it
reduces the VRAM consumption of accumulation buffers.
2022-07-24 19:24:50 +02:00
364babab65 EEVEE-Next: Fix background velocity 2022-07-24 19:24:50 +02:00
0fcc04e7bf Cleanup: Fix off-by-half-errors with udim search 2022-07-24 14:48:30 +12:00
f1f2c26223 Cleanup: Simplify uv sculpt tool
No functional changes.
2022-07-24 13:48:53 +12:00
c94c0d988a Fix: Removing attributes from UI invalidates caches
Use the new attribute API to implement the attribute remove function
used by RNA, except for BMesh attributes. Currently, removing curve
attributes from the panel in the property editor does not mark the
relevant caches dirty (for example, the cache of curve type counts),
because that behavior is implemented with the new attribute API.
Also, eventually we want to merge the two APIs, and removing an
attribute is the first function that can be partially implemented
with the new API.

Differential Revision: https://developer.blender.org/D15495
2022-07-23 19:59:59 -05:00
0c3851d31f EEVEE-Next: Film: Rename filter_size for clarity and add box filter ...
... as a debug option.
2022-07-23 22:57:10 +02:00
3ea2b4ac31 EEVEE-Next: Film: Fix incorrect anti-aliasing
There was a confusion about what space the offset was in.
2022-07-23 22:57:10 +02:00
7c6d546f3a Fix an assert trip in boolean tickled by D11272 example.
The face merging code in exact boolean made an assumption that
the tesselated original face was manifold except at the boundaries.
This should be true but sometimes (e.g., if the input faces have
self-intersection, as happens in the example), it is not.
This commit makes face merging tolerant of such a situation.
It might leave some stray edges from triangulation, but it should
only happen if the input is malformed.
Note: the input may be malformed if there were previous booleans
in the stack, since snapping the exact result to float coordinates
is not guaranteed to leave the mesh without defects.

This is the second try at this commit. The previous one had a typo
in it -- luckily, the tests caught the problem.
2022-07-23 12:15:59 -04:00
d53ea1d0af Fix T99905: wrong toposort when the node tree is cyclic 2022-07-23 14:37:58 +02:00
092732d113 IO: speed up import of large amounts of objects in USD/OBJ by pre-sorting objects by name
Previously, when creating "very large" (tens-hundreds of thousands)
amounts of objects, the Blender code that was ensuring name
uniqueness was the bottleneck. That got recently addressed (D14162),
however now sorting of IDs by their names is the remaining bottleneck.

Name sorting code in Blender is optimized for the pattern where names
are inserted in already sorted order (i.e. objects expect to get added
near the end of the list). By doing this pre-sorting of objects
intended to get created by an importer (USD and OBJ, in this patch),
this sorting bottleneck can be largely removed, especially with very
high object counts.

Windows, Ryzen 5950X, import times:

- OBJ, splash screen scene (26k objects): 22.0s -> 20.7s
- USD, Disney Moana scene (250k objects): 585s -> 82.2s (10 minutes -> 1.5 minutes)

Reviewed By: Michael Kowalski, Howard Trickey
Differential Revision: https://developer.blender.org/D15506
2022-07-23 15:16:14 +03:00
beb746135d Fix T99830: missing update after reordering node group sockets 2022-07-23 13:30:15 +02:00
5da807e00f Fix: Store Named Attribute node not working when attribute did not exist 2022-07-23 12:14:45 +02:00
fc8b9efb24 Update RNA to User manual mappings 2022-07-22 21:00:34 -04:00
82467e5dcf Cleanup: Typo with uv sphere normal creation
Regression from 087f27a52f
2022-07-23 09:12:13 +12:00
80b2fc59d1 Fix T99873: Use evaluated vertex groups in armature modifier
Geometry nodes has added the ability to modify mesh vertex groups
during evaluation (see 3b6ee8cee7). However, the armature
modifier always uses the vertex groups from the original object.
This is wrong for the modifier stack, where each modifier is meant
to use the output of the previous.

This commit makes the armature modifier use the evaluated vertex groups
if they are available. Otherwise it uses the originals like before.

Differential Revision: https://developer.blender.org/D15515
2022-07-22 15:49:53 -05:00
7d8b651268 EEVEE-Next: Add exposure awareness to denoising
This uses the exposure to get a better approximation of the perceptual
brighness of a sample before accumulating it.

Note that we do not modify exposure of the image. Only the samples weights
are computed differently.
2022-07-22 21:03:06 +02:00
676a2f690c EEVEE-Next: Fix render not working
The swaps during accumulation were ignored because of the way the
`SwapChain<>` implementation works.

Using external references and updating them fixes the issue.
2022-07-22 20:32:17 +02:00
35843ddcd8 Fix T99835: Incorrect title case for two node names 2022-07-22 11:36:55 -05:00
98395e0bdf Cleanup: Use r_ prefix for boolean return parameters
Also rearrange some lines to simplify logic.
2022-07-22 10:49:09 -05:00
c40971d79a Fix T99873: Store named attribute node cannot write to vertex groups
Since fd5e5dac89, the node would remove the attribute before
adding it again, which lost the vertex group status of an attribute,
meaning they were written as arbitrary attributes.

Now, the node first tries to write to attributes with the same domain
and data-type, which covers the vertex group case. Then it falls back
to removing the attribute and adding it again. Even that can fail
though, so I added an error message to make that a bit clearer.

Differential Revision: https://developer.blender.org/D15514
2022-07-22 10:31:40 -05:00
e4eaf424b9 Fix nodes not transforming
Error in {rB98bf714b37c1}
2022-07-22 12:17:22 -03:00
6bcda04d1f Geometry Nodes: Port sample curves node to new data-block
Use the newer more generic sampling and interpolation functions
developed recently (ab444a80a2) instead of the `CurveEval` type.
Functions are split up a bit more internally, to allow a separate mode
for supplying the curve index directly in the future (T92474).

In one basic test, the performance seems mostly unchanged from 3.1.

Differential Revision: https://developer.blender.org/D14621
2022-07-22 09:59:28 -05:00
1f94b56d77 Curves: support sculpting on deformed curves
Previously, curves sculpt tools only worked on original data. This was
very limiting, because one could effectively only sculpt the curves when
all procedural effects were turned off. This patch adds support for curves
sculpting while looking the result of procedural effects (like deformation
based on the surface mesh). This functionality is also known as "crazy space"
support in Blender.

For more details see D15407.

Differential Revision: https://developer.blender.org/D15407
2022-07-22 15:39:41 +02:00
Germano Cavalcante
98bf714b37 Refactor: arrange transform convert functions in 'TransConvertTypeInfo'
Simplify the transform code by bundling the TransData creation, Data
recalculation, and special updates into a single struct.

So similar functions and parameters can be accessed without special
type checks.

Differential Revision: https://developer.blender.org/D15494
2022-07-22 10:01:27 -03:00
185eeeaaac GHOST/Wayland: Fix mouse wheel events for Sway Compositor (use seat v5)
Bump the requested seat version to v5, use discreet scroll callback.

Tested with gnome, river & sway.
2022-07-22 22:15:00 +10:00
003dfae270 Cycles: enable oneAPI in Linux release builds
0f50ae131f didn't do it reliably
since it was deactivated explicitly a bit above.
2022-07-22 13:03:49 +02:00
e0d4aede4d BMesh: move bmesh_mesh to C++
This allows parts of the code to be threaded more easily.
2022-07-22 20:40:31 +10:00
95e60b4ffd Cleanup: move crazyspace.c to c++
Doing this in preparation for D15407.
2022-07-22 12:33:08 +02:00
087f27a52f Fix T87779: Asymmetric vertex positions in circles primitives
Add sin_cos_from_fraction which ensures each quadrant has matching
values when their sign is flipped.
2022-07-22 13:59:36 +10:00
08c5d99e88 Cleanup: add BKE_image_find_nearest_tile_with_offset
Every caller BKE_image_find_nearest_tile was calculating the tile offset
so add a version of this function that returns the offset too.
2022-07-22 13:07:24 +10:00
72e249974a Fix crash loading factory settings in image paint mode
Loading factory settings left the region NULL, causing the brushes
poll function to crash.
2022-07-22 12:25:10 +10:00
d3db38cfb1 Cleanup: quiet nonull-compare warnings with GCC 2022-07-22 12:23:33 +10:00
7725740543 UV: Edge support for select shortest path operator
Calculating shortest path selection in UV edge mode was done using vertex
path logic. Since the UV editor now supports proper edge selection [0],
this approach can sometimes give incorrect results.

This problem is now fixed by adding separate logic to calculate the
shortest path in UV edge mode.

Resolves T99344.

[0]: ffaaa0bcbf

Reviewed By: campbellbarton

Ref D15511.
2022-07-22 11:17:16 +10:00
aa1ffc093c Fix T99884: Crash when converting to old curve type
The conversion from Curves to CurveEval used an incorrect type
for one of the builtin attributes. Also, an incorrect default was used
for reading the nurbs_weight attribute.
2022-07-21 19:44:06 -05:00
7a4a6ccad7 Cleanups: Small changes to armature deform
Use const pointers, remove unused data member for parallel callback,
use listbase macro.
2022-07-21 17:21:56 -05:00
ada6012518 Fix T99854: Crash converting legacy NURBS curves to new type
Creating the attributes was done inside a parallel loop. Also correct a
typo for the parallel grain size, which was meant to be a power of two.
2022-07-21 12:13:42 -05:00
Sebastiano Barrera
a5c2d0018c Fix T91932: number sliders wrap around when dragged for long distance on X11
The value of number sliders (e.g. the "end frame" button) wrap around to
their pre-click value when dragging them for a very long distance (e.g.
by lifting the mouse off the desk and placing it back on to keep
dragging in the same direction).

The problem is X11-specific, and due to XTranslateCoordinates using a
signed int16 behind the curtains, while its signature and the rest of
Blender uses int32. The solution is to only use XTranslateCoordinates on
(0, 0) to get the delta between the screen and client reference systems,
and applying the delta in a second step.

Differential Revision: https://developer.blender.org/D15507
2022-07-21 19:02:03 +02:00
611be46cc9 Cleanup: compiler warning 2022-07-21 19:01:19 +02:00
a36f029459 Fix crash in some very rare case in remapping code.
Actualy 'safe' building of the base has in view layers (as part of
`BKE_main_collection_sync_remap`) would only happen when there was
already an existing one, otherwise it was skipped, and rebuilt later
(without the support for doublons) in collection sync code.

Very odd that that error was never spotted before, issue in code has
been there for a long time already. Probably only happens in rare cases
(specific conjuction of factors during remapping of old ID into itelf
new id)?

Reported by @hjalti from Blender studio. Reproducing case:
`heist/pro/shots/050_alarm/050_0160/050_0160.anim.blend`, r1407
2022-07-21 18:11:13 +02:00
ef5b435e8f DRW: Volume: Fix crash in command line render caused by null textures
This was caused by the world volume shader needing placeholder textures
that were not available until cache populate begins.

Adding a check and creating on the fly fixes the issue.
2022-07-21 16:41:51 +02:00
d431b1416b EEVEE-Next: Add back option to disable TAA (Viewport Denoising 2022-07-21 16:41:51 +02:00
b0f9639733 Fix crash due to improper handling of new library runtime name_map data on read/write.
Code handling read/write of libraries is still particular... but trying
to call `library_runtime_reset` on a random address at readtime was an
obvious mistake I should have caught during review :(

Regression from rB7f8d05131a77.
2022-07-21 16:39:07 +02:00
396b7a6ec8 Spreadsheet: Implement selection filter for curves sculpt mode
The spreadsheet can retrieve the float selection using the same
utilities as curves sculpt brushes. Theoretically this can work in
original, evaluated, and viewer node modes, at least when the
sculpt selection attributes are able to be propagated.

Differential Revision: https://developer.blender.org/D15393
2022-07-21 09:34:48 -05:00
412d93c298 GPU: Fix compilation with WITH_GPU_BUILDTIME_SHADER_BUILDER option 2022-07-21 15:50:35 +02:00
92eb59341c EEVEE-Next: Filter NaN at output to avoid propagation. 2022-07-21 15:50:35 +02:00
9f00e138ac Cleanup: DRW: common_math_geom_lib.glsl: Fix variable name style 2022-07-21 15:50:35 +02:00
e022753d7a EEVEE-Next: Add Temporal-AntiAliasing
The improvements over the old implementation are:
- Improved history reprojection filter (catmull-rom)
- Use proper velocity for history reprojection.
- History clipping is now done in YCoCg color space using better algorithm.
- Velocity is dilated to keep correct edge anti-aliasing on moving objects.

As a result, the 3x3 blocks that made the image smoother in the previous
implementation are no longer visible is replaced by correct antialiasing.

This removes the velocity resolve pass in order to reduce the bandwidth
usage. The velocities are just resolved as they are loadded in the film
pass.
2022-07-21 15:50:35 +02:00
2bad3577c0 DRW: common_math_geom_lib.glsl: Add line_aabb_clipping_dist 2022-07-21 15:50:35 +02:00
4ba6bac2f1 Fix build error in tests binary after previous commit
Also remove an unused include and add a comment,
const, use the math namespace.
2022-07-21 08:30:07 -05:00
63be57307e Cleanup: Rename length parameterization interpolation function
The name makes more sense as an action, other interpolation
methods besides linear probably don't make sense here anyway.
2022-07-21 08:15:06 -05:00
95ab16004d Cleanup: Remove debug print in test 2022-07-21 08:00:30 -05:00
03338e0270 GHOST/Wayland: fix cursor glitch after grabbing while hidden
When the cursor grabbing was disabled, Blender's internal location
(wmWindow.eventstate) kept the location before un-hiding.

This caused the paint cursor to show in the wrong location after
adjusting the color wheel for e.g.
2022-07-21 21:47:41 +10:00
a06b04f92d Cleanup: Simplify relation flags assignment 2022-07-21 12:54:35 +02:00
2034e8c42d Geometry Nodes: add debug check for whether AttributeWriter.finish is called
Calling `finish` after writing to generic attributes is currently necessary for
correctness. Previously, this was easy to forget. Now there is a check for this
in debug builds.
2022-07-21 12:47:44 +02:00
538da79c6d Curves: fix applying materials when applying modifier
The issue was that geometry nodes was run on the original curves,
and set a pointer to an evaluated material id on it. The fix is to not
mix up original and evaluated data by making sure that geometry nodes
does not modify the original data.
2022-07-21 12:23:38 +02:00
d099e0d2a4 Cleanup: Make automated code check happy.
- Assert that one of the thwo branches in
  `id_override_library_create_hierarchy` are always processed.
- Init success value regardless.
2022-07-21 12:18:57 +02:00
f7252e9692 Cleanup: Unused forward declaration 2022-07-21 12:16:31 +02:00
10b048fd9e Fix T99885: Invalid dependency graph state when curves surface is invisible
Differential Revision: https://developer.blender.org/D15510
2022-07-21 11:26:36 +02:00
Bastien Montagne
ee3facd087 LibOverride: support 'make override' for all selected items.
This commit allows to select several data-blocks in the outliner and
create overrides from all of them, not only the active one.

It properly creates a single hierarchy when several IDs from a same
hierarchy root data are selected.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D15497
2022-07-21 10:18:43 +02:00
0dcee6a386 Fix T99733: Objects with driven visibility are evaluated when not needed
The issue was caused by the fact that objects with driven or animated
visibility were considered visible by the dependency graph evaluation.

This change makes it so the dependency graph evaluation is aware of
visibility which might be changing. This is achieved by evaluating the
path of the graph which affects objects visibility and adjusts to it
before evaluating the rest of the graph.

There is some time penalty to this, but there does not seem to be a
way to fully avoid this penalty.

With the production shot from the heist project the FPS drops by a
tenth of a frame (~9.4 vs ~9.3 fps) when adding a driver to an object
which keeps it visible. Note that this is a bit hard to measure since
the FPS fluctuates quite a bit throughout the playback. On the other
hand, having a driver on a visibility of a heavy object from character
and setting visibility to false gives big speedup.

Also worth noting that there is no penalty at all when there are no
animated visibilities in the scene.

Differential Revision: https://developer.blender.org/D15498
2022-07-21 09:49:16 +02:00
4089b7b80b Depsgraph: Clear operation evaluation flags early on
The goal is to make it possible to evaluate the graph in multiple
passes without evaluating the same node multiple times.

Currently should not be any functional changes.
2022-07-21 09:48:59 +02:00
d6faee2824 Cleanup: format 2022-07-21 17:45:36 +10:00
2eeedbbca9 Cleanup: add ISMOUSE_MOTION macro
Replace verbose ELEM(..) usage, now each kind of mouse event has it's
own macro.
2022-07-21 16:23:33 +10:00
7a73685460 Fix WM_event_type_mask_test ignoring wheel and gesture events
WM_event_type_mask_test checks assumed ISMOUSE macro worked for any
kind of mouse event when it only accepted buttons & motion.

Now ISMOUSE checks for any kind of mouse event,
use ISMOUSE_BUTTON/WHEEL/GESTURE for more specific checks.
2022-07-21 16:07:11 +10:00
095b8d8688 WM: replace ISMOUSE with ISMOUSE_BUTTON
The ISMOUSE macro was used in situations only button events
needed to be checked.

The only functional difference would be MOUSEMOVE events were
previously accepted for these checks.
2022-07-21 15:54:39 +10:00
4ec0a8705b WM: categorize smart-zoom as a gesture
Event handling and the enum definition documents MOUSESMARTZOOM
as a gesture however it wasn't accepted by ISMOUSE_GESTURE,
instead it was added to the ISMOUSE macro.

Move the type check to ISMOUSE_GESTURE.
2022-07-21 15:28:01 +10:00
dd158f1cab Fix failing cycles test from previous commit
Deprecated custom data type CD_MTEXPOLY has inconsistent data usage.

Reviewed By: Campbell Barton
2022-07-21 16:28:56 +12:00
c171e8b95c Fix T90620: Ignore missing UV data caused by corrupt .blend file
Add crash protection and partial recovery for corrupt .blend files,
particularly for missing UV data.

Differential Revision: https://developer.blender.org/D15489
2022-07-21 15:24:38 +12:00
46a2592eef Cleanup: spelling in comments, typos in tool-tips 2022-07-21 13:21:53 +10:00
e75adb979b Fix T99678: Crash applying non-existent modifiers
Regression in [0] accessed the modifier type before NULL check.

[0]: 78fc5ea1c3
2022-07-21 12:52:24 +10:00
9f68369247 Fix T99687: Cloth filter crash
The code was failing to exclude the sculpt object from
the list of collision objects.
2022-07-20 15:17:07 -07:00
eb281e4b24 Fix T99878: Deleting curves or points removes anonymous attributes
Use the attribute API instead of the CustomData API, to correctly
handle anonymous attributes and simplify the code. One non-obvious
thing to note is that the type counts are recalculated by the "finish"
function of the `curve_type` attribute, so they don't need to be copied
explicitly. Also, the mutable attribute accessor cannot be an reference
if we want to give it an rvalue, which is convenient in this case.
2022-07-20 16:40:05 -05:00
fe108d85b4 Cleanup: Remove unused function 2022-07-20 14:30:44 -05:00
d34f8ac3d9 Cleanup: Remove unnecessary handling of normals for fluid colliders
The normals are transformed, but not used. It looks like this logic was
just copied from below where the mesh is transformed for creating
emitters, which do use vertex normals.
2022-07-20 13:18:03 -05:00
5d4574ea0e Fix T99340: Image.frame_duration returning wrong value when image not loaded
The logic here was broken in d5f1b9c, it should load the image first.
2022-07-20 18:23:03 +02:00
c4d8e28aa7 UI: Remove redundant view reference in view items
The new view item base class already holds a reference to the view, no
need to have one in the derived class as well.
2022-07-20 17:16:15 +02:00
0c6ae51d9f Fix missing registration of grid view items in the view 2022-07-20 17:16:15 +02:00
712960cefd Cleanup: use BLI_strncpy instead of strcpy
Using `strcpy` resulted in `stringop-truncation` warnings for me.
2022-07-20 16:08:02 +02:00
3ea91cecc9 Cleanup: remove unused get_cage_mesh parameter
All callers passed `false` for this parameter, making it more confusing
than useful. If this functionality is needed again in the future, a separate
function should be added.

Differential Revision: https://developer.blender.org/D15401
2022-07-20 15:57:16 +02:00
Wannes Malfait
7561183830 Fix T99667: regression in Delete Geometry node
Differential Revision: https://developer.blender.org/D15445
2022-07-20 15:49:50 +02:00
29c68e2523 Fix T99869: Edge crease no longer working
Missed in d14c2d549b
2022-07-20 10:28:23 -03:00
a814c7091b Fix T99847: Dragging image from Image Editor to Node Editor broken
Oversight in b0da080c2c. The `session_uuid` operator property wouldn't
be checked by the invoke callback, and if neither the `filepath` nor the
`name` property were set, the File Browser would open.
2022-07-20 14:54:32 +02:00
7f8d05131a IDManagement: Speedup ID unique name assignment by tracking used names/basenames/suffixes
An implementation of T73412, roughly as outlined there:

Track the names that are in use, as well as base names (before
numeric suffix) plus a bit map for each base name, indicating which
numeric suffixes are already used. This is done per-Main/Library,
per-object-type.

Timings (Windows, VS2022 Release build, AMD Ryzen 5950X):

- Scene with 10k cubes, Shift+D to duplicate them all: 8.7s -> 1.9s.
  Name map memory usage for resulting 20k objects: 4.3MB.
- Importing a 2.5GB .obj file of exported Blender 3.0 splash scene
  (24k objects), using the new C++ importer: 34.2s-> 22.0s. Name map
  memory usage for resulting scene: 8.6MB.
- Importing Disney Moana USD scene (almost half a million objects):
  56min -> 10min. Name map usage: ~100MB. Blender crashes later on
  when trying to render it, in the same place in both cases, but
  that's for another day.

Reviewed By: Bastien Montagne
Differential Revision: https://developer.blender.org/D14162
2022-07-20 14:27:14 +03:00
8d69c6c4e7 Constraints: add checks to specially handle the custom space target.
- The custom space target never needs B-Bone data (used by depsgraph).
- When drawing the relationship lines use the space matrix directly.
- Don't use the custom target to control the target space type dropdown.

Differential Revision: https://developer.blender.org/D9732
2022-07-20 14:18:17 +03:00
e6855507a5 Constraints: add missing calls to initialize custom space.
Add calls to a few locations that look like they may need to
initialize the Custom Space matrix, i.e. generally any place
that computes target matrices.

Differential Revision: https://developer.blender.org/D9732
2022-07-20 14:18:17 +03:00
054a169be0 Use appropriate context for the DopeSheet Action Custom Properties panel.
Refactor D14646 to use context.active_action for the Action
Custom Properties panel, matching the already existing Action panel.

This has the advantage that it allows access to the properties of
any actions with channels visible in the Dope Sheet, e.g. Shape Keys,
Materials etc; while using just the active object is limited to just
the object animation.

Also move both panels from Item to the Action tab.

Differential Revision: https://developer.blender.org/D15288
2022-07-20 14:18:17 +03:00
ae49e0e8be Cleanup: unused parameter in own recent commit rB92ca920c52b9. 2022-07-20 11:09:16 +02:00
Damien Picard
c48dc61749 I18n: fixes to add-on message extraction
This commit fixes several issues in add-ons UI messages extraction code:

- In multi-file modules, the script would crash because it tried to write to
  the dir instead of a `translations.py` file;
- The add-on message extraction works by enabling the add-on, getting all
  messages; disabling the add-on, getting all messages; then comparing the
  two message sets. But often a bug happens where a class gets a
  description from somewhere else in memory. I couldn’t debug that, so a
  workaround is to check that the message isn’t a corrupted one before
  removing it;
- `printf()` doesn't exist in Python and would crash the script;
- `self.src[self.settings.PARSER_PY_ID]` can be replaced by `self.py_file`
  in class `I18n`, since a property exists to do that;
- At one point a generator was printed instead of its values, so let's
  unpack the generator to get the values. Maybe the print could be
  deleted entirely;
- Use SPDX license identifier instead of GPL license block, to be more in
  line with other scripts from the codebase.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15474
2022-07-20 11:05:07 +02:00
Bastien Montagne
92ca920c52 Add a 'Apply and Delete All' operation to shapekeys.
Adds a new option to the 'Delete ShpaKeys' operator, which first applies
the current mix to the object data, before removing all shapekeys.

Request from @JulienKaspar from Blender studio.

Reviewed By: JulienKaspar

Differential Revision: https://developer.blender.org/D15443
2022-07-20 10:55:08 +02:00
ecf4f4a71f Curves: fix uninitialized curve type when adding new curves 2022-07-20 10:47:23 +02:00
c3b9a4e001 Cleanup: Access attributes with new API instead of geometry components
Remove the boilerplate of using a local geometry component just to use
the attribute API that was necessary before b876ce2a4a.
2022-07-19 22:34:32 -05:00
215f805ce6 Curves: Remove use of CurveEval in sculpt brushes
This commit removes the use of PolySpline for resampling curves and
replaces it with the length parameterization utility for that purpose.
I didn't test performance, but I would expect the shrinking to be
slightly faster because I reused some arrays to avoid allocating
them for every curve. I noted some potential improvements in
the "add curves" function.

Differential Revision: https://developer.blender.org/D15342
2022-07-19 21:48:32 -05:00
2551cf9087 Curves: Port fillet node to the new data-block
This commit ports the fillet curves node to the new curves data-block,
and moves the fillet node implementation to the geometry module to help
separate the implementation from the node.

The changes are similar to the subdivide node or resample node. I've
resused common utilities where it makes sense, though some things like
the iteration over attributes can be generalized further. The node
is now multi-threaded per-curve and inside each curve, and some buffers
are reused per curve to avoid many allocations.

The code is more explicit now, and though there is more boilerplate to
pass around many spans, the more complex logic should be more readable.

Differential Revision: https://developer.blender.org/D15346
2022-07-19 18:50:27 -05:00
5d6e4822d8 Cleanup: Combine geometry null checks in if statements
Testing if components or virtual arrays are null in the same line they
are retrieved can make this boilerplate code a bit easier to read.
2022-07-19 18:29:23 -05:00
40ffb94ab4 Cleanup: Use generic utility for copying compressed attribute
In the future, `materialize_compressed_to_uninitialized_threaded`
could be moved somewhere else and reused.
2022-07-19 18:16:12 -05:00
410a6efb74 Point Cloud: Remove redundant custom data pointers
Similar to e9f82d3dc7, but for point clouds instead.

Differential Revision: https://developer.blender.org/D15487
2022-07-19 18:06:56 -05:00
e9f82d3dc7 Curves: Remove redundant custom data pointers
These mutable pointers present problems with ownership in relation to
proper copy-on-write for attributes. The simplest solution is to just
remove them and retrieve the layers from  `CustomData` when they are
needed. This also removes the complexity and redundancy of having to
update the pointers as the curves change. A similar change will apply
to meshes and point clouds.

One downside of this change is that it makes random access with RNA
slower. However, it's simple to just use the RNA attribute API instead,
which is unaffected. In this patch I updated Cycles to do that. With
the future attribute CoW changes, this generic approach makes sense
because Cycles can just request ownership of the existing arrays.

Differential Revision: https://developer.blender.org/D15486
2022-07-19 18:01:04 -05:00
Pratik Borhade
28985ccc05 Fix T99583: Missing update for option in particle edit mode
Missing Ui refresh when property is accessed through shortcut.
Use RNA_def_property_update to solve this.

Differential Revision: https://developer.blender.org/D15431
2022-07-19 14:20:44 -05:00
43d04c7eeb UI Code Quality: Move eyedropper files to own folder
Part of T98518
2022-07-19 19:33:38 +02:00
Tomek Gubala
3b7ac10d62 UV: add Snap Cursor to Origin
Similar to snapping to the world origin in the 3D viewport. This can be found
in the Shift+S pie menu and UV > Snap menu.

Differential Revision: https://developer.blender.org/D15055
2022-07-19 19:29:03 +02:00
75e62df429 Cleanup: compiler warning 2022-07-19 19:22:13 +02:00
cd478fbfb3 Fix error printed in console when running Shade Flat operator
Only the Shade Smooth operator has autosmooth settings.
2022-07-19 19:22:13 +02:00
edc89c7f46 Fix build error when not using unity build 2022-07-19 19:22:13 +02:00
d14c2d549b Fix T99643: Vertex Crease fails with symmetry
Create a transform conversion type that only considers the Vertex
Custom Data.

This reduces the complexity of converting Meshes and slightly
optimizes the transformation.
2022-07-19 14:13:00 -03:00
597955d0a8 Cleanup: Remove compile option for curves object
After becb1530b1 the new curves object type isn't hidden
behind an experimental flag anymore, and other areas depend on this,
so disabling curves at compile time doesn't make sense anymore.
2022-07-19 12:10:45 -05:00
16b145bc62 Cleanup: Improve API and documentation of interface_view.cc
File documentation was outdated and could use general improvement.
Function names didn't really reflect the level they are operating on.
2022-07-19 18:04:03 +02:00
fb9dc810f1 UI Code Quality: Move view related files to own folder
Part of T98518.
2022-07-19 18:04:03 +02:00
Amélie Fondevilla
801513efa0 Fix T99732: Crash on F3 in the dopesheet
Adding the `FCURVESONLY` filter in the filter function of the Grease
Pencil dopesheet prevents calls to F-curves related functions to grease
pencil channels, thereby fixing the crash.

Reviewed By: antoniov, sybren

Maniphest Tasks: T99732

Differential Revision: https://developer.blender.org/D15490
2022-07-19 17:49:10 +02:00
87ae10a050 Curves: Hide snapping menu in curves sculpt mode
The menu/popover doesn't affect anything in the mode, and precision
operations that would use snapping are meant for edit mode anyway.
2022-07-19 10:45:01 -05:00
35b4e3a350 RNA: Don't allocate empty char pointer properties
Instead of allocating a single 0 char, set the `char *` DNA pointer to
null. This avoids the overhead of allocating and copying single-bytes.

rBeed45b655c9f didn't do this for safety reasons, but I checked the
existing uses of this behavior in DNA/RNA. Out of 43 total `char *`
members, this change only affects 7 recently added properties.
For a complete list, see the patch description.

Differential Revision: https://developer.blender.org/D14779
2022-07-19 10:30:19 -05:00
c771dd5e9c Depsgraph: Make animated properties API receive const ID
Semantically it is more correct as the cache does not modify the ID.

There is need to do couple of const casts since the BKE (which is in C)
does not easily allow to iterate into f-curves of const ID.

Should be no functional changes.
2022-07-19 17:22:53 +02:00
6a1ab4747b Geometry Nodes: Copy parameters when copying a curves data-block
Previously, things like materials, symmetry, and selection options
stored on `Curves` weren't copied to the result in nodes like the
subdivide and resample nodes. Now they are, which fixes some
unexpected behavior and allows visualization of the sculpt mode
selection.

In the realize instances and join nodes the behavior is the same as
for meshes, the parameters are taken from the first (top) input.

I also refactored some functions to return a `CurvesGeometry` by-value,
which makes it the responsibility of the node to copy the parameters.
That should make the algorithms more reusable in other situations.

Differential Revision: https://developer.blender.org/D15408
2022-07-19 10:16:30 -05:00
9246ff373a Metal: Add license header to new files 2022-07-19 17:14:39 +02:00
Jason Fielder
9835d5e58b Metal: MTLUniformBuffer module implementation
Initial implementation.

Authored by Apple: Michael Parkin-White
Ref T96261

Reviewed By: fclem
Differential Revision: https://developer.blender.org/D15357
2022-07-19 17:12:39 +02:00
Jason Fielder
6bba4d864e Metal: MTLQueryPool implementation adding support for occlusion queries.
When a query begins, the current visibility result buffer needs to be
associated with the currently active Render Pass. The MTLContext and
MTLCommandBuffer are responsible for ensuring new render pass objects are
created if the visibility state changes.

Authored by Apple: Michael Parkin-White
Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D15356
2022-07-19 17:02:15 +02:00
3370c1a8a7 Cleanup: Add comment for geometry nodes lazyness 2022-07-19 09:54:20 -05:00
ad5e3d30a2 Nishita sky: Increase elevation range
The Nishita sky texture currently only allows moving the sun to the zenith.
The problem is if you want to animate the passing of a full night-day-night
cycle. Currently it's not easy to do due to this limitation.

The patch makes it so users can easily animate the sun moving from sunrise
to sunset by expanding the max sun elevation to go 360° instead of 90°.

Reviewed By: fclem
Differential Revision: https://developer.blender.org/D13724
2022-07-19 16:36:57 +02:00
2e3fb58128 Cleanup: Apply clang-format 2022-07-19 16:33:09 +02:00
5bee991132 UI: Port view item features to base class, merge view item button types
No user visible changes expected.

Merges the tree row and grid tile button types, which were mostly doing
the same things. The idea is that there is a button type for
highlighting, as well as supporting general view item features (e.g.
renaming, drag/drop, etc.). So instead there is a view item button type
now. Also ports view item features like renaming, custom context menus,
drag controllers and drop controllers to `ui::AbstractViewItem` (the new
base class for all view items).

This should be quite an improvement because:
- Merges code that was duplicated over view items.
- Mentioned features (renaming, drag & drop, ...) are much easier to
  implement in new view types now. Most of it comes "for free".
- Further features will immediately become availalbe to all views (e.g.
  selection).
- Simplifies APIs, there don't have to be functions for individual view
  item types anymore.
- View item classes are split and thus less overwhelming visually.
- View item buttons now share all code (drawing, handling, etc.)
- We're soon running out of available button types, this commit merges
  two into one.

I was hoping I could do this in multiple smaller commits, but things
were quite intertwined so that would've taken quite some effort.
2022-07-19 16:31:23 +02:00
348ec37f52 UI: Add AbstractViewItem base class
No user visible changes expected.

Similar to rBc355be6faeac, but for view items now instead of the view.
Not much of the item code is ported to use it yet, it's actually a bit
tricky for the most part. But just introducing the base class already
allows me to start unifying the view item buttons (`uiButTreeRow` and
`uiButGridTile`). This would be a nice improvement.
2022-07-19 16:31:23 +02:00
Colin Basnett
2f834bfc14 Fix T97559: Undoing of NLA strip duplication requires two undo steps
Fix the issue where undoing a "duplicate NLA strip" operation would
require two undo steps.

The cause of this was that the operator was not using the operator macro
system to combine both the duplication and the translate operators into
one. Instead, the old code was simply manually invoking invoking the
translate operator after the duplicate operator had completed.

This patch requires the default keymap to be modified to include the two
new macro operators, `NLA_OT_duplicate_move` and
`NLA_OT_duplicate_linked_move` in favour of the old keymap that simply
called `NLA_OT_duplicate` and passed along a `linked` argument.

`duplicate_move` and `duplicate_move_linked` are two different enough
operations to justify having their own operators from user's
point-of-view, especially since we cannot yet have different tool-tips
based on an operator's settings.

Reviewed By: sybren, mont29

Differential Revision: https://developer.blender.org/D15086
2022-07-19 16:07:30 +02:00
Colin Basnett
4812eda3c5 Animation RNA: Add clear() method to FCurveKeyframePoints
Add `FCurveKeyframePoints.clear()` method to delete all keyframe points
from an FCurve.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D15283
2022-07-19 15:58:37 +02:00
2232855b50 Curves: align surface and curves object in Empty Hair operator
Without this, symmetry does not work by default when the surface
object was not at the same location as the 3d cursor.
2022-07-19 15:49:45 +02:00
95fd7c3679 Depsgraph: Cleanup, Make variable less ambiguous and more clear 2022-07-19 15:27:20 +02:00
bc6b612d8b Depsgraph: Make variable naming more clear
Disambiguate from nodes visibility flags.
2022-07-19 15:25:49 +02:00
Ethan-Hall
44f1495b57 EEVEE: use mipmaps of compressed textures (DDS)
Currently Blender generates mipmaps that override the existing ones.
This patch disables generating new mipmaps for compressed textures.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D14459
2022-07-19 15:20:53 +02:00
e8465f941c Depsgraph: Cleanup, use nested namespace definition 2022-07-19 14:44:07 +02:00
835203fde8 Depsgraph: Localize synchronization component visibility handling
Move it from generic visibility handling to the synchronization
component node implementation. Should be no functional changes.
2022-07-19 14:36:36 +02:00
73f8a7ca0a Depsgraph: Cleanup, comments wrapping and spacing between lines
Should make it easier to read. No functional changes expected.
2022-07-19 14:25:02 +02:00
6d2100f7de Depsgraph: Introduce operation code for visibility operation
No functional changes, just makes code more semantically clear.
2022-07-19 13:00:19 +02:00
99faebfca6 Depsgraph: Cleanup, don't mic static function and anonymous namespace 2022-07-19 12:51:24 +02:00
2280a71f90 Depsgraph: Refactor evaluation into smaller reusable functions
Should be no functional changes.
2022-07-19 12:41:47 +02:00
9b2b61a07b Depsgraph: Cleanup, use nested namespace definition 2022-07-19 11:40:18 +02:00
d3c063188e Depsgraph: Make name and name tag optional in component node
Matches the builder API, making some code less verbose.
2022-07-19 11:31:44 +02:00
ff98b5eaa8 Depsgraph: Clarify comment in the component node 2022-07-19 11:29:00 +02:00
e00a027c1e Depsgraph: Use single task pool during evaluation
Not sure why multiple pools were created: the pool should be able to
handle two sets of tasks.

Perhaps non-measurable improvement in terms of performance but this
change simplifies code a bit.
2022-07-19 11:18:30 +02:00
533a5a6a8c Fix T99785: Make Principled Hair IOR input behave like other IOR sliders
Was accidental regression in rBed9b21098dd27bf9364397357f89b4c2648f40c2

Remove the input slider's PROP_FACTOR subtype in favor of the default to
align with other IOR sliders. This provides much better control when
dragging the value with the mouse.

Differential Revision: https://developer.blender.org/D15477
2022-07-18 20:38:19 -07:00
bbf87c4f75 Fix T99737: Dropping files fails with Wayland
Drop events ignored the cursor coordinates, under the assumption that
cursor motion events would also be sent to update the cursor location.

This depended on the behavior of the compositor, it failed for Sway
but worked for Gnome-shell & River.

Resolve by making use of the drop events cursor coordinates.
2022-07-19 13:33:02 +10:00
7ebd1f4b79 Cleanup: quiet compiler warnings 2022-07-19 13:32:53 +10:00
37922eab90 Fix T99794: regression from uv unwrap selected
Restore only_selected_faces flag inadvertently changed by c0e4532331

Differential Revision: https://developer.blender.org/D15480
2022-07-19 13:26:24 +12:00
135e530356 Fix T99781: uv minimize stretch now unflips flipped faces
Add a small gradient to flipped faces proportional to length of edges.

Differential Revision: https://developer.blender.org/D15475
2022-07-19 10:26:28 +12:00
Henrik Dick
d175eb6c30 Fix Text Editor highlight of assert and async
Due to the ordering of the checks, assert and async were not highlighted
in the editor, even though they were in the list of keywords.

Differential Revision: http://developer.blender.org/D15483
2022-07-18 23:33:30 +02:00
8358cc7963 Fix wrong alpha for scene linear byte images during texture painting
Make the update logic consistent with the case where the initial texture is
created. Also fixes a wrong assert.

Thanks Clément for spotting this.
2022-07-18 17:40:48 +02:00
cd21022b78 Context: implement an active_action property that returns a single action.
Although e.g. in the dopesheet there is no specific concept of
active action, displaying panels requires singling out one action
reference. It is more efficient and clearer to implement this
natively in the context rather than using selected_visible_actions[0].

- In the Action Editor the action is taken from the header.
- In the Dope Sheet the first selected action is chosen, because
  there is no concept of an active channel or keyframe.
- In the Graph Editor the action associated with the active curve
  is used, which should also be associated with the active vertex.
  This case may be different from selected_visible_actions[0].

Differential Revision: https://developer.blender.org/D15412
2022-07-18 17:44:46 +03:00
935b7a6f65 Context: implement indexing for list properties in path_resolve.
The real RNA path_resolve method supports indexing lists,
but the python version on the Context object does not. This
patch adds the missing feature for completeness.

Differential Revision: https://developer.blender.org/D15413
2022-07-18 17:38:00 +03:00
1f8567ac68 Fix T99750: crash with file output node, after image colorspace saving changes 2022-07-18 15:50:39 +02:00
757041560f Build: update Embree to 3.13.4, enable Neon2x on Arm
* Allows Apple Silicon machines to use 8-wide BVH, which the release notes
  mention give an 8% performance boost.
* An update to this version is also required for OpenPGL.

This patch includes contributions from Jason Fielder and Sebastian Herholz.

Ref D15286, T98555

Differential Revision: https://developer.blender.org/D15482
2022-07-18 15:36:34 +02:00
3407ed5f9b Cleanup: change internal Cycles compact BVH default to match UI 2022-07-18 15:34:13 +02:00
Damien Picard
dec8854bf3 I18n: translate add node operator tooltips
The tooltips from the Add Node menu were extracted, but not translated.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15467
2022-07-18 15:10:08 +02:00
Jun Mizutani
47f3b53756 Fix T99742: crash when generating rigify rigs, after recent changes
Differential Revision: https://developer.blender.org/D15473
2022-07-18 14:47:48 +02:00
c7f788b877 Subdiv: remove unused GPU device choice, fix crash with libepoxy on init
openSubdiv_init() would detect available evaluators before any OpenGL context
exists, causing a crash with libepoxy. This test however is redundant as we
already check the requirements on the Blender side through the GPU API.

To simplify things, completely remove the device detection in the opensubdiv
module and reduce the evaluators to just CPU and GPU. The plan here is to move
to the GPU module abstraction over OpenGL/Metal/Vulkan and so all these
different backends no longer make sense.

This also removes the user preference for OpenSubdiv compute device, which was
not used for the new GPU subdivision implementation.

Ref D15291

Differential Revision: https://developer.blender.org/D15470
2022-07-18 13:59:08 +02:00
3c016fbfd0 Fix error indenting new-lines in generated RST API docs
New-lines in RNA type descriptions caused invalid RST indentation.

This resolve the error noted by @nutti in D15481.
2022-07-18 20:00:21 +10:00
cd1e4ae448 Fix T99644: Anchored brush mode fails for negative brushes
The stroke code now supports raycasting the original mesh.
This fixes anchored mode not working for negative brushes,
which might move the mesh out of the initial mouse cursor
position.
2022-07-16 17:27:25 -07:00
9a14887905 Sculpt: Fix scene spacing mode (phase 1)
The scene spacing code was failing to
check if a raycast failed, which can happen
when sculpting the edges of objects in negative
mode.

Note I removed what I suspect was a hack put
in to fix this, spacing was clamped
to 0.001 scene units.

Scene spacing mode is actually quite broken,
so it will be fixed in a series of phases.
2022-07-16 16:45:41 -07:00
d136a996ca Audaspace: minor formatting fix for last commit. 2022-07-16 22:20:08 +02:00
Colin Basnett
1e4c557d82 Fix T99039: bpy.ops.sound.mixdown returns indecipherable error
Fix for {T99039}.

The problem was that `AUD_mixdown` and `AUD_mixdown_per_channel` were returning pointers to freed memory.

Two key changes are made:
1. The return value of those functions now simply return a bool as to whether the operation succeeded, instead of an optional error string pointer.
2. The error string buffer is now passed into the function to be filled in case an error occurs. In this way, the onus of memory ownership is unamibiguously on the caller.

Differential Revision: https://developer.blender.org/D15260
2022-07-16 22:14:19 +02:00
0a8d21e0c9 PyAPI: re-enable the "bgl" module for headless builds
Instead of removing the `bgl` module, set all it's functions to stubs
so importing `bgl` or any of it's members doesn't raise an error.

This avoids problems for scripts that import bgl but don't call it's
functions when running in background mode.
2022-07-16 17:30:17 +10:00
49babc7caa Cleanup: early exit MEM_lockfree_freeN when called with NULL pointer
Simplify logic for freeing a NULL pointer. While no null-pointer
de-reference was performed, this wasn't as so obvious as the pointer
was passed to MEM_lockfree_allocN_len before checking for NULL.

NOTE: T99744 claimed the a NULL pointer free was a vulnerability,
while I can't see evidence for this - exiting early makes it clearer
the memory isn't accessed.

*Details*

- Add MEMHEAD_LEN macro, avoids redundant NULL check.
- Use "UNLIKELY(..)" hint's for error cases
  (freeing NULL pointer and checking if `leak_detector_has_run`).
2022-07-16 17:23:42 +10:00
f76b537d48 Fix T99744: NULL pointer free with corrupt zSTD reading 2022-07-16 16:32:36 +10:00
bf49e6040c Fix error in assertion after 92a99c1496 2022-07-16 16:12:48 +10:00
b985437283 Fix workbench background render broken after recent changes from D15463
For Eevee the light baking can initialize OpenGL earlier, but for workbench we
can't assume the backend exists here already.
2022-07-15 20:10:42 +02:00
92a99c1496 Fix Eevee backround render crash after recent changes from D15463
Backend initialization needs to be delayed until after the OpenGL context
is created. This worked fine in foreground mode because the OpenGL context
already exists for the window at the point GPU_backend_init_once was called,
but not for background mode.

Create the backend just in time in GPU_context_create as before, and
automatically free it when the last context id discarded. But check if any
GPU backend is supported before creating the OpenGL context.

Ref D15463, D15465
2022-07-15 19:11:07 +02:00
5152c7c152 Cycles: refactor rays to have start and end distance, fix precision issues
For transparency, volume and light intersection rays, adjust these distances
rather than the ray start position. This way we increment the start distance
by the smallest possible float increment to avoid self intersections, and be
sure it works as the distance compared to be will be exactly the same as
before, due to the ray start position and direction remaining the same.

Fix T98764, T96537, hair ray tracing precision issues.

Differential Revision: https://developer.blender.org/D15455
2022-07-15 18:46:24 +02:00
bb376da6df Fix Cycles MetalRT error after recent specialization changes 2022-07-15 18:28:13 +02:00
03aeef64d5 Cleanup: compiler warnings 2022-07-15 16:57:04 +02:00
c505f19efe Fix compiler error in debug builds after 1cf465bbc3 2022-07-15 16:52:01 +02:00
1cf465bbc3 Fix GPU backend deleting resources without an active context
This causes an assert with libepoxy, but was wrong already regardless.

Refactor logic to work as follows:
* GPU_exit() deletes backend resources
* Destroy UI GPU resources with the context active
* Call GPU_backend_exit() after deleting the context

Ref D15291

Differential Revision: https://developer.blender.org/D15465
2022-07-15 16:31:28 +02:00
5e1229f253 Fix overly noisy surface deform warning message
An increased number of vertices is not a stopper for the surface
deform modifier anymore. It might still be useful to expose the
message in the UI, but printing error message to the console on
every modifier evaluation makes real errors to become almost
invisible.

Differential Revision: https://developer.blender.org/D15468
2022-07-15 16:30:11 +02:00
82f65d8971 Cleanup: VSE waveform drawing
No functional changes.
2022-07-15 15:52:37 +02:00
011d3c75a7 Cleanup: compiler warning 2022-07-15 15:20:53 +02:00
00dc747702 Fix T99706: Crash rendering with headless builds
When rendering with headless builds, show an error instead of crashing.

Previously GPU_backend_init was called indirectly from
DRW_opengl_context_create, a new function is now called from the window
manager (GPU_backend_init_once), so it's possible to check if the GPU
has a back-end.

This also disables the `bgl` Python module when building WITH_HEADLESS.

Reviewed By: fclem

Ref D15463
2022-07-15 22:16:44 +10:00
Damien Picard
180db0f752 UI: make many modifier strings translatable
This includes:
- new modifier names

It mostly uses `N_` because the strings are actually translated elsewhere.
The goal is simply to export them to .po files.

Most of the new translations were reported in T43295#1105335.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15418
2022-07-15 14:15:40 +02:00
914617f8fd Fix (unreported) LibOverride: invalid behaviors when creating (partial) overrides.
The outliner would tagg all existing local IDs (for remap from linked
reference data to newly created overrides) when creating a new override.
This would become critical issue in case there is several existing
copies of the same override hierarchy (leading to several hierarchies
using the same override).

Further more, BKE override creation code would not systematically
properly remapp linked usages to new overrides one whithin the affected
override hierarchy, leading to potential undesired remaining usages of
linked data.
2022-07-15 14:15:40 +02:00
523bbf7065 Cycles: generalize shader sorting / locality heuristic to all GPU devices
This was added for Metal, but also gives good results with CUDA and OptiX.
Also enable it for future Apple GPUs instead of only M1 and M2, since this has
been shown to help across multiple GPUs so the better bet seems to enable
rather than disable it.

Also moves some of the logic outside of the Metal device code, and always
enables the code in the kernel since other devices don't do dynamic compile.

Time per sample with OptiX + RTX A6000:
                                         new                  old
barbershop_interior                      0.0730s              0.0727s
bmw27                                    0.0047s              0.0053s
classroom                                0.0428s              0.0464s
fishy_cat                                0.0102s              0.0108s
junkshop                                 0.0366s              0.0395s
koro                                     0.0567s              0.0578s
monster                                  0.0206s              0.0223s
pabellon                                 0.0158s              0.0174s
sponza                                   0.0088s              0.0100s
spring                                   0.1267s              0.1280s
victor                                   0.0524s              0.0531s
wdas_cloud                               0.0817s              0.0816s

Ref D15331, T87836
2022-07-15 13:42:47 +02:00
da4ef05e4d Cycles: Apple Silicon optimization to specialize intersection kernels
The Metal backend now compiles and caches a second set of kernels which are
optimized for scene contents, enabled for Apple Silicon.

The implementation supports doing this both for intersection and shading
kernels. However this is currently only enabled for intersection kernels that
are quick to compile, and already give a good speedup. Enabling this for
shading kernels would be faster still, however this also causes a long wait
times and would need a good user interface to control this.

M1 Max samples per minute (macOS 13.0):

                    PSO_GENERIC  PSO_SPECIALIZED_INTERSECT  PSO_SPECIALIZED_SHADE

barbershop_interior       83.4	            89.5                   93.7
bmw27                   1486.1	          1671.0                 1825.8
classroom                175.2	           196.8                  206.3
fishy_cat                674.2	           704.3                  719.3
junkshop                 205.4	           212.0                  257.7
koro                     310.1	           336.1                  342.8
monster                  376.7	           418.6                  424.1
pabellon                 273.5	           325.4                  339.8
sponza                   830.6	           929.6                 1142.4
victor                    86.7              96.4                   96.3
wdas_cloud               111.8	           112.7                  183.1

Code contributed by Jason Fielder, Morteza Mostajabodaveh and Michael Jones

Differential Revision: https://developer.blender.org/D14645
2022-07-15 13:40:04 +02:00
5653c5fcdd Cycles: keep track of SVM nodes used in kernels
To be used for specialization in Metal, to automatically leave out unused nodes
from the kernel.

Ref D14645
2022-07-15 13:40:04 +02:00
79da7f2a8f Cycles: refactor to move part of KernelData definition to template header
To be used for specialization on Metal in a following commit, turning these
members into compile time constants.

Ref D14645
2022-07-15 13:40:04 +02:00
Damien Picard
2e70d5cb98 Render: camera depth of field support for armature bone targets
This is useful when using an armature as a camera rig, to avoid creating and
targetting an empty object.

Differential Revision: https://developer.blender.org/D7012
2022-07-15 13:40:04 +02:00
5ddbc14bb2 Render: improve render border operator in image editor
* Snap border to pixels just outside the drawn border, to more easily select
  specific pixels by drawing a border inside them.
* Support cropped border renders.
2022-07-15 13:40:04 +02:00
9ea1b88f0f Cleanup: add utlity function to compute render resolution
Instead of duplicating logic many times.
2022-07-15 13:40:04 +02:00
b8ffd43bd2 Cleanup: make format 2022-07-15 13:40:04 +02:00
4d7c990180 Fix T98061: uv resize with individual origins could break constrain to bounds
Fix unreported: Resize with Constrain To Bounds will now limit one shared scale
value for both U and V instead of calculating separate scale values for each.

To fix T98061, the individual origins (transdata->center) is now used when
that mode is active.

See also: 0e9367fc29

Differential Revision: https://developer.blender.org/D15420
2022-07-15 23:18:13 +12:00
e69c4482f1 I18n: Add suport for labels from modifiers' subpanels.
Was a bit oif a struggle since those functions take a first string which
is not our label, but should work fine now.

Reported/detected as part of D15418.
2022-07-15 11:42:58 +02:00
Martijn Versteegh
8e1323f633 Fix: Move DRW_shgroup_add_material_resources(grp, mat) to after the null-check for grp.
Reviewed By: fclem

Maniphest Tasks: T99646

Differential Revision: https://developer.blender.org/D15436
2022-07-15 11:23:26 +02:00
f4d7ea2cf6 Fix T99606: Regression: TexCoordinate losing precision far away from origin
Same root cause as T99128. The fix also needed to be done in another place.
2022-07-15 11:16:14 +02:00
98f688ac42 GPU: Fix shader builder on hardware that does not have all features 2022-07-15 11:16:14 +02:00
862170c0b1 Cleanup: GPU: Replace NULL by nullptr from C++ files 2022-07-15 11:16:14 +02:00
ca1daf4cda Fix an increasing bottleneck when key press operator is too slow
The goal of this change is to fix an increasing bottleneck of the event
queue handling when there is an operator bound to a key press event and
is taking longer to finish than a key-repeat speed on the system.

Practical example of when it happens is the marker tracking operator in
a single-frame track mode. Quite often artists will hold down Alt-arrow
to track a segment of footage which seems trivial to track. The issue
arises when the Alt-arrow is released: prior to this change it is was
possible that more frames will be tracked. It also seems that redraws
are less smooth.

It is a bit hard to make easily shareable computer-independent test
case. Instead, a synthetic case can be reproduced by adding a 50 ms
sleep in the `text_move_exec()`. In such synthetic case open a long
text in the text editor and hold left/right arrow button to navigate
the cursor. The observed behavior is that seemingly redraws happen
less and less often and cursor travels longer and longer distances
between redraws. The cursor will also keep moving after the buttons
has been released.

The proposed solution is to ignore sequential key-press events from
being added to the event queue. This seems to be the least intrusive
and the most safe approach:

- If the operator is fast enough there will be no multiple press events
  in the queue in both prior and after of this change.

- If the operator is slow enough, clicking the button multiple times
  (i.e. clicking arrow button 3 times in a heavy shot will change the
  scene frame by exactly 3 frames because no events are ignored in
  this case).

- Only do it for key press events, keeping mouse and tabled behavior
  unchanged which is crucial for the paint mode.

Note that this is a bit different from the key repeat tracking and
filtering which is already implemented for keymaps as here we only want
to avoid the event queue build-up and do want to ignore all repeat
events. In other words: we do want to handle as many key presses as the
operator performance allows it without clogging anything.

A possible extension to this change could be a key press counter, so
that instead of ignoring the event we merge it into the last event in
the queue, incrementing some counter. This way if some operator really
needs to know exact number of key repeats it can still access it.

Differential Revision: https://developer.blender.org/D15444
2022-07-15 11:03:00 +02:00
c2715dc416 GPU: Remove USD dependency from shader_builder.
Dependency was added as shader builder depended to blenkernel as an
umbrella, in stead of adding the actual dependencies it required.
2022-07-15 10:54:10 +02:00
63ea0f7581 BLI_bitmap: fix _BITMAP_NUM_BLOCKS to not over-count by one block
For bit counts that were exact multiple of block size, the macro was
computing one block too much.

Reviewed By: Campbell Barton, Bastien Montagne
Differential Revision: https://developer.blender.org/D15454
2022-07-15 10:21:27 +03:00
8fd2b79ca1 BLI_bitmap: ability to declare by-value, and function to find lowest unset bit
In preparation for a larger change (D14162), some BLI_bitmap
functionality that could be submitted separately:

- Ability to declare a fixed size bitmap by-value, without extra
  memory allocation: BLI_BITMAP_DECLARE
- Function to find the index of lowest unset bit:
  BLI_bitmap_find_first_unset
- Test coverage of the above.

Reviewed By: Campbell Barton, Bastien Montagne
Differential Revision: https://developer.blender.org/D15454
2022-07-15 10:20:04 +03:00
d8094f9212 GHOST/Wayland: partial support for updating the UI scale
Partial support for changing the UI scale while Blender is open.

The scale is set but issues with the window size not updating remain.
2022-07-15 15:42:24 +10:00
60f260eb6a GHOST/Wayland: fix error setting the cursor scale
Calculate a scale that's compatible with the cursor size.
Needed so the cursor is always a multiple of scale.
2022-07-15 15:36:21 +10:00
d14d570580 blend_render_info: add check for negative BHead length (corrupt file)
Without this check, corrupt files would raise a Python exception,
now early exit with a useful error.
2022-07-15 14:53:38 +10:00
c8e8f107bf Fix T99711: Eternal loop reading blend file thumbnail
Account for negative BHead length (already handled by blend file loading).
2022-07-15 14:53:38 +10:00
675f6ef089 Cleanup: Use const pointers for ImageSaveOptions and ImageFormatData
Use const pointers to ImageSaveOptions and ImageFormatData for API
parameters where appropriate.

Differential Revision: https://developer.blender.org/D15400
2022-07-14 21:27:58 -07:00
178868cf42 Fix T79304: improve uv island calculation when in edge selection mode
Differential Revision: https://developer.blender.org/D15419
2022-07-15 14:19:48 +12:00
0e9367fc29 Cleanup: separate clipUVTransform into two different functions
No functional changes.

Prep for D15420 / T98061.
2022-07-15 10:44:11 +12:00
b1329d7eaa Fix T99705: fix integer overflow in thumbnail extractor
It was smart enough to check if the buffer had the right
size but neglected to cast to a 64 bit value so it
overflowed.

Differential Revision: https://developer.blender.org/D15457
Reviewed By: brecht
2022-07-14 12:18:35 -06:00
9fedcde750 Modifiers: fix mesh to volume modifier on non-volume objects 2022-07-14 20:05:23 +02:00
bdd0ac5bce Fix on_drag_start handler not getting ID when dragging from Outliner
We would first invoke the dragging, and then set the drag data (like the
ID or the dragged modifier), so the `wmDropBox.on_drag_start()` handler
wouldn't be able to access this. This broke dragging some IDs from the
Outliner, noticed in D15333.

It's now possible to first create/request drag data, extend it, and then
invoke the actual dragging. The normal function to start dragging
returns `void` now instead of `wmDrag *`, so the drag data can't easily
be modified after starting anymore.
2022-07-14 19:21:56 +02:00
1ef686bd26 UI: Tweak layout of File Browser Preferences
* Don't nest "Show Recent Locations" and "Show System Locations" under a
  "Defaults" heading. They are not just a default setting but completely
  hide panels from the UI.
* Use own "Show Locations" heading instead, and remove redundant words
  from labels.
* Move the options to the top of the panel, they are more general since
  they can't be toggled in a File Browser session, and thus have bigger
  impact.

We may want to remove these options in a future major release, I don't
think they are useful.

Agreed on with Pablo Vazquez.
2022-07-14 19:21:22 +02:00
b6de6da59a I18n: Fix regex for messages from BKE_modifier_set_error.
Signature of this function changed at some point, regex to extract
messages from it was no longer working.

Reported/detected as part of D15418.
2022-07-14 18:50:16 +02:00
3b15467e97 Fix T99702: Gpencil Flip strokes did not support multiframe edit
This was a missing feature and this commit solves this.
2022-07-14 16:42:26 +02:00
Olivier Maury
1b5db02a02 Fix Cycles MNEE wrong results with area light spread
When the solve is successful, the light sample needs to be updated since the
effective shading point is now on the last refractive interface. Spread was
not taken into account, creating false caustics.

Differential Revision: https://developer.blender.org/D15449
2022-07-14 16:36:38 +02:00
28c3739a9b Cleanup: replace state flow macros in the kernel with functions 2022-07-14 16:36:38 +02:00
5539fb3121 Cycles: add presets to the Performance panel
With choices Default, Lower Memory and Faster Render. For convenience, and
to help communicate what the various settings do.

Differential Revision: https://developer.blender.org/D15446
2022-07-14 16:36:38 +02:00
02ce29c6ee Improve Tool tip for Add-on search
Differential Revision: https://developer.blender.org/D15411
2022-07-14 16:33:04 +02:00
4b1d315017 Cycles: Improve cache usage on Apple GPUs by chunking active indices
This patch partitions the active indices into chunks prior to sorting by material in order to tradeoff some material coherence for better locality. On Apple Silicon GPUs (particularly higher end M1-family GPUs), we observe overall render time speedups of up to 15%. The partitioning is implemented by repeating the range of `shader_sort_key` for each partition, and encoding a "locator" key which distributes the indices into sorted chunks.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D15331
2022-07-14 14:26:18 +01:00
47d4ce498e Cleanup: minor changes to camera frame fitting
Use const vars & make order of min/max checks consistent.
2022-07-14 22:08:30 +10:00
2d04012e57 Cleanup: spelling in comments
Also remove duplicate comments in bmesh_log.h, caused by automated
comment relocation in [0].

[0]: c4e041da23
2022-07-14 22:02:52 +10:00
9dfabc1de3 Cleanup: remove redundant event->val check for 3D text insertion 2022-07-14 22:01:43 +10:00
93f74299f0 Cleanup: clang-tidy changes to GHOST_SystemX11
Also remove redundant check.
2022-07-14 21:55:46 +10:00
cdd8b96e3b GHOST: remove redundant ascii argument to GHOST_EventKey
Now only the utf8 buffer is used there is no reason to pass both.
2022-07-14 21:54:28 +10:00
eb3e56a36e Fix: Wrong output types for some compositor nodes
The Difference Matte and RGB To BW nodes have a wrong output type. They
should be floats but are of type color.

This is a regression that was introduced during the migration to the
socket builder API in D13266.

Reviewed By: Blendify, fclem

Differential Revision: https://developer.blender.org/D15232
2022-07-14 13:52:44 +02:00
db80cf6ad7 GHOST/X11: avoid redundant utf8 text lookups for release events
The text representation of release events is never used,
so only calculate this for press events.
2022-07-14 21:10:22 +10:00
64e196422e GHOST/X11: Quiet warning about key-release events having their utf8 set
Quiet warning from [0], no functional change as the this information
was always ignored.

Key release events shouldn't have associated text, this was cleared
for wmEvent's, so there is no reason to pass it from GHOST.

[0]: d6fef73ef1
2022-07-14 21:04:16 +10:00
7fa7722350 Cleanup: format, unused argument 2022-07-14 20:53:20 +10:00
6cd30d5ff0 IDManagement: add more ID naming tests
As part of a larger change (https://developer.blender.org/D14162),
adding more test coverage for existing functionality separately.

New tests:
- ids_sorted_by_default
- ids_sorted_by_default_with_libraries
- name_too_long_handling
- create_equivalent_numeric_suffixes
- zero_suffix_is_never_assigned
- remove_after_dup_get_original_name
- name_number_suffix_assignment
- renames_with_duplicates
- names_are_unique_per_id_type
2022-07-14 13:41:43 +03:00
9024ac31be Fix curve drawing crash after changing geometry nodes output.
Using geometry nodes with attributes on a curve object and changing the
output is crashing. This is because the `render_mutex` in the curve
drawing cache is cleared after changes in `curves_batch_cache_init` and
set to null. The cache isn't actually needed currently because all draw
updates are single-threaded, but the new `drw_attributes_merge` function
still tries to access it (this seems to be tolerated on Linux platforms
but crashes on Windows).

Make sure the render_mutex is always initialized after (re-)initializing
the cache.
2022-07-14 11:17:59 +01:00
cb62095c1c Correct error with IME from d6fef73ef1 2022-07-14 20:07:06 +10:00
96cc603037 Geometry Nodes: update curve type counts after realizing instances
The type counts have to be updated eagerly. This was missing from
the realize-instances code before, leading to bugs further down
the line.
2022-07-14 11:49:28 +02:00
c8a07ef663 BLI: fix finding indices from virtual array
The sorting of index vectors assumed that all vectors have
at least one element. Now this is checked for more explicitely.
2022-07-14 11:32:01 +02:00
bcdce4ffd8 Geometry Nodes: fix face corner to edge boolean interpolation
This is a follow up for rB44e530e1b107fd0d91f472f9a58642ab59fd5422
which did not fix the function that interpolates boolean attributes.
2022-07-14 10:47:26 +02:00
44e530e1b1 Geometry Nodes: fix face corner to edge attribute interpolation
Looks like this was wrong all the time.. Luckily, this conversion
is not very common.

Found when testing D15274.
2022-07-14 10:35:59 +02:00
Damien Picard
9d73bbd966 UI: translate tooltips coming from menu descriptions
Many menus get their labels exported to the .po file, but then are not actually translated in the UI.

Before:
{F13283752}

After:
{F13283750}

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15417
2022-07-14 10:29:10 +02:00
Colin Basnett
8e3879ab52 Cleanup: Rename & refactor several F-curve functions
Rename and refactor several F-curve key manipulation functions, and move
them from `editors` to `blenkernel`.

The functions formerly known as `delete_fcurve_key`,
`delete_fcurve_keys`, and `clear_fcurve_keys` have been moved from
`ED_keyframes_edit.h` to `BKE_fcurve.h` and have been renamed according
to hierarchical naming rules.

Below is a table of the naming changes.

| From | To |
| -- | -- |
| `delete_fcurve_key(fcu, index, do_recalc)` | `BKE_fcurve_delete_key(fcu, index)` |
| `delete_fcurve_keys(fcu)` | `BKE_fcurve_delete_keys_selected(fcu)` |
| `clear_fcurve_keys(fcu)` | `BKE_fcurve_delete_keys_all(fcu)` |
| `calchandles_fcurve()` | `BKE_fcurve_handles_recalc()` |
| `calchandles_fcurve_ex()`| `BKE_fcurve_handles_recalc_ex()` |

The function formerly known as `delete_fcurve_key` no longer takes a
`do_fast` parameter, which determined whether or not to call
`calchandles_fcurve`. Now, the responsibility is on the caller to run
the new `BKE_fcurve_handles_recalc` function if they have want to
recalculate the handles.

In addition, there is now a new static private function called
`fcurve_bezt_free` which sets the key count to zero and frees the key
array. This function is now used in couple of instances of functionally
equivalent code. Note that `BKE_fcurve_delete_keys_all` is just a
wrapper around `fcurve_bezt_free`.

This change was initially spurred by the fact that `delete_fcurve_keys`
was improperly named; this was a good opportunity to fix the location
and naming of a few of these functions.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D15282
2022-07-14 10:24:32 +02:00
Iliay Katueshenock
77df9d788a Fix T99239: weird behavior in Field on Domain node 2022-07-14 10:05:24 +02:00
Damien Picard
f48fadc953 UI: translate quick favorites menu operator names
Some operator titles were not translated in the quick favorites menu.

Before:
{F13283724}

After:
{F13283725}

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15416
2022-07-14 10:01:09 +02:00
Damien Picard
1571ee66b5 I18N: Allow translating newly added GP data names, and a missing Surface one. 2022-07-14 10:01:09 +02:00
3935bf255e Fix T99677: crash when convex hull node is used on empty mesh
Fundamental issue is that the attribute api returns none, because
the custom data api returns null for a layer when the size of 0.
This should be improved separately.
2022-07-14 09:57:08 +02:00
411bcf1fe7 Cleanup: simplify 3D text insert, remove checks for ascii escape codes
3D text included checks for escape codes such as \n\r\b which have not
been included in wmEvent.ascii since [0] (2009).

Remove these and use more straightforward logic for overriding the
events text input.

[0] 66437a62a7
2022-07-14 17:04:22 +10:00
b35e33317d Cleanup: update & correct comments for event handling
- Remove references to `ISTEXTINPUT` as any keyboard event with it's
  utf8_buf set can be handled as text input.

- Update references to the key repeat flag.
2022-07-14 16:10:13 +10:00
d6fef73ef1 WM: Remove ASCII members from wmEvent & GHOST_TEventKeyData
The `ascii` member was only kept for historic reason as some platforms
didn't support utf8 when it was first introduced.

Remove the `ascii` struct members since many checks used this as a
fall-back for utf8_buf not being set which isn't needed.
There are a few cases where it's convenient to access the ASCII value
of an event (or nil) so a function has been added to do that.

*Details*

- WM_event_utf8_to_ascii() has been added for the few cases an events
  ASCII value needs to be accessed, this just avoids having to do
  multi-byte character checks in-line.

- RNA Event.ascii remains, using utf8_buf[0] for single byte characters.

- GHOST_TEventKeyData.ascii has been removed.

- To avoid regressions non-ASCII Latin1 characters from GHOST are
  converted into multi-byte UTF8, when building X11 without
  XInput & X_HAVE_UTF8_STRING it seems like could still occur.
2022-07-14 15:59:19 +10:00
816a73891b GHOST/SDL: pass in utf8 buffer for keyboard events
While GHOST/SDL doesn't support non-ASCII text input,
use the UTF8 buffer to be consistent with all other back-ends.

Move the conversion from SDL_KeyboardEvent to ASCII into a function.

Also only lookup this value on key press (not release).
2022-07-14 15:58:46 +10:00
d3374e5337 Fix build and warnings from previous commit. 2022-07-14 16:19:21 +12:00
931779197a Fix T99684: Upgrade Averages Island Scale with options Scale UV and Shear
Differential Revision: https://developer.blender.org/D15421
2022-07-14 15:42:08 +12:00
09a74ff8b6 GHOST/SDL: add support for the key repeat flag
Now all ghost back-ends support the key repeat flag
(accessed as WM_EVENT_IS_REPEAT from wmEvent.flag).
2022-07-14 09:46:58 +10:00
50d832634e Docs: Fix out of order parameters
Fixes T99672
2022-07-13 16:25:57 -04:00
144d9f2b2e Cleanup: Do not use spaces in default data names.
Using white spaces in data names should not be encouraged in general,
better not give wrong example here.

Originally part of D15441.
2022-07-13 17:40:35 +02:00
88fbf0a8fc Fix (studio-reported) bad remapping of libraries.
New remapper code would also fail in some cases when remapping
libraries, similar to the issue yesterday, because ID_LI type had no
mask value.

That would fail to remap `parent` member of a library to NULL when
deleting that parent, leading to a crash e.g. in Outliner tree building
code.

Reported by @JulienKaspar from Blender studio.
2022-07-13 16:11:59 +02:00
ccdf189d3c Documentation: Update Docs for Gizmo
This patch updates the documentation for arguments regarding the `Gizmo`
type.

- Corrected `select_id` doc for draw_preset_ functions. `-1` indicates
  that no selection ID is to be written, but previous docs incorrectly
  specified `0` instead.
- Added missing doc for `target` argument for `target_set_handler`
  function.

Reviewed by: Aaron Carlisle (Blendify)

Differential Revision: https://developer.blender.org/D14834
2022-07-13 08:43:57 -04:00
441dd08dba Expose option for fallback tools keymap in GizmoGroup type
This patch allows new GizmoGroup classes to support tool fallback keymap.

With this patch, when new gizmo groups add `'TOOL_FALLBACK_KEYMAP'` to
its `bl_options`, the fallback tools are added to the group. This
allows a `WorkSpaceTool` (for example) to have selection be a fallback
tool if the user LeftMouse drags away from other gizmos in the group.

Reviewed by: Campbell Barton (campbellbarton)

Differential Revision: https://developer.blender.org/D15154
2022-07-13 08:30:40 -04:00
c484599687 Expose snap options in transform operators
This commit exposes snap options in transform operators. These options
are needed for Python tools to control snapping without requiring the
tool settings to be adjusted.

The newly exposed options are:

- `snap_elements` for choosing which element(s) of target the source
  geometry should snap to (ex: Face Raycast).
- `use_snap_self`, `use_snap_edit`, `use_snap_nonedit`,
  `use_snap_selectable_only` for controlling target selection.
- `use_snap_project` for controlling Face Raycast snapping.
- `use_snap_to_same_target` and `snap_face_nearest_steps` for
  controlling Face Nearest snapping.

Reviewed by: Campbell Barton (campbellbarton)

Differential Revision: https://developer.blender.org/D15398
2022-07-13 07:10:09 -04:00
c8be3d3b27 Fix T99654: Applying Mirror modifier breaks the erase tool
The problem was the new generated strokes were copied from original and the location was offset to mirror, but the internal geometry data was not updated and the collision check done by brushes was not working.

Now, the internal geometry data is recalculated when the modifier is applied.
2022-07-13 12:56:48 +02:00
74888cdbfd Fix (studio-reported) issue in remapping code.
Not clearing runtime remapping data for the new ID as well as the old
one can lead to false stale data there, wichi could e.g. make indirectly
linked data be tagged as directly linked.

This would generate an error report on file write when hapening on
ShapeKey ID, since that type is not allowed to be directly linked.
2022-07-13 11:15:19 +02:00
a084839605 Cleanup: logical order of axis defines, assign variables for readability 2022-07-13 16:42:06 +10:00
b3913d7551 Cleanup: use defines for camera axes for view frame fitting
The values used for axes weren't in any meaningful order, use defines
to improve readability.
2022-07-13 16:18:16 +10:00
9422627155 Fix T99653: "Align Active Camera to Selected" fails with ortho camera
There were two bugs, a regression in [0] and the object-data wasn't
tagged for depsgraph updating.

[0]: 19df0e3cfd
2022-07-13 16:18:14 +10:00
8f543a73ab Fix T99659: Improve UV Island calculation with hidden faces.
Simplify interface, regularize implementation and some light cleanup.

See also: T79304 and D15419.
2022-07-13 11:42:42 +12:00
d0a552b5c6 Fix: set dangling pointer to null
The data has been moved somewhere else, the span should not
keep a pointer to it.
2022-07-12 18:47:51 +02:00
5f09440d5a Cycles: Make not-compact BVH the default for embree
Measurements shown on average a 1.08x speedup for a 1.04x increase in
memory usage which is an acceptable trade off for a default setting,
although discoverability of such settings influencing memory usage could
be improved.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D15429
2022-07-12 18:40:14 +02:00
9f153949f9 Enable "copy to selected" for new Curves modifiers
The operator bpy.ops.object.modifier_copy_to_selected()
does not work for the new Curves objects.
This is because it isn't added to BKE_object_supports_modifiers.

Differential Revision: https://developer.blender.org/D15439
2022-07-12 18:31:33 +02:00
1c382a4940 Curves: improve error checking in deform curves on surface node 2022-07-12 17:10:23 +02:00
02aefa7659 Fix: wrong node name in menu 2022-07-12 17:10:23 +02:00
b767628173 Fix: Memory leaks in indexer code
Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D15376
2022-07-12 16:58:04 +02:00
Khoi Dau
93253d5dcc Fix T99103: crash when displaying or rendering Grease Pencil object
On some hardware/systems, blender may crash when adding, rendering or displaying Grease Pencil objects.

In `/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl`, line 35:
```
gpMaterialFlag gp_flag = floatBitsToInt(gp_mat._flag);
```
`gpMaterialFlag` is of type `uint`. This is a mismatched-type assignment that can cause crashes on some hardware/systems with GLSL that do not support implicit type casting.

So use `floatBitsToUint` for type conversion.

Differential Revision: https://developer.blender.org/D15433
2022-07-12 11:34:41 -03:00
d58072caf4 Fix: missing geometry copy before modifying it
A geometry component may reference read-only geometry.
In this case it has to be copied before making changes to it.

This was caused by rBb876ce2a4a4638142.
2022-07-12 16:27:06 +02:00
47dd42485e Cycles: fix and enable JIT oneAPI CentOS7 builds for drivers 23570+
The current specific CentOS7 workaround we have for AoT, which is to
disable __FAST_MATH__ by using -fhonor-nans, now also fixes the
compilation issue for JIT as well since at least driver 23570.
2022-07-12 15:55:32 +02:00
4a445c8dc0 LibOverride: Fix some issues from.revealed by recent previous commit.
rB57097e9a8515 did not properly consider case where you have more than
one override for a same reference linked ID.

Also adds more security checks around shapekeys, since match between
override and its linked reference is never ensured either way (fixes a
crash reported by @Rik from Blender studio).
2022-07-12 15:34:40 +02:00
f72cedffb6 Cleanup: Use interpf instead of repeating the logic
This makes the code clearer.
2022-07-12 10:20:01 -03:00
2d1fe736fa Fix T96238: shrinking to zero doesn't actually scales the radius to zero
Probably to prevent the radius of a point from being stuck at zero,
the `Shrink/Fatten` curve operator sets a minimum value of `0.001`
for all points being transformed.

This is an inconvenience as these points may have been purposely set
to zero on the panel.

And it also doesn't follow the convention seen in other operators
(which keep the value zero).

So remove this limitation.
2022-07-12 10:11:05 -03:00
57097e9a85 Fix T99261: partial LibOverride creation would not properly remap all needed data.
When creating partial overrides, there may also be need to reamap usage
of linked data towards already existing overrides, in newly created
overrides.
2022-07-12 14:39:08 +02:00
RedMser
4344b2bf19 Markers: Make delete confirmation depend on key used
Add a 'Delete Confirmation' operator property to the 'Delete Marker'
operator. This determines whether the user is asked to confirm the
deletion or not.

Defaults so that only {key X} ({key Backspace} for industry compatible
keymap) prompts for deletion, whereas {key Del} does not show the
confirmation popup.

This also makes the default keymap for marker deletion consistent with
the common delete operators (such as objects and keyframes).

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D13818
2022-07-12 13:00:56 +02:00
52b7f2b089 UV: Box and lasso selection for partially intersecting edges
In UV edge mode, box and lasso selections allow edge selections only
when the entire edge is contained within the selection area. This
doesn't consider any edges that partially overlap with the selection
area.

This is  now fixed by adding a second pass, similar to how these
operators work for edit-mesh selections. Now if both operators are
unable to find any edges contained within the selection area, then
they will perform a second pass which checks for edges that partially
intersect with the selection area.

Now edge selection in the UV editor matches edit-mesh edge-selection
when drawing wire-frame.

Resolves T99443.

Ref D15362
2022-07-12 19:50:40 +10:00
bb3a538843 Fix: Incorrect coordinates used in BLI_rct*_isect_segment functions
Ref D15330.
2022-07-12 19:28:26 +10:00
8bd32019ca Fix threading crash due to conflict in mesh wrapper type
A mesh wrapper might be being accessed for read-only from one thread
while another thread converts the wrapper type to something else.

The proposes solution is to defer assignment of the mesh wrapper
type until the wrapper is fully converted. The good thing about this
approach is that it does not introduce extra synchronization (and,
potentially, evaluation pipeline stalls). The downside is that it
might not work with all possible wrapper types in the future. If a
wrapper type which does not clear data separation is ever added in
the future we will re-consider the threading safety then.

Unfortunately, some changes outside of the mesh wrapper file are
to be made to allow "incremental" construction of the mesh prior
changing its wrapper type.

Unfortunately, there is no simplified file which demonstrates the
issue. It was investigated using Heist production file checked at
the revision 1228: `pro/lib/char/einar/einar.shading.blend`. The
repro case is simple: tab into edit mode, possibly few times.

The gist is that there several surface deform and shrinkwrap
modifiers which uses the same target. While one of them is building
BVH tree (which changes wrapper type) the other one accesses it for
read-only via `BKE_mesh_wrapper_vert_coords_copy_with_mat4()`.

Differential Revision: https://developer.blender.org/D15424
2022-07-12 10:26:52 +02:00
6e6da22eb0 Fix: crash when iterating over all attributes 2022-07-12 09:42:19 +02:00
b8d1e576bc Cleanup: use array for internal _bpy methods 2022-07-12 16:11:19 +10:00
ae6a4fcc7a Tests: add test to ensure restricted py-driver execution is working
Add internal function (only used for testing at the moment)
`_bpy._driver_secure_code_test`.

Add test `script_pyapi_bpy_driver_secure_eval` to serves two purposes:

- Ensure expressions that should be insecure remain so when upgrading
  Python or making any changes in this area.

- Ensure new versions of Python don't introduce new byte-codes that
  prevent existing expressions from being executed
  (happened when upgrading from 3.7, see [0]).

[0]: dfa5201763
2022-07-12 16:11:19 +10:00
00c7e760b3 Python: add opcodes for safe py-drivers
The following opcodes have been added, see [0] for details:

- LIST_TO_TUPLE: convert a list to a tuple,
  use for constructing lists/tuples in some cases.

- LIST_EXTEND: use for constructing lists with unpacking.

- SET_UPDATE: use for constructing sets with unpacking.

- CONTAINS_OP: check if `a in b` generally useful.

When writing tests these op-codes where needed for basic operations
and can be safely supported.

Add note why dictionary manipulation op-codes have been left out.

Also restrict namsepace access to anything with an underscore prefix
since these may be undocumented.

[0]: https://docs.python.org/3.10/library/dis.html
2022-07-12 16:05:13 +10:00
2a1d12d7a0 Fix (studio-reported) crash in ID remapping code on rare cases.
Some ID types did not have a filter value, even though they would be
used in remapping code, leading to missing remappings. In that specific
case, shape keys would actually never be properly remapped.

Reproducible in r1230 of
`Heist/pro/animation_test/einar/einar_new_expression_shapes2.blend`,
2022-07-11 19:16:04 +02:00
995c904d00 Fix (unreported) crash in liboverride code on rare cases.
When dealing with 'embedded' IDs (and the like, e.g. shape keys),
liboverride code could fail in case the reference linked data (e.g. a
mesh) would not have a shapekey anymore, while the override mesh would
still have one.

Found while investigating another issue in Heist production file
`Heist/pro/animation_test/einar/einar_new_expression_shapes2.blend`,
r1230.
2022-07-11 19:16:04 +02:00
8ca09e6c5e GPU: add BUIDTIME to WITH_GPU_SHADER_BUILDER
Adds a better name that describes when it is used.
The GPU_SHADER_BUILDER is a buildtime tool for developers
to pre-validate GLSL (and in the overseen future pre-compile to
SpirV). We don't see that this needs to become a required
step in the future so WITH_GPU_BUILDTIME_SHADER_BUILDER
is more descriptive name.
2022-07-11 16:45:07 +02:00
Jeroen Bakker
76d8614236 GPU: Do not allow GPU Shader builder when USD is enabled.
Linking GPU shader builder requires stubs for many functions of the USD library.
We don't want to rely on other modules to update the stubs for a tool that
is only used by GPU developers.

This patch raises an error when both WITH_GPU_SHADER_BUILDER and WITH_USD are
enabled. This reduces the maintenance of updating the stubs when USD API changes.

Reviewed By: LazyDodo

Differential Revision: https://developer.blender.org/D15422
2022-07-11 16:12:36 +02:00
6e426259b4 Fix T99218: light group add button should be disabled when name is empty
Previously it was inactive but still clickable.

Ref D15316
2022-07-11 14:02:38 +02:00
6ca5ac2084 GPU: Update shader builder stubs.
Fixes workflow when using WITH_GPU_SHADER_BUILDER=On.
2022-07-11 13:36:29 +02:00
275419f6fd Fix/Cleanup UI messages. 2022-07-11 12:46:22 +02:00
1c4c904786 Deps Builder: Disable TermInfo and ncurses for DPC++
They are not strictly needed for compilation and disabling them makes
the compiler more portable without any special trickery.

This change aimed to solve problem which currently happens on the API
documentation build which does not have terminfo installed, but needs
to compile Cycles.

Note that the DPC++ is to be re-compiled.
2022-07-11 12:09:09 +02:00
da101118d4 Cleanup: Remove unused operator name storage in UI lists 2022-07-11 11:17:08 +02:00
7357176b57 Fix T99383: Wrong origdata type in color filter 2022-07-11 00:19:53 -07:00
cb39058f2f Fix T94633: Sculpt mode missing check for hidden active object
Note there is a bug in BKE_object_is_visible_in_viewport, it
returns false when the object is in local mode.

The transform operator poll should do a similar test.  That
would allow us to move the test from sculpt_brush_strok_invoke
to SCULPT_mode_poll (at the moment we cannot do this due to
the brush operator falling through to the translate keymap
item in global view3d keymap).
2022-07-10 23:39:45 -07:00
133d398120 PyAPI: add Matrix.is_identity read-only attribute
Add a convenient way of checking if the matrix is an identity matrix.
2022-07-11 12:45:00 +10:00
d51bc8215f GPencil: Dot-dash modifier rename segment bug fix.
This patch fixes naming and renaming issue with dot-dash modifier segment list.

Before: when double clicking and exiting it would append
number at the end regardless of name being changed or not.

Now it works like in other areas.

Authored by: Aleš Jelovčan (frogstomp)

Reviewed By: YimingWu (NicksBest)

Differential Revision: https://developer.blender.org/D15359
2022-07-11 10:13:07 +08:00
d4a4691c0c Cleanup: spelling in comments 2022-07-11 10:38:04 +10:00
a83502f05f Cleanup: remove unused GHOST function getAnyModifiedState.
Remove unused GHOST_WindowManager::getAnyModifiedState()
2022-07-11 10:38:02 +10:00
7f4ee97b9e Revert "Fix an assert trip in boolean tickled by D11272 example."
This reverts commit 6543290116.
It broke tests and I don't know why, so reverting this while
figuring that out.
2022-07-10 18:50:11 -04:00
6543290116 Fix an assert trip in boolean tickled by D11272 example.
The face merging code in exact boolean made an assumption that
the tesselated original face was manifold except at the boundaries.
This should be true but sometimes (e.g., if the input faces have
self-intersection, as happens in the example), it is not.
This commit makes face merging tolerant of such a situation.
It might leave some stray edges from triangulation, but it should
only happen if the input is malformed.
Note: the input may be malformed if there were previous booleans
in the stack, since snapping the exact result to float coordinates
is not guaranteed to leave the mesh without defects.
2022-07-10 14:50:17 -04:00
fad857f473 Fix T99532: New OBJ importer in some cases fails to import faces
The importer code was written under incorrect assumption that vertex
data (v, vn, vt commands etc.) are grouped by object, i.e. follow the
o command, and that each object has its own vertex data commands. This
is not the case -- all the vertex data in the whole OBJ file is
"global", with no relation to any objects/groups; it's just that the
faces belong to the object, and then they pull in any vertices they
like.

This patch fixes this incorrect assumption in the importer:

- Vertex data is now properly global; no need to track some sort of
  "offsets" per object like it was doing before.
- For each object, face definitions track the minimum & maximum vertex
  indices referenced by the object, and then all that vertex range is
  created in the final Blender object. Note: it might be (unusual, but
  possible) that an object does not reference a sequential range of
  vertices, e.g. just a single face with vertex indices 1, 10, 100 --
  the resulting Blender mesh will have all the 100 vertices (some
  "loose" without belonging to a face). It should be possible to track
  the used vertices exactly (e.g. with a vector set), but I haven't
  done that for performance reasons.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D15410
2022-07-10 20:09:29 +03:00
4114ace616 Fix T99536: new 3.2 OBJ importer fails with trailing space after wrapped lines
Address the issue by re-working line continuation handling: stop
trying to parse sequences like "backslash, newline" (which is the
bug: it should also handle "backslash, possible whitespace, newline")
during parsing. Instead, fixup line continuations after reading chunks
of input file data - turn backslash and the following newline into
spaces. The rest of parsing code does not have to be aware of them
at all then.

Makes the file attached to T99536 load correctly now. Also will extend
one of the test files in subversion tests repo to contain backslashes
followed by newlines.
2022-07-10 18:27:38 +03:00
443690604f Fix cursor display size with tablet input in GHOST/Wayland
The scale for tablet cursor surfaces was never set, making them display
larger. Now the outputs scale is set for mouse & tablet cursors.
2022-07-09 22:46:53 +10:00
1de14061cb Cleanup: split out wl_buffer creation into a utility function
Simplify logic for initializing the wl_buffer, ensure the cursors
custom data is never heft in a half initialized state.
Also remove the need for multiple calls to close when handling errors.
2022-07-09 22:27:30 +10:00
9a1d772339 Cleanup: remove buffer_t in GHOST/Wayland
This was allocated and only used to store the custom cursor data.
Use a pointer & size member instead for simplicity.
2022-07-09 22:27:28 +10:00
ef970b7756 Cleanup: split memfd_create into it's own function for Wayland
Avoid ifdef's in cursor loading by creating a memfd_create_sealed
utility function that works irrespective of memfd_create availability.
2022-07-09 22:27:27 +10:00
b5d22a8134 Fix resource leaks setting custom cursors in Wayland
- Memory from the prior cursor was never un-mapped.
- posix_fallocate failure left a file handle open..
2022-07-09 22:27:26 +10:00
80f8b7cbbb UI: renaming fIle browser thumbnail sizes
Rename the thumbnail size from Regular to Medium since it's the typical
way to refer to sizing in American English

Reviewed By: Campbell Barton
Differential Revision: https://developer.blender.org/D15305
2022-07-09 02:09:07 -06:00
e3801a2bd4 Weight & Vertex Paint: always respect edit mode hiding on faces.
In some cases it is mandatory to be able to hide parts of the mesh
in order to paint certain areas. The Mask modifier doesn't work in
weight paint, and edit mode hiding requires using selection, which
is not always convenient.

This makes the weight and vertex paint modes always respect edit mode
hiding like sculpt mode. The change in behavior affects drawing and
building paint PBVH. Thus it affects brushes, but not menu operators
like Smooth or Normalize.

In addition, this makes the Alt-H shortcut available even without
any selection enabled, and implements Hide for vertex selection.

Differential Revision: https://developer.blender.org/D14163
2022-07-09 10:39:53 +03:00
d9e00fbbf6 Cleanup: quiet class-memaccess warning 2022-07-09 15:08:23 +10:00
bc2121147f Cleanup: Remove unused variable 2022-07-08 18:47:31 -05:00
2ee6891728 Fix T99494: Transition effects not working correctly
This was caused by strip content length and start position being
incorrect. Previously this was set from strip boundary by update
function, but it was removed.

Add back code to set effect strip start and length.

Previously content length was always 1 for effects, but now it must
correspond to strip length. Because of this workaround for speed effect
to get this apparent content length was removed.
2022-07-08 18:07:07 +02:00
d8e980a4a6 Fix bug in recently added MutableVArraySpan move constructor 2022-07-08 16:27:47 +02:00
8159e0a666 Curves: use consistent default radius for Cycles, Eevee, Set Curve Radius node
To avoid Cycles not showing any hair by default, and to avoid very slow render
due to many overlaps with the previous 1 meter default in the node.

Fixes T97584, T99319

Differential Revision: https://developer.blender.org/D15405
2022-07-08 16:21:32 +02:00
f639b59a29 Cleanup: convert brush.c to C++
In preparation of refactoring for texture nodes.
2022-07-08 16:21:32 +02:00
b876ce2a4a Geometry Nodes: new geometry attribute API
Currently, there are two attribute API. The first, defined in `BKE_attribute.h` is
accessible from RNA and C code. The second is implemented with `GeometryComponent`
and is only accessible in C++ code. The second is widely used, but only being
accessible through the `GeometrySet` API makes it awkward to use, and even impossible
for types that don't correspond directly to a geometry component like `CurvesGeometry`.

This patch adds a new attribute API, designed to replace the `GeometryComponent`
attribute API now, and to eventually replace or be the basis of the other one.

The basic idea is that there is an `AttributeAccessor` class that allows code to
interact with a set of attributes owned by some geometry. The accessor itself has
no ownership. `AttributeAccessor` is a simple type that can be passed around by
value. That makes it easy to return it from functions and to store it in containers.

For const-correctness, there is also a `MutableAttributeAccessor` that allows
changing individual and can add or remove attributes.

Currently, `AttributeAccessor` is composed of two pointers. The first is a pointer
to the owner of the attribute data. The second is a pointer to a struct with
function pointers, that is similar to a virtual function table. The functions
know how to access attributes on the owner.

The actual attribute access for geometries is still implemented with the `AttributeProvider`
pattern, which makes it easy to support different sources of attributes on a
geometry and simplifies dealing with built-in attributes.

There are different ways to get an attribute accessor for a geometry:
* `GeometryComponent.attributes()`
* `CurvesGeometry.attributes()`
* `bke::mesh_attributes(const Mesh &)`
* `bke::pointcloud_attributes(const PointCloud &)`

All of these also have a `_for_write` variant that returns a `MutabelAttributeAccessor`.

Differential Revision: https://developer.blender.org/D15280
2022-07-08 16:16:56 +02:00
f391e8f316 Linux: Move Mesa software OpenGL libraries to sub-directory
Allows to put libraries which are always needed by Blender into the
lib/ folder and not worry about OpenGL libraries picked up from there.

Currently no functional changes as we do not yet have dynamic libraries
which we load at startup. It allows to use direct linking of oneAPI
Cycles device (see D15397), also it is something which would need to
happen to support USD/Hydra/TBB compiler as dynamic libraries in the
future.

Differential Revision: https://developer.blender.org/D15403
2022-07-08 15:44:06 +02:00
0f50ae131f Cycles: enable oneAPI in Linux release builds
with a very high min-driver version requirement, placeholder until JIT
CentOS runtime compilation issue gets fixed in a defined version.
min-driver version check can be worked around by setting
CYCLES_ONEAPI_ALL_DEVICES environment variable.
2022-07-08 15:39:13 +02:00
5723bf926d Fix T99191: Boolean modifier creates invalid material indices
Similar to 1a6d0ec71c which changed the mesh boolean node (and
also caused this bug), this commit changes the material mapping for the
exact mode of the boolean modifier. Now the result should contain any
material on the faces of the input objects (including materials linked
to objects and meshes). The improvement is possible because materials
can be changed during evaluation (as of 1a81d268a1).

Differential Revision: https://developer.blender.org/D15365
2022-07-08 08:32:32 -05:00
becb1530b1 Hair Curves: The new curves object is now available
This commit doesn't implement any new feature but makes the new curves
object type no longer experimental.

Documentation:

* https://docs.blender.org/manual/en/3.3/modeling/curves/primitives.html#empty-hair
* https://docs.blender.org/manual/en/3.3/sculpt_paint/curves_sculpting/introduction.html

Note: This also makes the Selection Paint tool available. This tool
should have been moved out of the "New Curves Tool" flag when we got the
selection drawing to work.

Differential Revision: https://developer.blender.org/D15402
2022-07-08 15:11:32 +02:00
2c55d8c1cf Cleanup: make format 2022-07-08 15:11:32 +02:00
05b38ecc78 Curves: support deforming curves on surface
Curves that are attached to a surface can now follow the surface when
it is modified using shape keys or modifiers (but not when the original
surface is deformed in edit or sculpt mode).

The surface is allowed to be changed in any way that keeps uv maps
intact. So deformation is allowed, but also some topology changes like
subdivision.

The following features are added:
* A new `Deform Curves on Surface` node, which deforms curves with
  attachment information based on the surface object and uv map set
  in the properties panel.
* A new `Add Rest Position` checkbox in the shape keys panel. When checked,
  a new `rest_position` vector attribute is added to the mesh before shape
  keys and modifiers are applied. This is necessary to support proper
  deformation of the curves, but can also be used for other purposes.
* The `Add > Curve > Empty Hair` operator now sets up a simple geometry
  nodes setup that deforms the hair. It also makes sure that the rest
  position attribute is added to the surface.
* A new `Object (Attach Curves to Surface)` operator in the `Set Parent To`
  (ctrl+P) menu, which attaches existing curves to the surface and sets the
  surface object as parent.

Limitations:
* Sculpting the procedurally deformed curves will be implemented separately.
* The `Deform Curves on Surface` node is not generic and can only be used
  for one specific purpose currently. We plan to generalize this more in the
  future by adding support by exposing more inputs and/or by turning it into
  a node group.

Differential Revision: https://developer.blender.org/D14864
2022-07-08 14:47:10 +02:00
aa78278ef6 Fix build error without unity build, after recent changes 2022-07-08 14:38:21 +02:00
155bb95353 Fix Crash: Reading canvas tool settings.
Blender would crash when a file was saved where the tool settings is
set to paint on a single image (3d texture painting).

Reason is that the selected image memory address wasn't updated
when the new address.
2022-07-08 14:05:11 +02:00
Jeroen Bakker
a8f7d41d38 Draw: Curve outline drawing in object mode.
This patch adds (selected/active) outline around a curve object in object mode.

{F13270680}

In the past the draw bounds option was enabled for any curve objects. With this
patch it isn't needed and will be disabled.

In the future the curve outline could also be enabled to improve GPU selection.

Reviewed By: dfelinto, HooglyBoogly, fclem

Maniphest Tasks: T95933

Differential Revision: https://developer.blender.org/D15308
2022-07-08 12:08:31 +02:00
Damien Picard
2c4dfe3453 Add a few missing UI strings to translation.
Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15392
2022-07-08 11:55:01 +02:00
754dae6c76 GHOST/Wayland: add logging for listener handlers
Add logging to all Wayland listener callbacks as it can be difficult
to detect the cause of problems.

Using break-points often isn't practical for debugging interactive
windowing / compositor issues

Logging needs to be enabled on the command line, e.g:

blender --log "ghost.wl.*" --log-level 2 --log-show-basename
2022-07-08 19:40:10 +10:00
47616992f8 GHOST: use ELEM/ARRAY_SIZE/UNPACK macros to avoid repetition
Also use UNLIKELY macro for checks for very unlikely scenarios.
2022-07-08 19:39:11 +10:00
418d82af28 GHOST: add GHOST_utildefines
Add macros from BLI_utildefines, mainly to avoid that avoid repetition
(ELEM, UNPACK*, CLAMP* & ARRAY_SIZE).

Also add macros LIKELY/UNLIKELY as there are quiet a lot of checks
for unlikely situations for GHOST/Wayland (not having a keyboard,
or mouse for e.g.).
2022-07-08 19:36:31 +10:00
c4b32f1b29 Cleanup: Move mesh legacy conversion to a separate file
It's helpful to make the separation of legacy data formats explicit,
because it declutters actively changed code and makes it clear which
areas do not follow Blender's current design. In this case I separated
the `MFace`/"tessface" conversion code into a separate blenkernel
.cc file and header. This also makes refactoring to remove these
functions simpler because they're easier to find.

In the future, conversions to the `MLoopUV` type and `MVert`
can be implemented here for the same reasons (see T95965).

Differential Revision: https://developer.blender.org/D15396
2022-07-07 22:33:57 -05:00
b98a937db6 Fix T99364: Unable to select bones when custom shape display is disabled
Regression in [0] which revealed an error in [1].
Logic for pose channel custom transform ignored ARM_NO_CUSTOM.

[0]: 3267c91b4d
[1]: c3fef001ee
2022-07-08 11:33:22 +10:00
03173d63c0 Cleanup: spelling in comments
Also move mis-placed doc-string.
2022-07-08 09:48:49 +10:00
9ef3736959 Cleanup: format 2022-07-08 09:10:24 +10:00
56bf92f0f6 Cleanup: Calm GCC Conversion Warning
Commit b9c0eed206 introduced a GCC conversion warning because of an
assignment of a long int value to an int.

Own Code
2022-07-07 14:29:37 -07:00
b9c0eed206 BLF: Add Support for Variable Fonts
Add support for Variable/Multiple Master font features. These are fonts
that contain a range of design variations along multiple axes. This
contains no client-facing options.

See D12977 for details and examples

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

Reviewed by Brecht Van Lommel
2022-07-07 12:59:16 -07:00
fc06b4c033 Fix T99332: resize video in image editor does not update correctly
Use the image user from the image editor to correctly get the frame in the
operators. Based on patch by Nicolas (john-g-h-doe) with changes by me.

Differential Revision: https://developer.blender.org/D15380
2022-07-07 21:01:30 +02:00
52fa0c4251 Cleanup: Remove unused variable 2022-07-07 13:43:13 -05:00
4e9e44ad28 Cleanup: improve asserts in generic span 2022-07-07 19:27:30 +02:00
ba62e20af6 BLI: make some spans default constructible
`GSpan` and spans based on virtual arrays were not default constructible
before, which made them hard to use sometimes. It's generally fine for
spans to be empty.

The main thing the keep in mind is that the type pointer in `GSpan` may
be null now. Generally, code receiving spans as input can assume that
the type is not-null, but sometimes that may be valid. The old #type() method
that returned a reference to the type still exists. It asserts when the
type is null.
2022-07-07 19:19:18 +02:00
7cfea48752 LibOverride: Make fully editable when creating an experimental user setting.
This is temporary to investigate which behavior should be kept when
creating an override hierarchy if there are no cherry-picked data
defined: make all overrides user-editable, or not.

This removes the 'make override - fully editable' menu entries.
2022-07-07 18:19:11 +02:00
b8605ee458 UI: Superimposed pin icon for workspace scene pinning in the scene switcher
Followup to the previous commit, to display a pin icon in the scene switcher.
This is a good indicator to have and such workspace-wide functionality should
be available in the topbar, close to what it belongs to (scene switching).
Downside is that it makes this already crowded region even more crowded. But
thanks to the use of superimposed icons, it's not too noisy visually.

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

Reviewed by: Campbell Barton
2022-07-07 18:14:05 +02:00
e0cc86978c Workspaces: Option to pin scene to a workspace
Adds a "Pin Scene" option to the workspace. When activated, the workspace will
remember the scene that was last activated in it, so that when switching back
to this workspace, the same scene will be reactivated. This is important for a
VSE workflow, so that users can switch between different workspaces displaying
a scene and thus a timeline for a specific task.

The option can be found in the Properties, Workspace tab. D11890 additionally
adds an icon for this to the scene switcher in the topbar.

The workspace data contains a pointer to the scene which is a UI to scene data
relation. When appending a workspace, the pointer is cleared.

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

Reviewed by: Brecht Van Lommel, Bastien Montagne (no final accept, but was fine
with the general design earlier)
2022-07-07 18:08:18 +02:00
f9a805164a Outliner, Library Overrides: List child objects under parents
Because children point to, or "use" their parent, the Library Overrides
Hierarchies mode in the Outliner would show parents contained in children, not
children contained in a parent. See D15339 for pictures.

In production files this would make the rig listed under all its children, so
it would appear many times in the tree. Now it appears once and the children
are collected under it.

Refactors the tree building, so instead of using
`BKE_library_foreach_ID_link()`, it now uses the ID relations mapping in
`MainIDRelations`.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15339
2022-07-07 17:19:59 +02:00
Bastien Montagne
fcf1a9ff71 Fix T99256: Regression: Meta balls segfaulting copy-to-selected.
Revealed by rB43167a2c251b, but actuall issue is the
`rna_MetaBall_update_data` function expecting a never-NULL `scene`
pointer, which is not guaranteed.

This lead to refactoring the duo
`rna_MetaBall_update_data`/`BKE_mball_properties_copy`, since it was
doing a very sub-optimal O(n^2) process, new code is O(2n) now
(n being the number of Objects).

Not sure why the objects were processed through the existing bases of
the existing scene in the first place, this could miss a lot of affected
objects (e.g. in case said objects are in an excluded collection, etc.).

Also noticed that both old and new implementation can fail to fully propagate
changes to all affected meta-balls in some specific corner cases, added
a comment about it in the code.

Reviewed By: sergey

Maniphest Tasks: T99256

Differential Revision: https://developer.blender.org/D15338
2022-07-07 16:25:34 +02:00
c76e1ecac6 Compositor: Pre-fill motion tracking fields
Extends current functionality which was only filling in
the active movie clip. Now we also pre-fill tracking object
name, as well as (plane)track name.
2022-07-07 16:15:44 +02:00
59e1009f10 Cleanup: Use std::move for geometry set
The only real improvement is avoiding some reference counting,
but the main for the change is consistency. Also don't move a
StringRef, since that doesn't own any data anyway.
2022-07-07 09:01:46 -05:00
85ef8e1945 Cleanup: Use C++ style of avoiding unused variable warnings
As documented in the best practices section of the style guide:
https://wiki.blender.org/wiki/Style_Guide/Best_Practice_C_Cpp
2022-07-07 08:55:36 -05:00
a91f9c2c01 Cleanup: Use generic index mask utility
This may lead to improved performance from multithreading as well.
2022-07-07 08:49:23 -05:00
f0ac55f519 Fix: Spreadsheet does not display original curves data
The spreadsheet ignored the component choice in the data set region
for curves and volume objects, and the original curves data-block wasn't
retrieved from the original object.
2022-07-07 08:35:47 -05:00
Amélie Fondevilla
a26038ff38 Fix T99505: NLA tweak mode crashes with GPencil data
Adding Grease Pencil keyframes in the dopesheet (rB92d7f9ac56e0) lead to
crashes from the NLA editor (T99505). This is now resolved, by removing
grease pencil keyframes from NLA editor (as it was in 3.2), and
filtering them out of all NLA-related operations.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D15391
2022-07-07 15:31:06 +02:00
Pratik Borhade
3063d90cfc Fix T99453: Regression: Crash on calling menu search
Fix T99453.
Crash due to null pointer access.
So wrap the function call in simple `if` check

Reviewed By: sybren

Maniphest Tasks: T99453

Differential Revision: https://developer.blender.org/D15370
2022-07-07 15:24:17 +02:00
eb7218de8d Fix T99386: Driven modifiers are always re-evaluated during animation
Even if the driver is not dependent on time the modifiers were always
re-evaluated during playback. This is due to the legacy nature of the
check whether modifier depends on time or not: it was simply checking
for sub-string match for modifier in the F-Curve and drivers RNA paths.

Nowadays such dependencies are created by the dependency graph builder,
which allows to have more granular control over what depends on what.

The code is now simplified to only check for "static" dependency of the
modifier form time: for example, Wave modifier which always depends on
time (even without explicit animation involved).

This change also fixes missing relation from the animation component to
the shader_fx modifiers, fixing race condition.

Additional files used to verify relations:
- Geometry: F13257368
- Grease Pencil: F13257369
- Shader FX: F13257370

In these files different types of modifiers have an animated property,
and the purpose of the test is to verify that the modifiers do react
to the animation and that there is a relation between animation and
geometry components of the object. The latter one can only be checked
using the dependency graph relation visualization.

The drivers are not tested by these files. Those are not typically
depend on time, and if there were missing relation from driver to
the modifier we'd receive a bug report already. As well as if there
was a bug in missing time relation to a driver we'd also receive a
report.

Differential Revision: https://developer.blender.org/D15358
2022-07-07 15:22:21 +02:00
9a4927031d Cleanup: Remove redundant filtering of legacy normal attribute
This is already done inside of `attribute_search_add_items`.
2022-07-07 08:15:29 -05:00
ed7dc4282c Cleanup: Correct comment with spreadsheet enum type 2022-07-07 08:14:00 -05:00
5c3dc52536 Cleanup: Improve variable name
The new name makes more sense in non-node-related contexts.
2022-07-07 08:13:11 -05:00
e3ef56ef91 Curves: Add sculpt selection overlay
This commit adds visualization to the selection in curves sculpt mode.
Previously it was only possible to see the selection when it was
connected to a material.

In order to obstruct the users vision as little as possible, the
selected areas of the curve are left as is, but a dark overlay
is drawn over unselected areas.

To make it work, the overlay requests the selection attribute and then
ensures that the evaluation is complete for curves. Then it retrieves
the evaluated selection GPU texture and passes that to the shader.
This reuses the existing generic attribute extraction system because
there currently wouldn't be any benefits to dealing with selection
separately, and because it avoids duplication of the logic that
extracts attributes from curves and evaluates them if necessary.

Differential Revision: https://developer.blender.org/D15219
2022-07-07 08:06:30 -05:00
5d6e7df4a8 GHOST: initialize grab axis for windows
While this didn't cause any user visible bugs, ASAN would report
an error when passing it as an argument.
2022-07-07 21:44:48 +10:00
a27024e36d ID Management: Purge: Make outliner button use recursive purge.
This change the 'Purge' button of the Outliner 'Orphaned' view to use
recursive purge, i.e. it wil not only delete immediately unused IDs (as
listed in the view) anymore, but also all their unused dependencies.
2022-07-07 13:01:02 +02:00
97dd107070 Fix T98029: Support isolated islands of IDs when purging unused ones.
Cases were e.g. an object would use a material, and this material would
use this object (e.g. through a driver), even if both those data-blocks
are technically unused, they would remain forever since they were not
detected as such.

Now this is properly detected and purged as part of the 'recursive
purge' operation.
2022-07-07 13:01:02 +02:00
051a341cf0 Fix T99491: Crash when opening modifiers panel
This crashed because in `get_active_fcurve_channel`, the filter did not
filter out channels with no fcurve.

The fix adds the filter `ANIMFILTER_FCURVESONLY`.

See rB92d7f9ac56e0ff1e65c364487542dfb7c32a0a67 for the new filter.

Maniphest Tasks: T99491

Differential Revision: https://developer.blender.org/D15386
2022-07-07 11:51:38 +02:00
14980c9b3a Fix: Save modified images during file close
Regressed in the following commit due to an inverted conditional:
{rB1159b63a07fd2cbc7fc48e162d57721c9c85b3f6}

Differential Revision: https://developer.blender.org/D15389
2022-07-07 02:36:54 -07:00
f256201876 Fix T99388: Obey relative path option when saving UDIMs
Ensure that the Image maintains the proper file path after saving all
the individual tiles.

The image_save_post function is unaware that the filepath it receives
is only for a single tile, not the entire Image, and happily keeps
setting ima->filepath to the concrete filepath for each tile.

There were 2 problems with the code that attempted to correct the
Image filepath back to the UDIM virtual form:
- It would trample the "relative" directory that might have been set
- It would do the wrong thing if no tiles could be saved at all

The design is now as follows: Example of trying to save to a new PathB
|                                  | all tiles ok     | any tile not ok|
| -------------------------------- | ---------------- | ---------------|
| ima->filepath is currently empty | set to new PathB | keep empty     |
| ima->filepath is currently PathA | set to new PathB | keep PathA     |

Differential Revision: https://developer.blender.org/D15384
2022-07-07 02:12:36 -07:00
50f9c1c09c OBJ: more robust .mtl texture offset/scale parsing (T89421)
As pointed out in a comment on T89421, if a MTL file contained
something like: `map_Ka -o 1 2.png` then it was parsed as having
offset `1 2` and the texture filename just a `.png`. Make it so that
mtl option numbers are parsed in a way where the number is only
accepted only if it's followed by whitespace.

Differential Revision: https://developer.blender.org/D15385
2022-07-07 11:34:13 +03:00
bddcb89cda OBJ: always set eevee blend mode when material "d" is below 1.0
Fixes T97743: the import code was setting EEVEE blending mode whenever
a transparency texture was present (map_d), or when the materials
illum was saying "yo, transparency!". But if only the material's d
was below 1.0, it was not setting the blend mode, which is different
to user expectations.

Differential Revision: https://developer.blender.org/D15383
2022-07-07 11:34:13 +03:00
28105caaa3 Fix T99342: GPencil multiframe falloff is scaling wrongly in rotation
The falloff was applied to scale by error. Now, the falloff is only applied to the rotation.

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

.
2022-07-07 09:47:59 +02:00
843ad51d18 Cleanup: use arguments for internal wayland cursor grabbing
Pass in arguments for internal grab logic instead of accessing
some values from the window and other values as arguments.
While more verbose it's simpler to reason about.
2022-07-07 16:36:46 +10:00
34c701abbd Fix T99270: bones using empties as custom shapes can't be selected
Regression in [0] which didn't account for the bounds of empty objects.
Add support support calculating bounds from empty draw-type to use in
pose-bone culling.

[0]: 3267c91b4d
2022-07-07 15:24:48 +10:00
3f657e7ef1 Python: show additional context for PyDriver errors in the stderr
Showing the expression alone may not be enough to track down an error
evaluating a py-driver. Show information about the target ID & property
in the error message as well.
2022-07-07 12:30:47 +10:00
83c0f6ac37 Python: clear Py-driver variables on exit
These kinds of leaks are relatively harmless, it reduces the number of
un-freed data reported by valgrind on exit.
2022-07-07 12:30:45 +10:00
5c790fd52b Cleanup: use boolean types & early exit on failure for PyDriver
Also use __func__ for printing the funciton name.
2022-07-07 12:30:44 +10:00
709e620977 Cleanup: format 2022-07-07 12:30:42 +10:00
378f65f7d9 Fix Py-driver byte code access with Python 3.11
Error in [0] which assumed the struct member was renamed however
byte-code access from PyCodeObject now requires an API call.

Thanks to @music for pointing this out.

[0]: 780c0ea097
2022-07-07 12:30:40 +10:00
3354ec3fb3 Fix T99334: Ignore edit-related snap options in Object mode
When in Object Mode, any of the active- and edit-related snapping
options (Include Active, Include Edited, Include Non-Edited) should be
ignored when in Object Mode, otherwise snapping could be effectively
disabled.

This commit forces snap code to ignore the active- and edit-related
options when in Object Mode.

Reviewed By: Germano Cavalcante (mano-wii)

Differential Revision: https://developer.blender.org/D15366
2022-07-06 16:21:56 -04:00
2a60b979cc UI: Adjust and fix shader node descriptions
The tooltips added for shader nodes in D15309 are very helpful already.
This commit makes a few tweaks to make them more consistent, concise,
and includes some fixes. Note that this might move some descriptions
further away from the wording in the manual.

* Make wording more concise
  * Start fewer new sentences
  * Use "For Example" slightly less
  * Avoid repeating the node's name unnecessarily
* Spelling/grammar fixes
  * Don't capitalize some words
  * Use consistent verb conjugation
  * Use ASCII characters/more common quote symbols
* Corrections to information
  * Plural/singular corrections
  * "smoke domains" -> "volume grids"
  * Fix tooltip for separate and combine color nodes
  * Refer to color sockets as colors rather than "images"
* Avoid "advice" in a few places, which should be left for the manual
* Remove information for sockets and could be in their tooltips
* Avoid referring to the locations of a property in the UI
* Avoid manual newlines (mostly reserve for "Note:")
  * Leave UI code in control of wrapping, which is more consistent
* Add some information
  * That the UV map and color attribute nodes use a default
  * That Voronoi is "based on the distance to random points"
  * Add "(Deprecated)" to old color combine and separate nodes

Differential Revision: https://developer.blender.org/D15381
2022-07-06 15:03:21 -05:00
2d041fc468 Object: Speed up duplication of large selections by doing fewer collection syncs
Previous code was doing N collection syncs when duplicating N objects.
New code avoids all the intermediate syncs by using
BKE_layer_collection_resync_forbid and
BKE_layer_collection_resync_allow, and then does one
BKE_main_collection_sync + BKE_main_collection_sync_remap for the
whole operation. There is some complexity involved where the Base
things of newly duplicated objects can't be found yet, without the
sync, so some work on them (marking them selected, active, ...) has
to be deferred until after the sync.

Timings: scene with 10k cubes, each with unique mesh (Windows, VS2022
Release build, AMD Ryzen 5950X):

- Shift+D duplicate: 13.6s -> 9.2s
- Alt+D duplicate: 4.76s -> 1.53s

Reviewed By: Bastien Montagne
Differential Revision: https://developer.blender.org/D14150
2022-07-06 21:30:50 +03:00
190ad73590 Cycles oneAPI: Remove direct dependency on Level-Zero
We used it only to access device id for explicitly allowing Arc GPUs.
It made the backend require ze_loader.dll which could be problematic if
we end up using direct linking.
I've replaced filtering based on PCI device id by using other HW properties
instead (EUs, threads per EU), that are now available through Level-Zero.
2022-07-06 18:55:38 +02:00
debb233787 Cleanup: fix comments in oneAPI kernel.cpp 2022-07-06 18:55:38 +02:00
fae68ec651 Fix T99464: Curves sculpt add 3D brush symmetry broken
The brush transform was not applied to the view direction.
2022-07-06 11:53:18 -05:00
8ea5a5259d Icons: Add each icon to a named group
The objects making up each icon are placed in a group named after the icon
coordinates in the grid. This change has no impact on the current pipeline used
to include icons in a Blender build, but lays the foundation to explore other
workflows to do that, and tidies up the file.

Differential Revision: https://developer.blender.org/D15251
2022-07-06 18:21:20 +02:00
82fc8786ea Fix T99343: Missing RNA_def_property_update for show overlays in UV editor
Reviewed By: jbakker

Maniphest Tasks: T99343

Differential Revision: https://developer.blender.org/D15354
2022-07-06 21:14:34 +05:30
0df574b55e Cycles: Improve an occupancy for Intel GPUs
Initially oneAPI implementation have waited after each memory
operation, even if there was no need for this. Now, the implementation
will wait only if it is really necessary - it have improved
performance noticeble for some scenes and a bit for the rest of them.
2022-07-06 17:26:23 +02:00
6636edbb00 BLI: improve reverse uv sample in edge cases
Allow for a small epsilon to improve handling of uvs that are on edges.
Generally, when using reverse uv sampling, we expect that the sampling
is supposed to succeed.
2022-07-06 15:20:38 +02:00
9d0777e514 Fix T99368: Annotation lines doesn't start where clicked
Caused by [0] which made accessing the drag-start require a function
instead of being the value written into the event cursor coordinates.

[0]: b8960267dd
2022-07-06 21:07:29 +10:00
da85245704 Compositor: Pre-fill active scene movie clip in more nodes
Pre-fills movie clip from the scene to the following nodes:
- Keying Screen
- Plane Track Deform
- Track Position

The rest of tracking related nodes were already doing so.

Differential Revision: https://developer.blender.org/D15377
2022-07-06 12:40:39 +02:00
94323bb427 IO: speed up import of large Alembic/USD/OBJ scenes by optimizing material assignment
The importer parts that were doing assignment of materials to the
imported objects/meshes were essentially having a quadratic complexity
in terms of scene object count. For each material assigned to each
object, they were scanning the whole scene, checking which other
Objects use the same Mesh data, in order to resize their material
arrays to match the size.

Performance details (Windows, Ryzen 5950X):

- Import OBJ Blender 3.0 splash scene (24k objects): 43.0s -> 32.9s
- Import USD Disney Moana scene (260k objects): saves two hours
  (~7400s). Note that later on this crashes when trying to render the
  imported result; crashes in the same way/place both in master and
  this patch.

Implementation details:

The importers were doing "scan the world" basically twice for each
object, for each material: once when creating a new material slot
(assigns an empty material), and then again when assigning the
material.

However, all these importers (USD, Alembic, OBJ) always create one
Object for one Mesh. So that whole quadratic complexity resulting
from "scan the world for possible other users of this obdata" is
completely not needed; it just never finds anything. So add a new
dedicated function BKE_object_material_assign_single_obdata that skips
the expensive part, but should only be used when the caller knows that
the obdata has exactly one user (the passed object).

Reviewed By: Bastien Montagne, Michael Kowalski
Differential Revision: https://developer.blender.org/D15145
2022-07-06 13:30:15 +03:00
4b0e7fe511 Fix T99462: Deleting Missing Libraries Crashes Blender.
Usual same issue with outliner operations, where you apply it on one
item, and then try to apply it again on same item listed somewhere else
in the tree...

Fixed by using the 'multi-tagged deletion' code we now have for IDs,
that way tree-walking function just tags IDs for deletion, and they all
get deleted at once at the end.
2022-07-06 10:53:22 +02:00
26f721b516 OBJ: extend test coverage for parsing MTL scale/offsets (T89421)
The new OBJ/MTL importer was already handling case T89421
correctly, but there was no test coverage to prove it. Extend
the tests to parse various forms of "-o" and "-s" (one, two, three
numbers).
2022-07-06 09:05:20 +03:00
e58e023e1a GHOST/Wayland: support dynamic loading libraries for Wayland
Add intern/wayland_dynload which is used when WITH_GHOST_WAYLAND_DYNLOAD
is enabled (off by default). When enabled, systems without Wayland
installed will fall back to X11.

This allows Blender to dynamically load:
- libwayland-client
- libwayland-cursor
- libwayland-egl
- libdecor-0 (when WITH_GHOST_WAYLAND_LIBDECOR is enabled).
2022-07-06 15:30:47 +10:00
d9505831a4 Cleanup: declare local variables static 2022-07-06 15:28:54 +10:00
db9e08a0d1 Cleanup: spelling in comments 2022-07-06 15:28:54 +10:00
Loren Osborn
1f0048cc2d Cleanup: Fix compiler warnings
Use consistent class/struct declaration in forward declarations.

Differential Revision: https://developer.blender.org/D15382
2022-07-06 00:06:16 -05:00
faac25fefe Fix T99284: Undefined values output from UV nodes
When committing D14389 I assumed that the output arrays didn't need
to be initialized, but the UV parameterizer uses the intial values of UVs.
2022-07-05 18:01:08 -05:00
Iliay Katueshenock
1a820680a1 Fix: Tests: Incorrect curve construction
The offsets were filled with the same value,
but they must be the total accumulated point count.

Differential Revision: https://developer.blender.org/D15374
2022-07-05 17:50:59 -05:00
9435ee8c65 Curves: Port subdivide node to the new data-block
This commit moves the subdivide curve node implementation to the
geometry module, changes it to work on the new curves data-block,
and adds support for Catmull Rom curves. Internally I also added
support for a curve domain selection. That isn't used, but it's
nice to have the option anyway.

Users should notice better performance as well, since we can avoid
many small allocations, and there is no conversion to and from the
old curve type.

The code uses a similar structure to the resample node (60a6fbf5b5)
and the set type node (9e393fc2f1). The resample curves node can be
restructured to be more similar to this soon though.

Differential Revision: https://developer.blender.org/D15334
2022-07-05 16:08:37 -05:00
7688f0ace7 Curves: Move type conversion to the geometry module
This helps to separate concerns, and makes the functionality
available for edit mode.
2022-07-05 15:51:12 -05:00
c52a18abf8 UI: Curves Sculpting - Remove duplicated entry for Curve Length 2022-07-05 17:50:27 +02:00
883d8ea16c Fix: Memleak in sequencer drag and drop code 2022-07-05 16:32:20 +02:00
329efa23d0 Cleanup: Unused headers in generic compositor nodes header
Move headers to node files which actually need those.
There is no need for all nodes to have all those headers
included indirectly.
2022-07-05 15:58:04 +02:00
31f0845b7e Fix tracking header not being self-sufficient
It used size_t type without including any header to define it.
2022-07-05 15:58:04 +02:00
8f0907b797 BLI: add float3x3 * float3 operator overload 2022-07-05 15:38:30 +02:00
d4099465cd Cleanup: extract function to snap curves to surface
This makes it possible to use this function without having
to call an operator. This is currently used by D14864.
2022-07-05 15:37:34 +02:00
b98d116257 BLI: use a slightly less trivial reverse uv sampler
This approach is still far from ideal, but at least it has linear
complexity in the common case instead of quadratic.
2022-07-05 15:36:00 +02:00
7ff054c6d1 Cleanup: use curves surface transform utility in operators 2022-07-05 15:06:31 +02:00
c46d4d9fad Curves: move curves surface transforms to blenkernel
This utility struct is useful outside of sculpting code as well.
2022-07-05 15:06:31 +02:00
7f24d90f11 Fix T99272: Regression: location override ignored when used in a shadertree.
This is not strictly speaking a regression, this worked before partial
resync was introduced purely because the whole override hierarchy was
systematically re-built.

But support for material pointers in obdata (meshes etc.) was simply not
implemented.

NOTE: This commit also greatly improves general support of materials in
liboverrides, although there is still more work needed in that area to
consider it properly supported.
2022-07-05 12:52:21 +02:00
ce1d023667 Fix (unreported) liboverride: incomplete hierarchy when root is not object/collection.
We do not (currently) consider other ID types as 'end points' justifying
to create an override hierarchy, however if the 'root' ID (i.e. the ID
the user selected as base to create the override) is not an object or
collection, we still want to check all of its dependencies.

This fixes e.g. if a material depends on another Empty object, and user
tries to hierarchy-override that material, its Empty dependency not
being overridden.
2022-07-05 12:52:20 +02:00
598a26fd8a NLA: update description of frame_end_ui RNA property
The description incorrectly mentioned it changes the start frame as well,
but it changes the strip's repeats or the action's end frame.
2022-07-05 12:20:59 +02:00
935ef06fd1 NLA: fix punctuation of tooltips 2022-07-05 12:18:20 +02:00
fdb854b932 Cleanup: NLA, reformatting code
No functional changes.
2022-07-05 11:34:40 +02:00
Thibault de Villèle
bd00324c26 NLA: change behavior of 'Frame Start' / 'End' sliders
Change the behavior of the "Frame start" and [Frame] "End" fields of an
NLA Strip in the NLA editor.

Frame Start now behaves like translating with {key G} and moving the
mouse. It also updates the Frame End to ensure the strip remains the
same length.

Frame End changes the length of the strip, based on the Repeat property.
If there are no repeats (i.e. number of repeats = 1) the underlying
Action will change length, such that more or less of its keyframes will
be part of the NLA strip. If there are repeats (i.e. number of repeats
smaller or larger than 1), the number of repeats will change. Either
way, the effective end frame off the strip will be the one set in the
Frame End slider.

The old behavior of stretching time has been removed. It is still
possible to stretch time of a strip, but this no longer automatically
happens when manipulating the Frame Start and Frame End sliders.

**Technical details:** new RNA properties `frame_start_ui` and
`frame_end_ui` have been added. Changing those values (for example via
the sliders, but also via Python) trigger the above behavior. The
behavior of the already-existing `frame_start` and `frame_end`
properties has been simplified, such that these can be set from Python
without many side-effects, simplifying import of data into the NLA.

Reviewed By: sybren, RiggingDojo

Differential Revision: https://developer.blender.org/D14658
2022-07-05 10:51:43 +02:00
322abb2e4b Geometry Nodes: Use alphabetical order for UV nodes in add menu 2022-07-04 23:54:06 -05:00
8c33a53b17 Cleanup: format 2022-07-05 14:34:09 +10:00
9145a4d08f GPU: add missing license header 2022-07-05 13:58:52 +10:00
780c0ea097 Python: support v3.11 (beta) with changes to PyFrameObject & opcodes
- Use API calls to access frame-data as PyFrameObject is now opaque.
- Update opcodes allowed for safe driver evaluation.

**Details**

Some opcodes have been added for safe-driver evaluation.
Python 3.11 removes many opcodes - the number of accepted opcodes in
Blender's listing dropped from 65 to 43) however some new opcodes
also needed to be added. As this relates to security details about newly
added opcodes have been noted below (see [0] for full documentation).

Newly added opcodes:

- CACHE:
  Used to control caching instructions.

- RESUME:
  A no-op. Performs internal checks.

- BINARY_OP:
  Implements the binary and in-place operators,
  replacing specific binary operations.

- CALL, PRECALL, KW_NAMES:
  Used for calling functions, replacing some existing opcodes.

- POP_JUMP_{FORWARD/BACKWARD}_IF_{TRUE/FALSE/NONE/NOT_NONE}.
  Manipulate the byte-code counter.

- SWAP, PUSH_NULL.
  Stack manipulation.

Resolves T99277.

[0]: https://docs.python.org/3.11/library/dis.html
2022-07-05 13:41:55 +10:00
dfa5201763 Python: add opcodes for safe py-drivers
New opcodes added since 3.7 meant some actions such as `len()`
were disabled in safe py-driver execution.

The following opcodes have been added, see [0] for details:

- ROT_FOUR: similar to existing ROT_* opcodes, added v3.8.

- ROT_N: similar to existing ROT_* opcodes, added v3.10.

- GET_LEN: Push len(TOS) onto the stack, added v3.10.

- IS_OP: for ternary operator, added v3.9.

- BUILD_SLICE: access `slice` built-in, doesn't expose new
  functionality beyond existing `__getitem__` access.

[0]: https://docs.python.org/3.10/library/dis.html
2022-07-05 13:41:53 +10:00
7537369498 Python: remove invalid Py_TPFLAGS_HAVE_GC usage
Blender wouldn't start with Python 3.11 because of an error in
Py_TPFLAGS_HAVE_GC usage for `bpy.app.handlers.persistent`.
Remove this flag as it's not necessary.

Part of fix for T99277.
2022-07-05 13:41:49 +10:00
6e879c3998 BLI: Use simpler sliced generic virtual arrays when possible
This is just a theoretical improvement currently, I won't try to justify
it with some microbenchmark, but it should be better to use the
specialized single and span virtual arrays when slicing a `GVArray`,
since any use of `GVArrayImpl_For_SlicedGVArray` has extra overhead.

Differential Revision: https://developer.blender.org/D15361
2022-07-04 15:30:42 -05:00
242bfd28ce METAL: Add license header to new files 2022-07-04 20:11:06 +02:00
dccdc6213e Curves: Expose function to calculate vector handles 2022-07-04 11:51:10 -05:00
8fb8a6529f OBJ: remove "experimental" from C++ based importer/exporter, mark Python legacy
By now I'm not aware of any serious regressions or missing functionality
in the C++ based OBJ importer/exporter. They have more features (vertex colors
support), and are way faster than the Python based importer/exporter.

Reviewed By: Thomas Dinges, Howard Trickey
Differential Revision: https://developer.blender.org/D15360
2022-07-04 19:12:35 +03:00
c63569c0e0 Cleanup: Correct UI view comments 2022-07-04 16:50:46 +02:00
abbc8333ac Fix curves sculpting Selection Paint missing refresh
This was reported as part of D15219 but it is a problem in master, not
in the patch.

EEVEE is drawing with a cheap sampling when navigating or painting, but
we need to clear the painting flag when we are done painting.

For a rainy day: DRW_state_is_navigating() should be renamed to indicate
that it also checks for the painting flag.
2022-07-04 16:08:29 +02:00
af6f3a4020 Cleanup: Remove unused function 2022-07-04 08:50:33 -05:00
1c38bfdc6f Cleanup: Clarify relation name for time relation to modifier 2022-07-04 12:27:45 +02:00
004913dd95 Fix T99381: GPencil Unable to Sculpt last point using Subdivide Modifier
The problem was the last point had the original point, but the previous one not, so the loop ends before checking last point.

The solution is avoid the loop exist if the function is checking the previous point before last one.
2022-07-04 10:58:53 +02:00
3f5073a8e2 Fix T98884: Fix edge case crashes in gpu subdiv cache code 2022-07-04 01:34:54 -07:00
7be07a9d6e Cleanup: use local variable in smear code instead of ss->cache->bstrength 2022-07-04 01:19:14 -07:00
a720a4aabb Fix T98698: Division by zero in smear code when strength is zero 2022-07-04 01:17:19 -07:00
c5d3846b10 Fix use-after-free error when handling events that close windows
Regression in [0] caused operations such as file-load or file-new
from any window besides the first to write into the freed:
`wmWindow.eventstate`.

Resolve by copying the event instead of restoring the region relative
cursor position after modifying it.

[0]: 789b1617f7
2022-07-04 16:24:04 +10:00
cbb897070d Cleanup: remove unused WM_event_is_last_mousemove
This was part of walk-mode logic that implemented it's own cursor-grab,
now this has been moved to use GHOST's cursor grabbing,
it's no longer needed.
2022-07-04 16:04:34 +10:00
148dcb3954 Cleanup: spelling in comments 2022-07-04 15:26:57 +10:00
faa97de208 Cleanup: correct function signature for UI_block_add_view for grid_view 2022-07-04 15:07:02 +10:00
9dd27a2c87 UV: Improve UV Straighten operator
Improves UV Straighten in several ways:
- Operate on entire selection.
- One straighten for each selected island.
- Prefers pins to anchor the endpoints of the resulting line.

Differential Revision: D15121
Resolves: T78553
2022-07-04 13:45:48 +12:00
929811df63 Cleanup(UV): Refactor UV Align and UV Straighten (No user visible changes)
Move functionality into uvedit_uv_align_weld and uvedit_uv_straighten.

Prep for D15121
2022-07-04 13:45:48 +12:00
f4a9a3767e Cleanup: Rename curve segment count function
`curve_segment_num` -> `segments_num`.
The "curve" prefix is reduntant for a function in the curve namespace.
2022-07-03 20:44:56 -05:00
e86c2f7288 UI: Move rename buffer management to new view base class
Renaming is a nice example of a feature that shouldn't need a specific
implementation for a specific view type (e.g. grid or tree view). So it's
something that can be supported in the general view code. Individual views can
use it "for free" then. This ports the view level part of the renaming code,
the view item level part of it can be ported once we have a common base class
for the view items.
2022-07-03 01:55:38 +02:00
c355be6fae UI: Add AbstractView base class for views, unify reconstruction in there
No user visible changes expected.

There's plenty of duplicated code in the grid and the tree view, and I expect
this to become more. This starts the process of unifying these parts, which
should also make it easier to add new views. Complexity in the view classes is
reduced, and some type shenanigans for C compatibility and general view
management can be removed, since there is now a common base type.

For the start this ports some of the view reconstruction, where the view and
its items are compared to the version of itself in the previous redraw, so that
state (highlighted, active, renaming, collapsed, ...) can be preserved.
Notifier listening is also ported.
2022-07-03 01:55:38 +02:00
Iliay Katueshenock
4ffee9a48d Fix T99316: Crash with no font in String to Curves node
If you remove the default font from the project, the node will not
have the selected font. In this case, there is no check that the font
does not exist. This suggestion adds an error message if the font
is not specified.

Differential Revision: https://developer.blender.org/D15337
2022-07-02 18:37:32 -05:00
ab444a80a2 BLI: refactor length parameterization
This refactor had two main goals:
* Simplify the sampling code by using an algorithm with fewer special cases.
* Generalize the sampling to support non-sorted samples.

The `SampleSegmentHint` optimization was inspired by `ValueAccessor` from
OpenVDB and improves performance 2x in my test cases.

Differential Revision: https://developer.blender.org/D15348
2022-07-02 21:51:58 +02:00
69ee9ca90e Fix: Build error with unity builds off after recent cleanup
Mistake in df8d96ab66
2022-07-02 13:04:55 -05:00
01d7dedd74 Revert "Start of Bevel V2, as being worked on with task T98674."
This reverts commit 9bb2afb55e.
Oops, did not intend to commit this to master.
2022-07-02 10:14:26 -04:00
9bb2afb55e Start of Bevel V2, as being worked on with task T98674.
This is the start of a geometry node to do edge, vertex, and face
bevels.

It doesn't yet do anything but analyze the "Vertex cap" around
selected vertices for vertex bevel.
2022-07-02 10:09:18 -04:00
5d9ade27de BLI: improve span access to virtual arrays
* Make the class names more consistent.
* Implement missing move-constructors and assignment-operators.
2022-07-02 11:45:57 +02:00
3c60d62dba BKE: fix wrong recently added assert 2022-07-02 11:40:36 +02:00
d0e3388848 Cleanup: Simplify logic building in length parameterization
We can construct an IndexRange directly rather than retrieving it.
2022-07-01 09:46:27 -05:00
da00d62c49 Fix crash with window decorations (libdecor) in Wayland
Surfaces from window decorations were passed into GHOST's listeners
since libdecor & GHOST share a connection.

This error introduced by recent changes that assumed surfaces passed to
GHOST's handler functions were owned by GHOST.

Tag GHOST surfaces & outputs to ensure GHOST only attempts to access
data it created.
2022-07-01 22:50:58 +10:00
56b218296c Fix T99268: LineArt better handling for dense overlappings.
Two main fixes:
- Split tiles only when we are more sure that it will improve distribution.
- Discard edges and chains that are not gonna be used afterwards before chaining.

This speeds up the whole process and also eliminates unnecessary tile splitting.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D15335
2022-07-01 20:46:17 +08:00
b683a37824 Fix T99301: RNA_boolean_get warning when saving a file for the first time
Caused by [0], RNA_struct_property_is_set also functioned to check if
the property existed.

[0]: 6a2c42a0d5
2022-07-01 20:54:47 +10:00
5e5fe217ca Cleanup: rename internal cursor grabbing function
This function was named as if it was part of GHOST's API but was
in fact an internal utility.
2022-07-01 20:35:11 +10:00
41c10ac84a Cycles: fix support for multiple Intel GPUs
Identical Intel GPUs ended up with the same id.
Added PCI BDF to the id to make it unique.
2022-07-01 11:20:00 +02:00
e7a21275c0 IO: print import & export times of Alembic & USD
Many existing importers/exporters do log the time it takes to system
console (some others log more information too). In particular, OBJ
(C++ & python), STL (C++ & python), PLY, glTF2 all log the time it
takes. However, neither USD nor Alembic do. And also it's harder to
know the time it takes there from a profiler, since all the work
normally is done on a background job and is split between several
threads (so you can't just find some top-level function and see how
much time it took).

This change:

- Adds import/export time logging to USD & Alembic importer/exporter,
- In the time utility class (also used by OBJ & STL), improve the
  output formatting: 1) print only one decimal digit, 2) for long
  times, print seconds and also produce a hours:minutes:seconds form.

Reviewed By: Michael Kowalski, Kévin Dietrich
Differential Revision: https://developer.blender.org/D15170
2022-07-01 12:17:50 +03:00
Jason Fielder
4527dd1ce4 Metal: MTLMemoryManager implementation includes functions which manage allocation of MTLBuffer resources.
The memory manager includes both a GPUContext-local manager which allocates per-context resources such as Circular Scratch Buffers for temporary data such as uniform updates and resource staging, and a GPUContext-global memory manager which features a pooled memory allocator for efficient re-use of resources, to reduce CPU-overhead of frequent memory allocations.

These Memory Managers act as a simple interface for use by other Metal backend modules and to coordinate the lifetime of buffers, to ensure that GPU-resident resources are correctly tracked and freed when no longer in use.

Note: This also contains dependent DIFF changes from D15027, though these will be removed once D15027 lands.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D15277
2022-07-01 10:31:57 +02:00
3ffc558341 Sculpt Curves: UI tweaks and shortcut
* Minimum Distance -> Distance Mix
* Max Count -> Count Max
* Shift + A for selection grow

This follows better the names we have in geometry nodes in the Distribute Points
node when using the Poisson Disk method (Distance Min, Distance Max).

The shortcut for the selection grow is the same we use in mesh sculpt
for the Expand Mask operator (which behaves a bit similar).
2022-07-01 10:23:58 +02:00
0554537c3c Cleanup: add missing license headers in Cycles oneAPI implementation 2022-07-01 10:13:07 +02:00
bb8953ab49 GHOST/Wayland: map additional cursors from GHOST_TStandardCursor 2022-07-01 18:11:19 +10:00
5b7e7d67a5 Cleanup: GPUCodegen: Remove unused variables 2022-07-01 10:10:58 +02:00
4cba209edd GPUMaterial: Remove the max attribute check
This is needed to make the GPU_attribute used as generic input mechanism.
2022-07-01 10:10:58 +02:00
ccbf9ee482 Fix un-grab cursor positioning failing for Wayland
UI elements such as sliders & color picker set an un-grab location
which GHOST/Wayland didn't implement.
2022-07-01 18:06:20 +10:00
eff62ea8ab Geometry Nodes: remove warning in Points node
Generating no points in some frames is a perfectly valid use case.
2022-07-01 10:04:35 +02:00
5d57d9f899 Cleanup: remove unused variable 2022-07-01 09:55:20 +02:00
e4bf58e285 Tracking: Image from Plane Marker operators
There are two operators added, which are available via a special
content menu next to the plane track image selector:

- New Image from Plane Marker
- Update Image from Plane Marker

The former one creates an image from pixels which the active plane
track marker "sees" at the current frame and sets it as the plane
track's image.

The latter one instead of creating the new image data-block updates
the image in-place.

This allows to create unwarped texture from a billboard from footage.
The intent is to allow this image to be touched up and re-projected
back to the footage with an updated content.

Available from a plane track image context menu, as well as from the
Track menu.

{F13243219}

The demo of the feature from Sebastian Koenig: https://www.youtube.com/watch?v=PDphO-w2SsA

Differential Revision: https://developer.blender.org/D15312
2022-07-01 09:44:07 +02:00
72b9e07cf2 Add helper function to replace buffer of a single-frame image
Very similar to BKE_image_add_from_imbuf with the exception that no
new image data-block is created, but instead the given one is modified.
2022-07-01 09:44:07 +02:00
dfa5bd689e Fix possible wrong image color space when it is created from image buffer
From quick look it doesn't seem to be leading to real issues yet as the
image buffers are created with the default roles, but valid color space
is needed to be ensured for an upcoming development.
2022-07-01 09:44:07 +02:00
c922b9e2c1 Fix image-from-imbuf resulting in invalid image configuration
The image which source is set to file is not expected to have empty
file path. If it happens it becomes very tricky to save the image on
exit using the standard quit dialog.

This change makes it so if the image buffer does not have file path
then the new image is set to the "generated" source and it behaves
as if the image was created like so and was fully painted on.

Additionally, mark image as dirty, so that quitting Blender after
such image was added will warn about possible data loss.
2022-07-01 09:44:07 +02:00
b872ad037a Fix T99315: Unit plane track deform compositor node leads to unnecessary blur 2022-07-01 09:42:48 +02:00
16264aebe6 Fix sequencer transform test failing.
Issue was caused by using function `SEQ_render_give_stripelem` to obtain
first `StripElem`, but this function now takes retiming into account.

Since first element was meant to be obtained, point to it directly by
using `seq->strip->stripdata`.
2022-07-01 09:02:07 +02:00
b1d3b14711 Fix crash when creating an off-screen context fails in Wayland
This is very unlikely to happen but better not to crash.
2022-07-01 15:33:51 +10:00
650a15fb9b Fix accessing windows from surfaces in Wayland
This is a follow up to [0], where it was assumed flushing the output
would run the appropriate leave handlers & clear the keyboard & pointer
surfaces. While that's mostly true it's not guaranteed.

Resolve this by clearing the pointers when closing windows and add NULL
checks before accessing the windows.

Tested with Gnome, KDE & River compositors.

[0]: 58ccd8338e
2022-07-01 15:16:45 +10:00
bd7b181e10 Cleanup: Remove outdated comments
Point clouds always use geometry_set_eval, and so do volumes.
2022-06-30 21:52:04 -05:00
df8d96ab66 Cleanup: Remove unnecessary includes from geometry nodes header 2022-06-30 21:51:13 -05:00
276e419671 Curves: Avoid initializing offsets when first allocated
The offsets array that encodes the sizes of each curve must be filled
anyway, or the curves will be in an invalid state. Calloc is unnecessary
here. To make that situation clearer, fill the offsets with -1 in debug
builds. Always set the first offset to zero though, since that can save
some boilerplate in other areas.
2022-06-30 21:42:09 -05:00
7e55ff15b0 Fix: Incorrectly sized curves created in set conversion node
The number of points in the source curve was needed, but the offset
(just zero) was passed instead. It's unclear how this worked before.
A mistake in the recent commit 9e393fc2f1.

Also use a common utility for retrieving the sizes of curves
in ranges instead of reimplementing it for this file.
2022-06-30 21:33:11 -05:00
3d3ba9ca8e Cleanup: group public utility functions for Wayland System/Window
GHOST methods were mixed in with Wayland specific utility functions,
making it difficult to navigate or know where to add new functions.
2022-07-01 11:19:01 +10:00
cf64a1d73e Cleanup: spelling in comments 2022-07-01 11:18:58 +10:00
90f4b35bc2 Cleanup: remove unused argument 2022-07-01 11:18:56 +10:00
c15ae2e87b Fix: Correct attribute names in resample curves code 2022-06-30 19:30:06 -05:00
4206b30275 Curves: Adjust "for each curve by type" utility
The first change is reusing the same vector for all types. While we don't
generally optimize for the multi-type case, it doesn't hurt here. The
second change is avoiding calling the corresponding function if there
are no curves of a certain type. This avoids creating attributes for
types that aren't used, for example.
2022-06-30 19:29:32 -05:00
32e9c9802e Cleanup: Add assert for customdata realloc size
This gives a more clear error than finding the error with the signed
to unsigned conversion for size_t.
2022-06-30 19:27:41 -05:00
6161ce6e5d Cleanup: Add assert for unsupported legacy curve type 2022-06-30 19:26:51 -05:00
982d6589a8 Cleanup: Remove duplicate include 2022-06-30 19:25:44 -05:00
a69e5c2348 Cleanup: Avoid assigning constructed VArray to reference
This is clearer about what is actually happening (VArray is small
enough to be a by-value type and is constructed on demand, while
only the generic virtual array is stored).
2022-06-30 19:17:32 -05:00
95055af668 Fix T99309: Duplicate elements deletes instance attributes
The node had incorrect handling of instance attributes. For the instance
component, instead of using the instance domain over the point domain,
it just looked through instances recursively when retrieving attributes.
We never want to do that, since we only work on one geometry at a time.
Instead, just switch out the instance domain for the point domain like
the set position node.
2022-06-30 19:01:02 -05:00
Gaia Clary
106d937a4e COLLADA: Support for alpha color in vertex data.
Many thanks to the original Author of this patch: Christian Aguilera

The COLLADA importer was silently ignoring the alpha component in the
vertex data.

The `stride` variable holds the component count (3 for RGB; 4 for RGBA),
and can be used for honouring the alpha channel in the vertex data.

Test plan:
- Open Blender.
- Clear the scene.
- Add a plane.
- Enter **Vertex Paint** mode.
- Switch to the **Erase Alpha** blending mode.
- Select a tone of gray.
- Turn strength down to less than 1
- Paint [some of] the vertices of the plane.
- Export project as a COLLADA file (`.dae`).
- Clear the scene.
- Re-import the COLLADA file again.
- Export the project again (with different name).

**Without** this patch, the second exported project will have lost the
alpha component in their vertex data:

```lang=xml, counterexample
<float_array id="Plane-mesh-colors-Col-array" count="24">1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1</float_array>
```

**With** the patch, the first and the second exported projects retain
the alpha values painted previously:

```lang=xml
<float_array id="Plane-mesh-colors-Col-array" count="24">1 1 1 1 1 1 1 0.5490196 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.5490196</float_array>
```

Reviewed By: cristian64, SonnyCampbell_Unity
Authored by: Christian Aguilera

Differential Revision: https://developer.blender.org/D14246
2022-06-30 23:13:37 +02:00
f18067aa03 EEVEE-Next: Add Film and RenderBuffers module
This modules handles renderpasses allocation and filling. Also handles
blitting to viewport framebuffer and render result reading.

Changes against the old implementation:
- the filling of the renderpasses happens all at once requiring
  only 1 geometry pass.
- The filtering is optimized with weights precomputed on CPU and
  reuse of neighboor pixels.
- Only one accumulation buffer for renderpasses (no ping-pong).
- Accumulation happens in one pass for every passes using a single
  dispatch or fullscreen triangle pass.

TAA and history reprojection is not yet implemented.
AOVs support is present but with a 16 AOV limit for now.
Cryptomatte is not yet implemented.
2022-06-30 22:45:42 +02:00
a9696f04a0 Fix T90964: Strip can't be deleted if cursor is at bottom of timeline
Caused by hard-coded width of markers region causing operator to pass
through.

Execute operator if there are no markers.
2022-06-30 20:45:37 +02:00
fbcc00d10d Fix broken Cycles performance benchmark after recent logging changes
Ensure full render report is printed with default verbosity.
2022-06-30 19:51:50 +02:00
c9795102c2 Fix build error with Alembic after 65166e145b 2022-06-30 19:47:21 +02:00
e7c58941b1 Fix pointer to pointer passed where single pointer is expected (VSE versioning) 2022-06-30 18:42:22 +02:00
65166e145b Cleanup: Remove scene frame macros (CFRA et al.)
Removes the following macros for scene/render frame values:
- `CFRA`
- `SUBFRA`
- `SFRA`
- `EFRA`

These macros don't add much, other than saving a few characters when typing.
It's not immediately clear what they refer to, they just hide what they
actually access. Just be explicit and clear about that.
Plus these macros gave read and write access to the variables, so eyesores like
this would be done (eyesore because it looks like assigning to a constant):
```
CFRA = some_frame_nbr;
```

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D15311
2022-06-30 18:38:44 +02:00
66de653784 Fix incorrect strip position if pitch was animated
Commit 302b04a5a3 introduced new retiming system, that unified sound
pitch animation with strip speed control. Because sound playback is
handled in different way, this did not work as expected and old files
were broken. In addition animation was not copied to new property.

Revert length position and offset handling for sound strips so their
position does not change and remap fcurves to new `speed_factor`
property.
2022-06-30 18:33:34 +02:00
Patrick Huang
79fe27b976 Fix T96429: outliner tooltip inconsistent with behavior when linking collections
Previously, it would show "Link inside collection" but move between collections
instead in some cases. Additionally there was no tooltip for the "Link before/
after/between collections" case.

Behavior and tooltip should now be consistent in all cases.

Differential Revision: https://developer.blender.org/D15237
2022-06-30 17:19:48 +02:00
34e04ccde2 Cleanup: fix compiler warnings
"override" should be used either for all methods or none, otherwise Clang gives
warnings. Adding it for all platforms is a bigger change.
2022-06-30 17:17:25 +02:00
ef268c7893 Build: Fix build of library dependencies on Linux aarch64
rBb9c37608a9e959a896f5358d4ab3d3d001a70833 moved evaluation of
`versions.cmake` before `options.cmake`, as a result of which
`BLENDER_PLATFORM_ARM` was no longer defined in `versions.cmake`,
causing it to choose the wrong OpenSSL version for aarch64. This
reverts that. Also fixes a compiler crash when building flex with some
glibc versions.

Differential Revision: https://developer.blender.org/D15319
2022-06-30 16:49:42 +02:00
Andrii Symkin
f00d9e80ae Cycles: add more math functions for float4
Add more math functions for float4 to make them on par with float3 ones. It
makes it possible to change the types of float3 variables to float4 without
additional work.

Differential Revision: https://developer.blender.org/D15318
2022-06-30 16:25:21 +02:00
6bb703a9ee Fix T99266: Crash when dragging file to VSE from file browser
Crash happened because sequencer data was not initialized. Ensure data
is initialized before adding strip.
2022-06-30 15:56:08 +02:00
8bf9d482da Cleanup: colon after params, move text into public doc-strings, spelling 2022-06-30 23:48:22 +10:00
58ccd8338e GHOST/Wayland: clarify window access from surfaces
It wasn't obvious when direct access or lookups should be used.

Add class methods for direct lookups as well as searching from known
windows when windows are accessed outside Wayland's handlers.

This avoids having to check if the window has been removed in some cases.
2022-06-30 23:46:57 +10:00
7c98632289 GHOST/Wayland: use flush instead of roundtrip
Using flush avoids handling new events which complicates logic here.
2022-06-30 23:46:57 +10:00
cfd087673d Fix key/dnd event handling accessing freed memory under Wayland
Closing a window could leave danging pointers which Wayland
callbacks are responsible for clearing.

However, any calls Blender makes that don't originate from Wayland's
handlers don't have that assurance (key-repeat in this case).

Resolve by using a window lookup on each key-repeat event.
2022-06-30 23:46:57 +10:00
1cf64434ed Fix accessing cursor position for GHOST/Wayland
GHOST_GetCursorPosition wasn't working properly under Wayland because
the last focused window didn't necessarily match the window used to call
wm_cursor_position_get(..).

Now the window passed into wm_cursor_position_get is passed to GHOST
so that window is used to access cursor coordinates.
2022-06-30 23:46:57 +10:00
6bd2c6789b GHOST: get/set cursor position now uses client instead of screen coords
Use client (window) relative coordinates for cursor position access,
this only moves the conversion from window-manager into GHOST,
(no functional changes).

This is needed for fix a bug in GHOST/Wayland which doesn't support
accessing absolute cursor coordinates & the window is needed to properly
access the cursor coordinates.

As it happens every caller to GHOST_GetCursorPosition was already making
the values window-relative, so there is little benefit in attempting to
workaround the problem on the Wayland side.

If needed the screen-space versions of functions can be exposed again.
2022-06-30 23:46:57 +10:00
df40e9d0aa Fix memory leak with off-screen buffers under Wayland
Each off-screen buffer created a surface and EGL window which was
only freed when Blender exited.

Resolve by freeing the associated data when disposing the off-screen
context.
2022-06-30 23:46:57 +10:00
e190b70946 Cleanup: declare GHOST/Wayland methods const
Needed when called by functions that are const too.
2022-06-30 23:46:57 +10:00
e75f3e3feb Cleanup: use "use_" prefix for boolean property 2022-06-30 23:46:57 +10:00
90ccb71969 Fix missing argument, avoid instancing function call in macro 2022-06-30 23:44:13 +10:00
547efb6b1e Fix T99133:animating multiply factor on video strips crashes blender
Crash caused by `effect_seq->len` being 0, so frame map was not built.

Get length in timeline using handle positions.
2022-06-30 15:31:58 +02:00
Amélie Fondevilla
92d7f9ac56 Animation: Add GP layers in regular Dopesheet
Grease Pencil animation channels are now also shown in the Dopesheet
mode of the Dopesheet editor and in the Timeline.

Grease pencil related events are now listened not only by container
`SACTCONT_GPENCIL` (Grease Pencil Dopesheet), but also
`SACTCONT_DOPESHEET` (main Dopesheet), and `SACTCONT_TIMELINE`
(timeline).

A new Animation Filter flag was added: `ANIMFILTER_FCURVESONLY`. For now
this only filters out Grease Pencil Layer channels.

**Implemented:**

- Preview range set: now only considers selected Grease Pencil keyframes
  when `onlySel` parameter is true. Not only this allows the operator to
  work with grease pencil keyframes in main dopesheet, but it also fixes
  the operator in the Grease Pencil dopesheet.
- Translation: allocation (and freeing) of specific memory for
  translation of Grease Pencil keyframes.
- Copy/Paste: call to both Fcurve and GPencil operators, to allow for
  mixed selection. Errors are only reported when both the FCurve and
  GPencil functions fail to paste anything.
- Keyframe Type change and Insert Keyframe: removed some code here to
  unify Grease Pencil dopesheet and main dopesheet code.

- Jump, Snap, Mirror, Select all/box/lasso/circle, Select left/right,
  Clickselect: account for Grease Pencil channels within the channels
  loop, no need for `ANIMFILTER_FCURVESONLY` there.

**Not Implemented:**

- Graph-related operators. The filter `ANIMFILTER_FCURVESONLY` is
  naively added to all graph-related operators, meaning more-or-less all
  operators that used `ANIMFILTER_CURVE_VISIBLE`.
- Select linked: is for F-curves channel only
- Select more/less: not yet implemented for grease pencil layers.
- Clean Keys, Sample, Extrapolation, Interpolation, Easing, and Handle
  type change: work on Fcurve-channels only, so the
  `ANIMFILTER_FCURVESONLY` filter is activated

Graying out these operators (when no fcurve keyframe is selected) can be
done with custom poll functions BUT may affect performance. This is NOT
done in this patch.

**Dopesheet Summary Selection:**

The main summary of the dopesheet now also takes into account Grease
Pencil keyframes, using some nasty copy/pasting of code, as explained
[on devtalk](https://devtalk.blender.org/t/gpencil-layers-integration-in-main-dopesheet-selection-issue/24527).
It works, but may be improved, providing some deeper changes.

Reviewed By: mendio, pepeland, sybren

Maniphest Tasks: T97477

Differential Revision: https://developer.blender.org/D15003
2022-06-30 15:20:18 +02:00
416aef4e13 Curves: New tools for curves sculpt mode.
This commit contains various new features for curves sculpt mode
that have been developed in parallel.

* Selection:
  * Operator to select points/curves randomly.
  * Operator to select endpoints of curves.
  * Operator to grow/shrink an existing selection.
* New Brushes:
  * Pinch: Moves points towards the brush center.
  * Smooth: Makes individual curves straight without changing the root
    or tip position.
  * Puff: Makes curves stand up, aligning them with the surface normal.
  * Density: Add or remove curves to achieve a certain density defined
    by a minimum distance value.
  * Slide: Move root points on the surface.

Differential Revision: https://developer.blender.org/D15134
2022-06-30 15:09:13 +02:00
Nate Rupsis
0f22b5599a Normalize Weights: use valid default Subset for current context
For the Normalize Weights operator, dynamically set the default 'Subset'
parameter so that it is applicable to the current context.

When the user's last use of Normalize Weights was set to "Deform Pose
Bones", and then tries to use the operator on a mesh without armature,
Blender would try to use the previous opertor properties and show an
error message. This is resolved by switching to `WT_VGROUP_ACTIVE` in
such cases.

Reviewed By: zanqdo, sybren

Maniphest Tasks: T95038

Differential Revision: https://developer.blender.org/D14961
2022-06-30 12:54:27 +02:00
4a7e1c9209 Constraints: rename and refactor custom space initialization.
Rename and simplify the function for initializing the custom space,
avoiding the need for the calling code to be aware of the internals
of bConstraintOb. This patch should not change any behavior.

This was split off from D9732.

Differential Revision: https://developer.blender.org/D15252
2022-06-30 12:51:26 +03:00
c64d1b23df Fix numerical issues with plane track compositor node with empty input
No changes in the interface, but avoids spam in the console about
inability to find a solution for homography transform from singularity.
2022-06-30 11:10:19 +02:00
b544225202 Fix (unreported) liboverride resync creating garbage data in some cases.
Regression caused by the introduction of partial resync in February 2022
(rB1695d38989fd482d3c). Code was missing adding some existing overrides
to the mapping in some specific cases, causing resync to create 'new'
ones instead of re-using existing ones.

This commit also adds a basic resync testcase that illustrates this
issue.
2022-06-30 10:33:44 +02:00
acdc043c30 Revert "Revert "LibOverride: Handle dependencies in both directions in partial override cases.""
This reverts commit rB31d80ddeaad, and fixes issue introduced in rBf0b4aa5d59e3
by not doing the 'reversed dependency check' in resync case.

Rational here are:
* Supporting reversed dependency in a reliable, coinsistent way in
  resync is likely to be a nightmare, if even possible at all.
* Needs for such reversed dependency in resync should be close to 0% of
  cases, as long as users remain reasonable with their organization of
  their assets (it could only become a problem in extreme bad practice
  and corner cases, like a geometry object being added as a child of a
  rig in a completely new, otherwise un-overridden collection, in
  partial override context).

This decision may need to be re-evaluated later in case we go more
towards a very highly partial-override  workflow, but even then I would
expect current solution to work fine in all reasonable use cases.
2022-06-30 10:33:09 +02:00
edbf04ff37 Fix T99290: Wrong color management of plane track image preview
Always consider images as "View as Render" for the plane track image drawing.
2022-06-30 10:24:33 +02:00
Iyad Ahmed
5c726dd4ef Fix C++ STL importer unused function result warning
Fix unused function result warnings for usages of `fread` in the C++
.stl importer, by actually using the returned error code.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D15189
2022-06-30 10:14:08 +02:00
c39e932631 Fix T99196: sculpt_update_object calls paint updates for nonpaint tools
Specifically BKE_texpaint_slots_refresh_object was being called, which
causes cycles to reset at strange times (like moving the mouse cursor
in pose, boundary and various other tools).

This (along with some code that checks if the pbvh pixels need
to be rebuilt) is only run if is_paint_mode (which used to be
needs_colors) is true.
2022-06-29 23:31:08 -07:00
2185943235 Sculpt: Fix a few bugs revealed by SCULPT_TOOL_NEEDS_COLOR name change
* Color attributes are no longer auto-created when painting an image.
* Workbench shading type is no longer automatically changed to
  Attribute for image paint.
2022-06-29 23:22:06 -07:00
f7c6d3705d Cleanup: Renamed SCULPT_TOOL_NEEDS_COLOR to SCULPT_tool_is_paint
Old name is confusing since SCULPT_TOOL_PAINT can paint
on images too, and it's planned for smear to as well.
2022-06-29 23:11:24 -07:00
3cefa13770 Fix T98886: PBVH_GRIDS ignores face smooth flag on first gpu build 2022-06-29 21:05:21 -07:00
feeb8310c8 Cleanup: format 2022-06-30 12:14:23 +10:00
b6c28002ac Cleanup: spelling in comments 2022-06-30 12:14:22 +10:00
209f2b85d7 Cleanup: quiet warning, remove punctuation in description 2022-06-30 12:14:20 +10:00
011327224e Transform Snap: nearest face snap mode, snapping options, refactoring.
This commit adds a new face nearest snapping mode, adds new snapping
options, and (lightly) refactors code around snapping.

The new face nearest snapping mode will snap transformed geometry to the
nearest surface in world space. In contrast, the original face snapping
mode uses projection (raycasting) to snap source to target geometry.
Face snapping therefore only works with what is visible, while nearest
face snapping can snap geometry to occluded parts of the scene. This new
mode is critical for retopology work, where some of the target mesh
might be occluded (ex: sliding an edge loop that wraps around the
backside of target mesh).

The nearest face snapping mode has two options: "Snap to Same Target"
and "Face Nearest Steps". When the Snap to Same Object option is
enabled, the selected source geometry will stay near the target that it
is nearest before editing started, which prevents the source geometry
from snapping to other targets. The Face Nearest Steps divides the
overall transformation for each vertex into n smaller transformations,
then applies those n transformations with surface snapping interlacing
each step. This steps option handles transformations that cross U-shaped
targets better.

The new snapping options allow the artist to better control which target
objects (objects to which the edited geometry is snapped) are considered
when snapping. In particular, the only option for filtering target
objects was a "Project onto Self", which allowed the currently edited
mesh to be considered as a target. Now, the artist can choose any
combination of the following to be considered as a target: the active
object, any edited object that isn't active (see note below), any non-
edited object. Additionally, the artist has another snapping option to
exclude objects that are not selectable as potential targets.

The Snapping Options dropdown has been lightly reorganized to allow for
the additional options.

Included in this patch:

- Snap target selection is more controllable for artist with additional
  snapping options.
- Renamed a few of the snap-related functions to better reflect what
  they actually do now. For example, `applySnapping` implies that this
  handles the snapping, while `applyProject` implies something entirely
  different is done there. However, better names would be
  `applySnappingAsGroup` and `applySnappingIndividual`, respectively,
  where `applySnappingIndividual` previously only does Face snapping.
- Added an initial coordinate parameter to snapping functions so that
  the nearest target before transforming can be determined(for "Snap to
  Same Object"), and so the transformation can be broken into smaller
  steps (for "Face Nearest Steps").
- Separated the BVH Tree getter code from mesh/edit mesh to its own
  function to reduce code duplication.
- Added icon for nearest face snapping.
- The original "Project onto Self" was actually not correct! This option
  should be called "Project onto Active" instead, but that only matters
  when editing multiple meshes at the same time. This patch makes this
  change in the UI.

Reviewed By: Campbell Barton, Germano Cavalcante

Differential Revision: https://developer.blender.org/D14591
2022-06-29 20:52:00 -04:00
0ea282f746 Geometry Nodes: Only calculate mesh to volume bounds when necessary
In "size" voxel resolution mode, calculating the bounds of the mesh to
volume node's input mesh isn't necessary. For high poly this can take
a few milliseconds, so this commit skips the calculation unless we need
it for the "Amount" mode.

Differential Revision: https://developer.blender.org/D15324
2022-06-29 12:28:08 -05:00
Aleksi Juvani
4593fb52cf Geometry Nodes: UV Unwrap and Pack Islands Nodes
This commit adds new Unwrap and Pack Islands nodes, with equivalent
functionality to the existing Unwrap and Pack Islands operators. The
Unwrap node uses generic boolean attributes to determine seams instead
of looking at the seam flags in the mesh geometry.

Unlike the Unwrap operator, the Unwrap node doesn't perform aspect
ratio correction, because this is trivial for the user to implement
with a Vector Math node if it is desired.

The Unwrap node implicitly performs a Pack Islands operation upon
completion, because the results may not be generally useful otherwise.
This matches the behaviour of the Unwrap operator.

The nodes use the existing Vector socket type, and do not introduce a
new 2D Vector type (see T92765).

Differential Revision: https://developer.blender.org/D14389
2022-06-29 12:25:46 -05:00
Martijn Versteegh
d23818fcd9 Attributes: Use attribute renaming function for generic mesh layers
The RNA API in rna_mesh.c has a function to rename generic customdata
layers. However for customdata layers which are attributes (i.e. not
specialized types) the attribute renaming function needs to be used,
as that can ensure unique names across domains.

Differential Revision: https://developer.blender.org/D15310
2022-06-29 11:36:46 -05:00
95964444c6 Cleanup: Clang tidy, unused variable warning 2022-06-29 10:57:28 -05:00
1516f7dcde Geometry Nodes: Add Mesh To Volume Node
This adds a Mesh To Volume Node T86838 based on the existing modifier.
The mesh to volume conversion is implemented in the geometry module,
and shared between the node and the modifier.

Currently the node outputs a grid with the name "density". This may
change in the future depending on the decisions made in T91668.

The original patch was by Kris (@Metricity), further implementation
by Geramy Loveless (@GeramyLoveless), then finished by Erik Abrahamsson
(@erik85).

Differential Revision: https://developer.blender.org/D10895
2022-06-29 10:56:17 -05:00
6b508eb012 Spreadsheet: display byte colors as scene linear floats
The compression as sRGB is mostly an implementation detail and showing the
integers does not make it clear what the actual values are that will be used
for computations in geometry nodes. This follows the general convention that
colors in Blender are displayed and edited in scene linear floats.

The raw sRGB bytes can still be viewed as a tooltip.

Ref T99205

Differential Revision: https://developer.blender.org/D15322
2022-06-29 17:08:50 +02:00
6dd8ceef2a LineArt: Shadow and related functionalities.
This patch includes the full shadow functionality for LineArt:

- Light contour and cast shadow lines.
- Lit/shaded region selection.
- Enclosed light/shadow shape calculation.
- Silhouette/anti-silhouette selection.
- Intersection priority based on shadow edge identifier.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D15109
2022-06-29 22:54:29 +08:00
Arye Ramaty
2ac5b55289 UI: add tooltips for nodes to the shader node add menu
These are based on the descriptions from the manual, with various changes.

Differential Revision: https://developer.blender.org/D15309
2022-06-29 16:19:24 +02:00
b708f45922 Fix T99248: GPencil Sculpt Grab/Push don't work with one point
There were two problems:

1) The checking of the collision was not working with one point only.
2) For one point, the masking was checked always and if the masking was not activated, the stroke was skipped.
2022-06-29 16:07:13 +02:00
a5ac0375b0 Fix T98697: EEVEE: Regression: Missing custom property from volumetrics
The resource binding were missing from the shading group
(`shgroup->uniform_attrs`), leading to no custom property UBO creation
(`drw_uniform_attrs_pool_update`) when issuing the drawcall,
resulting in a missing UBO bind.

The fix make sure to no duplicate the bindings by creating a simple
shader bind instead of a `GPUMaterial` bind.

Candidate for 3.2.1 corrective release.
2022-06-29 14:12:03 +02:00
45fb7a1db5 Fix T98825: EEVEE: Regression: Buffer overflow in sample name buffer
This happened because of the false assumption that `std::array<char, 32>`
would be treated as a container and not relocate their content if the
`Vector` would grow. Replacing with actual object allocation fixes the
issue.

Candidate for 3.2.1 corrective release.
2022-06-29 14:12:03 +02:00
4a9f60ecd2 Fix T99104: EEVEE: Regression: Crash when using Light Output in Materials
Using Light output is supported in Cycles. This patch adds support for it
and remove the crash in `ntree_shader_weight_tree_invert()` by treating
it as any other outputs.

Candidate for 3.2.1 corrective release.
2022-06-29 14:12:03 +02:00
40f40e9931 Fix T99128: EEVEE: Regression: Pixelated Environment Texture
Use view position to retreive world space direction to retain float
precision.

Candidate for 3.2.1 corrective release.
2022-06-29 14:12:03 +02:00
70c6beeafb Fix T99138: EEVEE: Regression: World volume shader incorrect texture coords
The ORCO property was not being properly initialized in this case.

Candidate for 3.2.1 corrective release.
2022-06-29 14:12:03 +02:00
087e95d0fe Cleanup: correct type for sequencer SWAP macro 2022-06-29 22:02:04 +10:00
a02992f131 Cycles: Add support for rendering on Intel GPUs using oneAPI
This patch adds a new Cycles device with similar functionality to the
existing GPU devices.  Kernel compilation and runtime interaction happen
via oneAPI DPC++ compiler and SYCL API.

This implementation is primarly focusing on Intel® Arc™ GPUs and other
future Intel GPUs.  The first supported drivers are 101.1660 on Windows
and 22.10.22597 on Linux.

The necessary tools for compilation are:
- A SYCL compiler such as oneAPI DPC++ compiler or
  https://github.com/intel/llvm
- Intel® oneAPI Level Zero which is used for low level device queries:
  https://github.com/oneapi-src/level-zero
- To optionally generate prebuilt graphics binaries: Intel® Graphics
  Compiler All are included in Linux precompiled libraries on svn:
  https://svn.blender.org/svnroot/bf-blender/trunk/lib The same goes for
  Windows precompiled binaries but for the graphics compiler, available
  as "Intel® Graphics Offline Compiler for OpenCL™ Code" from
  https://www.intel.com/content/www/us/en/developer/articles/tool/oneapi-standalone-components.html,
  for which path can be set as OCLOC_INSTALL_DIR.

Being based on the open SYCL standard, this implementation could also be
extended to run on other compatible non-Intel hardware in the future.

Reviewed By: sergey, brecht

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

Co-authored-by: Nikita Sirgienko <nikita.sirgienko@intel.com>
Co-authored-by: Stefan Werner <stefan.werner@intel.com>
2022-06-29 12:58:04 +02:00
302b04a5a3 VSE: Improved Retiming system
Patch implements better way to control playback speed than it is
possible to do with speed effect. Speed factor property can be set in
Time panel.

There are 2 layers of control:

Option to retime movie to match scene FPS rate.
Custom speed factor to control playback rate.
Since playback rate is strip property, it is now possible to manipulate
strip as normal one even if it is retimed.

To facilitate manipulation, some functions need to consider speed factor
and apply necessary corrections to strip offset or strip start. These
corrections may need to be float numbers, so start and offsets must be
float as well.

Sound strips now use speed factor instead of pitch. This means, that
strips will change length to match usable length. In addition, it is
possible to group movie and sound strip and change speed of meta strip.
2022-06-29 12:48:34 +02:00
c51b8ec863 BLI: add Vector.append_and_get_index with rvalue parameter
This makes it possible to use this method with `std::unique_ptr`.
2022-06-29 12:07:02 +02:00
43b65150ed Fix uninitialized memory use in key-down events on window activation 2022-06-29 18:21:36 +10:00
930398d5b1 GHOST/Wayland: quiet warning with empty title with libdecor
Set the title before showing the window.
2022-06-29 17:34:43 +10:00
6b2dd3e314 GHOST/Wayland: support older output manager (for Weston support)
Support zxdg_output_manager_v1 v2, as weston only supports this.

Even though it's a reference implementation it can be useful for testing.
2022-06-29 17:34:41 +10:00
b1163d2198 Mantaflow: disable call to MANTA::terminateMantaflow
Effectively revert [0] as it ran when freeing individual modifiers,
causing a crash on exit in one of the cycles_volume_cpu tests.

[0]: 6777c420db
2022-06-29 17:34:39 +10:00
Jeroen Bakker
66f826ae85 Benchmark: Add eevee viewport playback tests.
This commit adds the ability to test Eevee viewport playback performance tests.

Tests should be placed in `lib/benchmarks/eevee/*/*.blend`. {rBL62962} added
initial test files. See https://wiki.blender.org/wiki/Tools/Tests/Performance how
to set it up.

To record the playback performance the test start the viewport playback, and adds
a post frame change handler.

This handler will go over the next steps:

* Ensures the viewport is set to rendered mode.
* Wait for shaders to be compiled. Utilizes `bpy.app.is_job_running` function when
  available (v3.3) to wait for shader compilation to finish. When not available will wait
  for one minute.
* Draw several warmup frames
* Record for 10 seconds tracking the number of frames drawn and performance counters.
* When ready print the result to the console. The results will be extracted when the
  benchmark has run.

## Example report
```
                                         master               v3.0                 v3.1                 v3.2
T88219                                   0.0860s              0.0744s              0.0744s              0.0851s
blender290-fox                           1.3056s              0.8744s              0.7994s              1.2809s
```

{F13232387}

Reviewed By: brecht, fclem

Maniphest Tasks: T99136

Differential Revision: https://developer.blender.org/D15302
2022-06-29 07:55:51 +02:00
eaec01cad5 Sculpt: Fix backwards normals in PBVH_GRIDS raycasting
Winding order of grid quads was backwards.
2022-06-28 22:30:28 -07:00
2d0877ed7e Fix T99231: Wrong anchored mode test for smear brush 2022-06-28 21:35:55 -07:00
3283bc6367 Cleanup(UV): Remove unused parameter (no functional changes)
Prep for D15263
2022-06-29 13:14:39 +12:00
f32d7dd0c8 Cleanup(UV): Store nboundaries on pchart (no functional changes)
Prep for D15263
2022-06-29 12:31:16 +12:00
68d037190f Cleanup: format 2022-06-29 10:19:02 +10:00
e1dc54c8fc Cleanup: Fix mul_v2_v2_ccw for repeated arguments (no functional changes)
Prep for D15263
2022-06-29 12:14:35 +12:00
6777c420db Mantaflow: call MANTA::terminateMantaflow on exit
terminateMantaflow was never called, this leak is more of a technicality
since it's only called on exit.

Also make Py_Initialize/Py_Finalize optional in Pd:setup/finalize
as it caused Blender to crash, finalizing Python twice.

Add a patch to extern/mantaflow to keep track of changes in Blender
from up-stream.
2022-06-29 10:11:01 +10:00
d94d7a5d8f Cleanup: update curve_fit_nd (no functional changes) 2022-06-29 09:55:44 +10:00
45645936e9 Cleanup: spelling in comments 2022-06-29 09:40:16 +10:00
c0e4532331 Fix T78394: In UV Editor, UV Unwrap respects selection
Differential Revision: D14945
2022-06-29 10:57:41 +12:00
2d18dd9309 Fix: Use distance unit for points node radius input 2022-06-28 16:03:04 -05:00
1c61db5346 Fix: Flush mode to evaluated object when exiting curves sculpt mode
Tagging the object for copy on write in order to change the mode on the
evaluated object was already done when entering sculpt mode, it should
happen when exiting sculpt mode as well.

Also use the message system to tag updates of the mode property.
This is commonly done for other "mode switch" operators. It's
best to be consistent here, though I don't know that lacking that
caused any issues.
2022-06-28 15:57:22 -05:00
Siddhartha Jejurkar
33be9c0885 Fix T98924: Skip saving selection properties for UV edge ring operator
Oversight in rB7724251af81f. Skip saving selection properties
for UV edge ring operator as it allows the operator to re-use
the value that was previously set using the key-map.

Reviewed By: campbellbarton

Maniphest Tasks: T98924

Differential Revision: https://developer.blender.org/D15214
2022-06-29 01:18:22 +05:30
c257443192 Fix Cycles assert with mix weights outside of 0..1 range
This could result in wrong skipping of SVM nodes in the graph. Now make the
logic consistent with the clamping in the OSL implementation and constant
folding.

Thanks to Christophe Hery for finding the problem and providing the fix.
2022-06-28 19:13:57 +02:00
814f360c83 UI: Unhide the world mist panel if the mist pass is not enabled
This makes no sense to hide it since we can nowadays preview it inside the
viewport even if the render pass is not enabled.
2022-06-28 18:48:39 +02:00
e127182065 DRW: Curve: Fix wrong UBO alignment
This was preventing correct attribute rendering with multiple attributes.
Since the `CurveInfos` struct is used for data sharing between C++ and
GLSL and inside a UBO it needs to obey the `std140` alignment rules which
states that arrays of scalars are padded to the size of `vec4` for each
array entry.
2022-06-28 18:48:39 +02:00
75ad435ceb Cleanup: GPUShader: Fix missing space in debug message 2022-06-28 18:48:38 +02:00
fde7d39051 Cleanup: DRW: Fix misnamed argument and add more info in a function doc 2022-06-28 18:48:38 +02:00
Sayak Biswas
abfa09752f Cycles: enable Vega GPU/APU support
Enables Vega and Vega II GPUs as well as Vega APU, using changes in HIP code
to support 64-bit waves and a new HIP SDK version.

Tested with Radeon WX9100, Radeon VII GPUs and Ryzen 7 PRO 5850U with Radeon
Graphics APU.

Ref T96740, T91571

Differential Revision: https://developer.blender.org/D15242
2022-06-28 18:35:43 +02:00
270ed1c716 Fix T98882: Regression: Gradient colors in a Grease Pencil material change depending on the visibility of other objects
The material ID was being wrongly passed in the shader.
2022-06-28 13:13:48 -03:00
b8064e3312 Build: add HIP version to buildbot configuration 2022-06-28 16:54:45 +02:00
Christian Rauch
bd6912930f Build: when using Wayland, always enable EGL and disable system GLEW
GLEW does not support GLX and EGL at the same time, and the distribution version
is likely to have GLX.

This also refactors the code so all OpenGL related CMake options are together.

Differential Revision: https://developer.blender.org/D12034
2022-06-28 16:54:45 +02:00
614aa9d8ec Py API Doc: add runtime changelog generation to sphinx_doc_gen.py.
Optionally use `sphinx_changelog_gen.py` to dump current version of the
API in a JSON file, and use closest previous one listed in given index
file to create a changelog RST page for Sphinx.

Part of {T97663}.
2022-06-28 16:53:12 +02:00
f9f73473d6 Py API Doc: refactor changelog generation script.
Main change is to make it use JSON format for its dump files, instead of
some Python code.

It also introduces an index for those API dump files, mapping a blender
version to the relevant file path.

This is then used to automatically the most recent (version-number wise)
previous API dump to compare against current one, when generating the
change log RST file.

Part of {T97663}.
2022-06-28 16:52:46 +02:00
b585872450 Fix frame_final_start/end strip property not setting handle position
This was a mistake in 17a773cdce - I did not notice existing set
function and assumed, that property set DNA directly.

Both get and set functions are now available and readonly flag is
removed.
2022-06-28 15:58:08 +02:00
d5dcbabdd2 Build: remove GLEW version checking from install_deps.sh
Latest OpenSubdiv builds without GLEW by default, which is also what we do
for precompiled libraries. So there is no need for compatibility checking
with system GLEW.

Additionally WITH_SYSTEM_GLEW is turned off by default for Blender, and this
logic was presumably added when it was still on by default a few years ago.

Also remove outdated mention of glew-mx, we use intern/glew-mx and no
external library for this.

Differential Revision: https://developer.blender.org/D15281
2022-06-28 15:57:06 +02:00
luzpaz
4d982cbb5d Cleanup: fix various typos
Differential Revision: https://developer.blender.org/D15304
2022-06-28 15:56:16 +02:00
0124de9d0e Install_deps: Fix several issues with TBB.
* TBB MEX version is now 2021, since this versin introduces 'oneTBB'
  which brings a lot of incompatibilities with previous versions.
* Fix several typos and mistakes in OSD, Embree and OIDN build code that
  prevented proper usage of a local TBB build.
2022-06-28 15:47:41 +02:00
c96f2778f0 Fix: sampling points on mesh surface generates too many points 2022-06-28 13:13:41 +02:00
dfea5e24ad BLI: add kdtree range search method that accepts c++ lambda
This is easier to use in C++ code compared to passing a function
and user-data separately.
2022-06-28 13:13:41 +02:00
c1ffea157c Mask editor: Always use smooth drawing
The mask is expected to be always be displayed smooth, and the
option mainly existed for some legacy drivers. IF smooth drawing
causes issues it should be fixed in the drawing code, not as an
option in the interface.

Differential Revision: https://developer.blender.org/D15266
2022-06-28 10:55:45 +02:00
f9076f3869 Cleanup: Remove redundant theme versioning code
Since we reset the default theme for the 3.0 release, we don't need to
keep these version patches around anymore.

Ref D13131
2022-06-28 16:07:30 +10:00
33fc230ba2 Fix T98799: camera unselectable in camera view below a certain scale
The camera frame (used for selection) was drawn outside the near
clipping plane in those cases.

This has been an issue before as seen in the following commits:
- rB6e7e6832e87
- rB33d322873e6
- rB4f9451c0442

Remaining issue was that the code which ensure the frame isn't behind
the near clipping plane was not taking into account the camera could be
scaled (in Z).
A caller of `BKE_camera_view_frame_ex` (namely
`OVERLAY_camera_cache_populate`) applies scale (also on the depth) which
does not play well with the way `BKE_camera_view_frame_ex` did it.

Now take Z scale into account.

Ref D15178
2022-06-28 15:54:02 +10:00
Red Mser
e6d50cdd43 Fix textview selection rendering in front of text
Selection of Python Console renders in front of the text.
Since the default theme uses a low opacity selection color,
it isn't obvious, but increasing alpha to 100% shows it clearly.

Ref D13111
2022-06-28 15:20:06 +10:00
ca9e1f6391 Cleanup: replace magic number with define for scan-code/key-code offset 2022-06-28 14:43:37 +10:00
dd95deadf3 GHOST/Wayland: avoid creating a keyboard-state each key press/release
Instead, create keyboard two states when the keyboard layout is set
(one with & one without num-lock pressed).
This avoids key-press lookups having to check if num-lock exists and
setting the keyboard state for key press & release events.

No functional changes.
2022-06-28 14:35:14 +10:00
fd7c070861 Fix T96170: keys mis-mapped with NeoQwertz layout under Wayland
Accessing the symbols for keys with no modifiers & num-lock enabled
has unintended consequences for some keyboard layouts that use this
to switch layers.

Resolve by restricting num-locked lookups to keys typically toggled
with num-lock (key-pad home, page up/down ... etc).
2022-06-28 13:48:05 +10:00
40cd041f74 Cleanup: group wayland event codes in their own doxy section
Also don't pass typedef'd ints as references.
2022-06-28 12:01:29 +10:00
b8cc181808 Fix T99202: AccentGrave key doesn't work with Wayland
Implement scan-code fallback when the scan-code used for AccentGrave
on US keyboards doesn't map to a key known to GHOST.

Without this, shortcuts that use AccentGrave are inaccessible and the
key does nothing.

This matches functionality from X11, see [0].

[0]: f3427cbc98
2022-06-28 11:31:12 +10:00
Keith Boshoff
b910114384 UI: add Custom properties panel to collections
Show a custom properties panel in the collections tab,
matching other data-blocks which already support this.

Reviewed by: HooglyBoogly, campbellbarton

Ref D12598
2022-06-28 10:52:31 +10:00
381fe684e2 GHOST: only use GHOST_PRINT when WITH_GHOST_DEBUG is enabled
Revert part of [0] so only assert behavior is changed.

[0]: 9b5dda3b07
2022-06-28 10:16:28 +10:00
65f4f50640 Cleanup: compiler warnings, remove unused functions 2022-06-28 10:13:24 +10:00
7a44f62bdb Fix T99156: UV parameterizer respects both Pins and Seams
Rgression from: e6e9f1ac5a

Reviewed By: Brecht Van Lommel

Differential Revision: D15292
2022-06-28 10:46:10 +12:00
317dfc1735 Fix T96776: Assets dropped upside down when looking through camera
In perspective mode the snap point direction needs to be taken into
account to define which side of the face is being looked at.

If there is no face under the mouse cursor, there is no direction
adjustment and the element normal will be used.
2022-06-27 19:00:24 -03:00
17a773cdce Fix T99216: RNA startdisp and enddisp return unreliable values
Since 7afcfe111a `startdisp` and `enddisp` fields are used as runtime
position storage for effect strips exclusively.

Use getter functon to return handle position and make properties read
only.
2022-06-27 22:22:18 +02:00
36348bf4fc Fix error in previous commit - missed include 2022-06-27 22:17:59 +02:00
8eef98710b Fix meta strip has incorrect range when created
Caused by using `startdisp` and `enddisp` to initialize range.
Use handle position instead.
2022-06-27 22:06:07 +02:00
Germano Cavalcante
67e23b4b29 Fix T84369: Fluid: Missing cache invalidation when properties on non-domain objects change
The `DEG_OB_COMP_TRANSFORM` and `DEG_OB_COMP_GEOMETRY` relations between
the **Domain** object and the **Flow**, **Effector** and **Force Field** objects
are added in the `updateDepsgraph` callback of the Fluid modifier, more
specifically in `DEG_add_collision_relations`.

The node linked to these components is the `POINT_CACHE` whose assigned
function is `BKE_ptcache_object_reset`.

So include the `eModifierType_Fluid` modifier in outdated cache checks.

Reviewed By: sergey, zeddb

Maniphest Tasks: T84369

Differential Revision: https://developer.blender.org/D15210
2022-06-27 16:54:23 -03:00
a571c74e10 Sculpt: Fix backwards normals in PBVH_GRIDS raycasting
Winding order of grid quads was backwards.
2022-06-27 11:16:05 -07:00
31ebe8982e BLI: Math: Add ceil_to_multiple_u()
Standalone version of a function added to `BLI_math_vector.hh`.
2022-06-27 20:06:32 +02:00
Félix
6b35d9e6fb VSE: Add API function to select displayed meta strip
Use function `sequence_editor.display_stack(meta_strip)` to set
displayed timeline content.

To view top-level timeline, that does not belong to any meta strip, pass
`None` as argument.

Differential Revision: https://developer.blender.org/D12048
2022-06-27 19:44:16 +02:00
a2b9b9d3c4 Fix broken build on macOS after recent changes 2022-06-27 17:29:24 +02:00
f0a3d2beb2 FFmpeg: Add VFR media support
Variable frame rate (VFR) files have been difficult to work with.
This is because during sequential decoding, spacing between frames is
not always equal, but it was assumed to be equal. This can result in
movie getting out of sync with sound and difference between preview and
rendered image. A way to resolve these issues was to build and use
timecodes which is quite lengthy and resource intensive process. Such
issues are also difficult to communicate through UI because it is not
possible to predict if timecode usage would be needed.

With this patch, double buffer is used to keep previously decoded frame.
If current frame has PTS greater than what we are looking for, it is not
time to display it yet, and previous frame is displayed instead.

Each `AVFrame` has information about it's duration, so in theory double
buffering would not be needed, but in practice this information is
unreliable.

To ensure double buffer is always used, function
`ffmpeg_decode_video_frame_scan` is used for sequential decoding, even
if no scanning is expected.

This approach is similar to D6392, but this implementation does not
require seeking so it is much faster. Currently `AVFrame` is only
referenced, so no data is copied and therefore no overhead is added.

Note: There is one known issue where seeking fails even with double
buffering: Some files may seek too far in stream and miss requested
PTS. These require preseeking or greater negative subframe offset

Fixes: T86361, T72347

Reviewed By: zeddb, sergey

Differential Revision: https://developer.blender.org/D13583
2022-06-27 16:58:07 +02:00
6f7171525b File Browser UI: Use "Widget" font style instead of "Widget Label"
It didn't make much sense to use the "Widget Label" font style here,
since this is just regular text, not labels for widgets. Checked with
@pablovazquez and we agreed on using the "Widget" font style instead.

Also fixes a mismatch where we used the "Widget Label" font style for
drawing, but the "Widget" font style for string width calculations.
Fixes T99207.
2022-06-27 16:18:57 +02:00
Sonny Campbell
64a3a11e19 Fix T98055: Library Filters do not work in Source Files
The fix is to ensure the filter for id type is run when displaying
assets from an Asset Library.

In the current implementation the id_type filter does not run if a blend
file is opened that also happens to be in an Asset Library directory. If
we have opened a blend file that is in an Asset Library directory, we
now use the same filtering check as for the "Current File" asset
library.

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

Reviewed by: Julian Eisel
2022-06-27 16:09:38 +02:00
6243972319 UI: Scrollbar Behavior Changes
Changes to scrollbars so that they are always visible, but thin and
dim, and widen and become more visible as your mouse approaches.

See D6505 for details and examples.

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

Reviewed by Campbell Barton
2022-06-27 06:46:29 -07:00
Pratik Borhade
279e7dac7d Fix T99070: Apply transform fails to clear delta transform values
Clear delta transform value after applying transform.
Include delta location while applying transform.
Use `copy_v3_fl` for resetting object scale

Reviewed By: mano-wii

Maniphest Tasks: T99070

Differential Revision: https://developer.blender.org/D15270
2022-06-27 10:38:34 -03:00
83c2cbb880 Cleanup: Use assert instead of early exit for asset dragging internals
Instead of failing silently, throw a failed assert in debug builds.
2022-06-27 15:36:25 +02:00
36f5967b99 Fix T93650: Asset drag into catalogs broken, Industry Compatible keymap
Issue was that the Industry Compatible keymap wouldn't select files on a
mouse press, and since the dragged items are determined by the
selection, nothing would be considered as dragged.

Selecting items on mouse press happens since c606044157. I haven't
heard of that issue happening in the Industry Compatible keymap. But if
it did happen, it should be fixed too now.
2022-06-27 15:36:25 +02:00
228d79b789 Revert 6de0f29950: BLF: Support for Variable Fonts
Reverting for now, breaks on GCC
2022-06-27 06:32:30 -07:00
6de0f29950 BLF: Add Support for Variable Fonts
Add support for Variable/Multiple Master font features. These are fonts
that contain a range of design variations along multiple axes. This
contains no client-facing options.

See D12977 for details and examples

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

Reviewed by Brecht Van Lommel
2022-06-27 06:07:55 -07:00
151fc2fcd8 Fix T99171: Crash in mesh vertices positions RNA update function
Solution found by Philipp Oeser (@lichtwerk), thanks.
2022-06-27 08:01:54 -05:00
6a2c42a0d5 Cleanup: remove redundant RNA_struct_property_is_set check
This dates back to [0] from before PROP_SKIP_SAVE existed.
While harmless it's confusing why only one option uses this check.

[0]: ff83a98a07
2022-06-27 21:35:32 +10:00
2b806cb955 Cleanup: DRW: Remove drw_view renaming MACROS 2022-06-27 12:46:47 +02:00
ddc6b86a5b Fix color attribute interpolation with GPU subdivision
Handling of 16-bits compression was missing, which gave values that were
way off.
2022-06-27 12:39:39 +02:00
a617929683 Cleanup: rename misleading/inconsistent GHOST types
Remove mask suffix from:
- GHOST_TButtonMask
- GHOST_TModifierKeyMask
.. neither are used as bit-masks.

Remove 'Grab' from:
- GHOST_kGrabAxisNone
- GHOST_kGrabAxisY
.. matching the existing GHOST_TAxisFlag & GHOST_kAxisX.
2022-06-27 20:36:40 +10:00
3cf6516e7b Cleanup: format 2022-06-27 20:27:34 +10:00
Jason Fielder
9130a60d3d MTLCommandBufferState for coordinating GPU workload submission and render pass coordination.
MTLFrameBuffer has been implemented to support creation of RenderCommandEncoders, along with supporting functionality in the Metal Context.

Optimisation stubs for GPU_framebuffer_bind_ext has been added, which enables specific assignment of attachment load-store ops at the bind level, rather than on a framebuffer object as a whole.

Begin and end frame markers are used to encapsulate frame boundaries for explicit workload submission. This is required for explicit APIs where implicit flushing of work does not occur.

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D15027
2022-06-27 11:45:49 +02:00
7b6b740ace Cleanup: spelling in comments 2022-06-27 17:29:57 +10:00
e1c0d18598 Cleanup: remove redundant has key checks 2022-06-27 17:25:07 +10:00
1cf05f17eb UI: define category for the dope-sheet properties panel
Caused warning on startup, missing from [0].

[0]: 57816a6435
2022-06-27 17:25:07 +10:00
10a2c50733 Fix T99178: Console warning using search (F3) in grease pencil draw mode
The preview data was not available in this context and need to be checked to avoid the warning.
2022-06-27 09:13:40 +02:00
3a8fa77c1f GHOST/Wayland: Add a build time option for DBUS, disable by default
Add WITH_GHOST_WAYLAND_DBUS option, so Blender can be built without
DBUS support. Currently it's only used to access the cursor theme.
Without this the "default" cursors are used instead.

Disabling this since it adds an additional dependency for a minor gain
in functionality, with the benefit of removing a library requirement.

There is also a problem where Blender hangs on startup for ~5 seconds
when DBUS isn't running. Eventually it would be good to be able to avoid
this problem without a build option.
2022-06-27 16:49:21 +10:00
2b6c633b63 GHOST/Wayland: set the minimum window size with libdecor 2022-06-27 16:09:23 +10:00
0e88c2fc59 GHOST/Wayland: split pointer/tablet state into separate structs
For Wayland the mouse & tablet are separate devices with their
own location, button-pressed state and focused window.
Split internal state storage so they're separate.

Also track mouse button press/release state without needing focused
windows.
2022-06-27 15:58:07 +10:00
30273b86c7 Fix T98673: Color attribute fill API didn't support editmode 2022-06-26 17:11:03 -07:00
4c3b984b3d Fix T99100: Undo/redo bugs with paint and gravity
You can now push multiple sculpt undo nodes
of different types.  This is necassary to handle
paint tools that have gravity enabled.
2022-06-26 16:15:40 -07:00
77f10fceb2 Cleanup (UV): Remove unused variable do_aspect 2022-06-27 11:13:06 +12:00
81c5b759d6 Fix T99182: Hard code screen_scale for circle drawing in 3D 2022-06-27 10:59:29 +12:00
a646a4b47e Curves: Port string to curves node to the new data-block
Use the conversion implemented in 5606942c63.
2022-06-25 19:09:57 -05:00
be692cc4fe Cleanup: Clang tidy 2022-06-25 19:05:31 -05:00
ef8bb8c0d5 Functions: improve span buffer reuse in procedure execution
This potentially overallocates buffers so that they are usable
for more data types, which allows buffers to be reused more
easily. That leads to fewer separate allocations and improved
cache usage (in one of my test files the number of separate
allocations went down from 1826 to 1555).
2022-06-25 19:41:44 +02:00
22fc0cbd69 BLI: improve support for trivial virtual arrays
This commits reduces the number of function calls through function
pointers in `blender::Any` when the stored type is trivial.

Furthermore, this implements marks some classes as trivial, which
we know are trivial but the compiler does not (the standard currently
says that any class with a virtual destructor is non-trivial). Under some
circumstances we know that final child classes are trivial though.
This allows for some optimizations.

Also see https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1077r0.html.
2022-06-25 19:27:33 +02:00
3237c6dbe8 Fix: crash when converting zero legacy curves
The issue was that the "radius" lookup below fails, because there is no
curve data. Arguably, it should be possible to add attributes even when
there is no data. However, the rules for that are a bit loose currently.
A simple fix is to just not run the conversion code when there is nothing
to convert.
2022-06-25 19:17:08 +02:00
b513c89e84 Functions: avoid using Map for small values
This leads to a 5-10% performance improvement in my benchmark
that runs a procedure many times on a single element.
2022-06-25 18:53:26 +02:00
ba1e97f1c6 Geometry Nodes: Field on Domain Node
As described in T98943, this commit adds a node that can
evaluate a field on a separate domain in a larger field context.
This is potentially useful in many cases, to avoid relying on
a separate capture attribute node, which can make it easier
to build reusable fields that don't need geometry inputs.

Internally, the node just evaluates the input field in the larger
field context and then uses the generic domain interpolation,
so the code is simple. One future optimization might be using
the input selection to only evaluate part of the input field, but
then the selection has to be interpolated as well, and that might
not always be worth it.

Differential Revision: https://developer.blender.org/D15289
2022-06-25 11:23:19 -05:00
5606942c63 Curves: Skip CurveEval in legacy curve conversion
Currently when converting from the legacy curve type to the new type,
which happens during evaluation of every legacy curve object, the
`CurveEval` type is used as an intermediate step. This involves
copying all data twice, and allocating a bunch of temporary arrays.
It's also another use of `CurveEval` that has to be removed before
we remove the type.

The main user difference besides the subtlety described below
will be improved performance.

**Invalid Handles and Types**
One important note is that there are two cases (that I know of)
where handles and handle types can be invalid in the old curve
type. The first is animation, where animated handle positions don't
necessary respect the types. The second is control points with a
single aligned handle that didn't necessarily align with the other.

In master (partially on purpose) the code corrects the first situation
(which caused T98965). But it doesn't correct the second situation.
It's trivial to correct for the second case with this patch (because of the
eager calculation decided on in D14464), but this patch makes the choice
not to correct for //either//.

Though not correcting the handle types puts curves in an invalid state,
it also adds flexibility by allowing that option. Users must understand
that any deformation may correct invalid handles.

Fixes T98965

Differential Revision: https://developer.blender.org/D15290
2022-06-25 11:11:59 -05:00
2967726a29 Cleanup: add missing override 2022-06-25 18:10:22 +02:00
2a8afc142f BLI: improve check for common virtual array implementations
This reduces the amount of code, and improves performance a bit by
doing more with less virtual method calls.

Differential Revision: https://developer.blender.org/D15293
2022-06-25 17:28:49 +02:00
9a0a4b0c0d Geometry Nodes: Add Points Node
This node takes a point count,a vector field, and float field and creates
a pointcloud with n points at the positions indicated in the vector
field with the radii specified in the float field.The node is placed in
the "Point" menu.

Differential Revision: https://developer.blender.org/D13920
Maniphest Task: https://developer.blender.org/T93044
2022-06-25 08:47:31 -05:00
12bde317f4 Fix T98949: Deleting vertex group in geometry nodes affects others
The vertex group indices stored in the weights need to be accounted for
when the vertex group list on the mesh changes.
2022-06-24 16:39:58 -05:00
35d2a22846 Cleanup: Remove unused argument 2022-06-24 16:16:43 -05:00
fca94c5e0d Fix: Incorrect dirty normal tag after mesh translation
Mistake in 54182e4925. The dirty flag was always cleared,
but we only want to clear it after translating a mesh if it normals
were already non-dirty.
2022-06-24 15:48:48 -05:00
f6290cd2a4 Cleanup: Remove unnecessary includes 2022-06-24 15:47:24 -05:00
35da733e6b Fix T99058: geometry nodes ignore if subdivision surface modifier is disabled
It was looking up the last modifier in the stack, ignoring visibility, instead
of mesh->runtime.subsurf_runtime_data set by the modifier evaluation and used by
the drawing code.
2022-06-24 19:57:28 +02:00
9b6e86ace1 Cycles: stop Metal rendering on command buffer error
If there is an error we should stop rendering, instead of finishing with a
wrong render result or reporting a wrong benchmark time.

Ref T96519

Differential Revision: https://developer.blender.org/D15287
2022-06-24 16:51:56 +02:00
Christian Rauch
29755e1df8 GHOST/Wayland: support client-side window decorations
This implements client-side window decorations for moving and resizing
windows and HiDPI support.

This functionality depends on the external project 'libdecor' that is
currently a build option: WITH_GHOST_WAYLAND_LIBDECOR.

Reviewed by: brecht, campbellbarton

Ref D7989
2022-06-25 00:10:39 +10:00
f1d191120f Fix T99130: Spline factor gets messed up if one hair is too short
In the cases where length is zero, we simply equally distribute the
value based on the control point/curve index.

Differential Revision: https://developer.blender.org/D15285
2022-06-24 15:36:31 +02:00
ad8add5f0c Fix T98427: Crash adding quick effects smoke from Python
Manta flow used the `__main__` namespace which it was executed in,
this caused a bug when calculating fluid from Python, which clears
it's `__main__` name-space after execution.
This caused Manta-flows name space to be cleared too.

Resolve this by creating a separate name-space for manta-flow.

Reviewed by: SonnyCampbell_Unity

Ref D15269
2022-06-24 23:28:55 +10:00
2580d2bab5 PyAPI: Expose event.type_prev, value_prev
Before [0] mouse-motion events left the 'event.value' un-changed,
so a mouse-move would be set to PRESS/RELEASE based on previous events.

Support accessing the previous event value directly
to address feedback from T99102.

Note that the previous cursor location is already exposed.

[0]: 52af3b20d4
2022-06-24 23:19:44 +10:00
77eadbede4 Fix T99037: bpy.ops.transform.rotate fails in background mode
This reverts commit c503c5f756,
alternate fix for T82244.

Scripts that run in background mode expected rotation to be usable,
defaulting to the 3D viewport when there is no active windowing data.

Also resolves T88610.
2022-06-24 22:16:47 +10:00
585d81ba2b Workbench: Increase render tests fail threshold for hair.
When running the render test cases on MacOS/Intel the hair render
test fail. Most likely due to the dense geometry and the low
resolution of the test image.

This patch increases the fail threshold so these tests will pass.
Note that I haven't been able to test whether this is also the case
for Linux/Windows. If that is the case we should remove the platform
specific test.
2022-06-24 14:09:15 +02:00
Jeroen Bakker
f748a81f25 Test/Eevee: Increase failure threshold for image tests.
Makes the current test cases pass on NVIDIA 1080Ti/515.
The tests still fail on other platforms (AMD, Intel). Some are actual failures.
Other require platform specific reference images.

Original patch provided by Brecht van Lommel.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D15264
2022-06-24 13:45:29 +02:00
7927ac2fbe Fix T99129: Eevee Hair Info Length not working (old particle hair).
When using the old particle hair with the hair info length it wasn't
working with AMD GPUs. The reason was that the drw_curves uniform buffer
wasn't initialized what made the shader select the incorrect length.
2022-06-24 13:03:29 +02:00
79973494ec Cleanup: Fix building warnings on gcc 9.4.0
Solution by Jacques Lucke
2022-06-24 11:25:12 +02:00
e08c932482 Fix T98925: Editor panels are broken
Commit 277fa2f441 added channels region to unintended editors if sequencer was
used in area. This caused issues with some editors having 2 tool regions and
non functioning side panel.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D15253
2022-06-24 10:23:31 +02:00
3323cd9c9a GHOST/Wayland: support for cursor warp with hidden/wrapped grab enabled
As grab already uses it's own virtual coordinates, cursor warping can
be used when grab is enabled.

Currently nothing depends on this however it could be useful in future.
2022-06-24 14:38:17 +10:00
11f38f59e2 Cleanup: remove unused function WM_cursor_compatible_xy 2022-06-24 14:00:36 +10:00
4c4e8cc926 Fix T99021: Walk-mode doesn't work in Wayland
Walk mode implemented it's own grab which relied on WM_cursor_warp
to work (which isn't implemented for wayland).

Resolve this by using WM_cursor_grab_{enable/disable}.

Besides fixing Wayland this removes the need for workarounds:

- Ensure the event received were after the event generated from warping.
- Alternate logic that reset the "center" when using tablets.
- Checking the cursor location was scaled by native-pixels on macOS.

There is a minor change in behavior: on completion the cursor is left
at the location walk-mode began instead of the center of the region.
2022-06-24 13:58:21 +10:00
70648683a2 Cleanup: add C++ compatible WL_ARRAY_FOR_EACH macro 2022-06-24 10:22:46 +10:00
cc09661c4e Cleanup: remove unused cursor struct members in GHOST/Wayland 2022-06-24 09:59:37 +10:00
b3a713fffa Cleanup: use const arguments for GHOST/Wayland 2022-06-24 09:58:27 +10:00
9b5dda3b07 GHOST: use GHOST_ASSERT for non-release builds
GHOST_ASSERT now matches BLI_assert, which is only ignored for release
builds. Otherwise it prints or asserts when WITH_ASSERT_ABORT is enabled.
2022-06-24 09:00:19 +10:00
93de6b912f Docs: correct GHOST_TimerProcPtr time doc-string 2022-06-24 08:46:18 +10:00
4919403c29 Fix outdated pressure/tilt for tablet motions events under GHOST/Wayland
Accumulate tablet data before generating an event using the 'frame'
callback.
2022-06-24 08:19:08 +10:00
41a0411d79 Fix T99083: audio bad in command-line video player (blender -a)
There was a wrong sample size computation in PulseAudioDevice.
The sample format is switched to float32 for the command-line player.
2022-06-23 21:32:34 +02:00
b0fe0e6a30 Cleanup: Make function static 2022-06-23 13:03:31 -05:00
0473462241 Geometry Nodes: Speed up Separate color node in RGB mode
This applies the same optimization as b8bd304bd4 to the separate
color node. I observed about a 50% improvement with 10 million values
when only extracting one channel-- from about 17ms to 11ms.
2022-06-23 12:34:31 -05:00
a5ff46e0fc Cleanup: make format 2022-06-23 19:28:39 +02:00
dc64673f6e Fix T97691: undefined behavior sanitizer warning for alignment in RNA functions
Thanks Loren Osborn for investigating this and proposing solutions.

Ref D14798
2022-06-23 19:22:50 +02:00
Max Edge
56435b3268 Fix T94621: Missing selection indication for virtual node sockets
A small regression as a result of adding a custom outline to the empty
virtual socket, which ended up overriding the colors when selected with
Shift+LMB.

Differential Revision: https://developer.blender.org/D15103
2022-06-23 12:22:23 -05:00
Angel Bueno
792bf82f11 Spreadsheet: Support operations for filtering colors
Support choosing an operation when filtering colors,
like the other types.

Differential Revision: https://developer.blender.org/D15191
2022-06-23 12:16:18 -05:00
9b775ebad7 Cleanup: Remove unused array in vertex paint code
Unused since 4f616c93f7
2022-06-23 12:10:12 -05:00
6dde88c536 Vertex paint mode tried to do a "fast update" by trying to avoid tagging
the mesh ID for a full update. The conditions it uses are troublesome:
 1. There must be an evaluated mesh
 2. The evaluated mesh's active byte color layer must equal the original's

This logic doesn't make sense for a few reasons. First of all, the
`mloopcol` pointer doesn't make sense in the context of color
attributes (rather than the old vertex colors), since it only points
to byte color attribute on face corners. Second, just because the
layer pointers are equal doesn't mean something doesn't depend
on the attribute's values.

I think the best solution currently is to remove this "fast update"
case and instead work on optimizing the general case.

Also, T95842 suggests removing these pointers, and this is one
of the last remaining uses of `Mesh.mloopcol`.

Differential Revision: https://developer.blender.org/D15275
2022-06-23 12:05:48 -05:00
54182e4925 Mesh: Add an explicit "positions changed" function
We store various lazily calculated caches on meshes, some of which
depend on the vertex positions staying the same. The current API to
invalidate these caches is a bit confusing. With an explicit set of
functions modeled after the functions in `BKE_node_tree_update.h`,
it becomes clear which function to call. This may become more
important if more lazy caches are added in the future.

Differential Revision: https://developer.blender.org/D14760
2022-06-23 12:00:25 -05:00
3e5a4d1412 Geometry Nodes: Optimize selection for virtual array input
This makes calculation of selected indices slightly faster when the
input is a virtual array (the direct output of various nodes like
Face Area, etc). The utility can be helpful for other areas that
need to find selected indices besides field evaluation.

With the face area node used as a selection with 4 million faces,
the speedup is 3.51 ms to 3.39 ms, just a slight speedup.

Differential Revision: https://developer.blender.org/D15127
2022-06-23 11:51:33 -05:00
633c2f07da Cyles: switch primitive.h inline hints to forceinline
This change helps decrease Intel GPU binaries compile time by 5-10
minutes without impacting other backends.

Reviewed By: sergey, brecht

Differential Revision: http://developer.blender.org/D15273
2022-06-23 18:36:48 +02:00
2eba15d3e8 Fix T98975: Broken vertex paint mode operators
All of the operators in vertex paint mode didn't work properly with
the new color attribute system. They only worked on byte color type
attributes on the face corner domain.

Since there are four possible combinations of domains and types now,
it mostly ended up being simpler to convert the code to C++ and use
the geometry component API for retrieving attributes, interpolating
between domains, etc. The code changes ended up being fairly large,
but the result should be simpler now.

Differential Revision: https://developer.blender.org/D15261
2022-06-23 11:33:11 -05:00
5c6ffd07e0 Fix T99110: Crash after running view_all operator in VSE
Crash caused by NULL dereference, when `Editing` is not initialized.

Check if data is initialized in poll function.
2022-06-23 18:20:02 +02:00
d1ea39aac7 Fix T99091: Freeze when changing strip source with thumbnails enabled
When input file is changed, `orig_height` and `orig_width` fields are
reset, which causes thumbnail dimensions to be incorrectly calculated.

Only draw thumbnails if both mentioned fields are non 0.
2022-06-23 17:49:26 +02:00
1c83354c63 Fix T99028: crash deleting file output node with color management override
One case of copying image formats was not properly using BKE_image_format_copy.
To fix this for existing .blend file we need to do versioning, ensuring the curve
mapping is properly copied.
2022-06-23 16:35:11 +02:00
Andrii Symkin
c2a2f3553a Cycles: unify math functions names
This patch unifies the names of math functions for different data types and uses
overloading instead. The goal is to make it possible to swap out all the float3
variables containing RGB data with something else, with as few as possible
changes to the code. It's a requirement for future spectral rendering patches.

Differential Revision: https://developer.blender.org/D15276
2022-06-23 15:02:53 +02:00
b8403b065e Fix T99027: Touch typing in text fields results in dropped key presses
Fix by always testing unhandled double-click events as press events,
irrespective of the previous event type.

**Details**

Handling double-click events only ran when the previously pressed-key
matched the current pressed-key.

Originally when double-click support was added the previous type was
compared (ignoring it's press/release value) and while not necessary
it was harmless as it matched the check for double-click events being
generated.

As of [0] the logic for click/drag detection changed to ignore release
events as release this could interrupt dragging.
This made it possible to generate double-click events that failed the
`event->prev_press_type == event->type` comparison.
In these cases it was possible to generate double-click
events that would not fall-back to a 'press' value when unhandled.

[0]: 102644cb8c
2022-06-23 22:25:13 +10:00
e63799e791 Cleanup: fix typo that deactivated clang-format in rna_brush.c 2022-06-23 13:10:26 +02:00
b830263186 Fix T98871: Drivers not updated when joining an armature
If the some driver had been flagged as "invalid", the flag would not be
cleared when joining armatures which could lead to now valid drivers
still being flagged as invalid.

Now we clear this invalid flag on all drivers to force a recheck after
joining the armatures.
2022-06-23 11:47:37 +02:00
Colin Basnett
091100bfd7 Animation: Add function to remove all FCurves from an Action
Add a `BKE_action_fcurves_clear(action)` function, which removes all the
Action's FCurves, and expose it as `ActionFCurves.clear()` in RNA.

This is more ergonomic than calling `remove` on f-curves until the list
is empty.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D14660
2022-06-23 11:45:53 +02:00
Colin Basnett
2ae4397ec9 Armature: Add poll message explaining bone groups need pose mode
Add a poll message to the bone group operators, to explain they only
work in pose mode. Before, the buttons would be greyed out with no
explanation.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D15119
2022-06-23 11:37:23 +02:00
Colin Basnett
57816a6435 Dopesheet: Add Custom Properties panel
Adds a custom property panel for the active `Action` to the Dopesheet
editor. There was previously no way to edit these properties outside of
the Python API.

This panel will show up when
`context.active_object.animation_data.action` is set.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D14646
2022-06-23 11:12:42 +02:00
Michael Jones
d8e9647ae2 Cycles: Add diagnostic tracing of MTLLibrary compilation time
Reviewed By: sergey

Differential Revision: https://developer.blender.org/D15268
2022-06-23 10:06:20 +01:00
d20bad914e Fix key repeat continuing after a window loses focus for GHOST/Wayland
Also remove NULL checks in keyboard enter/leave handlers,
as they didn't serve any purpose.
2022-06-23 15:38:43 +10:00
e4f51b3a6e LineArt: Cleanup minor warnings from variable type changes. 2022-06-23 13:22:56 +08:00
743a027862 Fix key repeat behavior for GHOST/Wayland
- Respect modifier keys (Shift press/release didn't change the case).

- Changing modifiers resets the timer instead of canceling key-repeat.

- Releasing keys (besides the key being repeated) resets the timer
  instead of canceling key repeat.

This makes key-repeat behave the same way as GTK & WIN32 text input.
2022-06-23 15:14:18 +10:00
1160a3a3f8 Cleanup: Clang tidy
Mainly duplicate includes and else after return.
2022-06-22 18:58:25 -05:00
d2a3b99ff7 Cleanup: Use const arguments
Also use Curves as an argument instead of Object,
since it's more specific to this situation.
2022-06-22 16:58:22 -05:00
Michael Jones
532b33973b Cycles: Tidy of KernelData patchup code
Reviewed By: sergey

Differential Revision: https://developer.blender.org/D15267
2022-06-22 22:38:00 +01:00
Michael Jones
328a911379 Cycles: Distinguish Apple GPUs by core count
This patch suffixes Apple GPU device names with `(GPU - # cores)` so that variant GPUs with the same chipset can be distinguished. Currently benchmark scores for these M1 family GPUs are being incorrectly merged:

- M1: 7 or 8 cores
- M1 Pro: 14 or 16 cores
- M1 Max: 24 or 32 cores
- M1 Ultra: 48 or 64 cores

Reviewed By: brecht, sergey

Differential Revision: https://developer.blender.org/D15257
2022-06-22 22:32:56 +01:00
5c0d18f682 Cleanup: remove unused sculpt texture cache generation
This has not been used since 5505697ac in 2010.
2022-06-22 19:52:55 +02:00
Ramil Roosileht
b6a76243cd D14974: Tip roundness - match square and round brush radius
Oneliner for T97961.  Square sculpt brushes no longer fit
inside the radius circle, they now use the radius for
the square size.

{F13082514}

Note: original patch was modified to scale PBVH
      search radius to avoid artifacts.

Differential Revision: https://developer.blender.org/D14974
Reviewed By: Joseph Eagar & Julien Kaspar
Ref: D14974
2022-06-22 10:03:27 -07:00
1cde1562e8 Cleanup: simplify macOS make deps instructions 2022-06-22 18:17:47 +02:00
Patrick Huang
9f4ec73101 Fix T97675: slow zoom in node editor with Continue zoom method
Speed increased by 10x, making it visually similar to other editors.

Differential Revision: https://developer.blender.org/D15209
2022-06-22 16:56:20 +02:00
6c3965c027 Fix T98773: GPU Subdivision breaks auto selection in UV edit mode
When GPU subdivision is used, and the modifier is not set to be applied
on the cage, UV selection is not synced with the face selection in the
viewport.

This happens because the extraction, despite being in edit mode, is set
to `MESH` instead of `BMESH` (or `MAPPED` in some cases) like for CPU
subdivision, and since the mesh is not always synchrnised with the BMesh
the edit mode flags are not always updated.

With GPU subdivision, when creating the `MeshRenderData`, the condition
`has_mdata && do_final && editmesh_eval_final != editmesh_eval_cage` is
true which forces the `MESH` extraction. Following comment in D14485,
this replace the `has_mdata` in the condition with `use_mapped` which
solves the issue.

Differential Revision: https://developer.blender.org/D15248
2022-06-22 16:45:20 +02:00
cebc5531e9 Fix T98956: Crash removing some builtin attributes
For example, the "id" attribute is stored as a named attribute.
If it doesn't exist already, `layer_index` was uninitialized, causing
issues with `CustomData_free_layer`. The fix is to use the generic
function to free a named layer in that case. Eventually the other
case will go away as T95965 is finished.
2022-06-22 09:06:29 -05:00
785931fc3c Fix: Memory leak writing to builtin attribute with wrong type
The store named attribute node creates a new buffer to evaluate
the field into. When creating the attribute with that buffer fails,
if must be freed.
2022-06-22 09:03:27 -05:00
a3d0f77ded Cleanup: Remove unused function arguments
Solves the corresponding compiler warning.
2022-06-22 10:55:08 +02:00
a7b91fc8bc Cleanup: clang-format 2022-06-22 10:55:08 +02:00
31d80ddeaa Revert "LibOverride: Handle dependencies in both directions in partial override cases."
This reverts commit f0b4aa5d59.

This commit was making files to get bigger and bigger every time they
were saved and re-opened.

In the orphaned data in the outliner new collections would show up
there, even after continuously purging it. This would lead to a massive
file which get also very slow.

This problem will fix itself after a few re-open/re-saves of the files.
For anyone also experimenting this you can fix this faster by purging
the unused data multiple times in the file.

Example of file from the Project Heist (rev. 1014):
heist/pro/shots/010_opening/010_0050/010_0050.anim.blend
2022-06-22 10:48:59 +02:00
Simon Lenz
df2ab4e758 Mask Editor: Add toggle for mask spline drawing
Adds an overlay option to show/hide the spline points & lines of masks in the Mask Editor.

It also moves the "smooth" option up (its position left of the selection dropdown was missleading).

{F11847272}

This emerged from a discussion in https://developer.blender.org/D12776

Differential Revision: https://developer.blender.org/D13314
2022-06-22 10:45:18 +02:00
Ramil Roosileht
5946ea938a D14975: Voxel Remesh Size Edit - Constant Size by default
This patch makes constant size a default for size edit operator of voxel remesh.
In turn, pressing CTRL now enables relative scale, the old default.

Patch also changes workspace status text entry with new additions. Note that it is a simple text and not an array of keymaps (for that further changes are needed)

{F13082567}

Reviewed By: Julien Kaspar & Joseph Eagar
Differential Revision: https://developer.blender.org/D14975
Ref D14975
2022-06-22 01:36:13 -07:00
f4d8382c86 Rigid body physics: Move effector force update into substep loop.
The substep loop for rigid bodies causes unequal effects of force fields depedending on the substep setting, larger
substep counts cause a diminishing effect of force fields.
This is because the force to apply on a body is reset in Bullet after each step and needs to be recomputed. Without this
the body will just coast with constant velocity after the first substep. Since the per-step impulse with larger substep
counts is smaller, the effect is that more substeps cause a smaller total impulse.

The fix is to move external force calculation into the substep loop and update forces for each substep.

Note that this may be considered a breaking change, because the breaking commit rB1aa54d4921c2 has been in master for
a long time and after this fix force fields will generally have a much larger effect on rigid bodies (10x for the
default setting of 10 substeps).

Differential Revision: https://developer.blender.org/D15173
2022-06-22 06:37:45 +01:00
75f0aaab3d Cleanup: remove redundant GPU headers 2022-06-22 14:59:42 +10:00
b8289eb1b9 Cleanup: replace BLF defines with enum, formatting 2022-06-22 14:50:22 +10:00
8fab580949 Fix T99078: Crash closing the file selector in Wayland
Ensure wayland handlers run that clear the window immediately after
the window has been removed so dangling pointers to the window
aren't left set.
2022-06-22 13:11:32 +10:00
c08fda3a6b Cleanup: Grammar in comments 2022-06-21 15:47:25 -05:00
256cb68d33 Cleanup: Remove unused argument 2022-06-21 14:17:24 -05:00
d901f8b75b Fix T98960: Baking to active color attribute uses wrong layer
Baking assumed that color attributes could only have two configurations:
float color data type on vertices, or byte color type on face corners.
In reality the options can be combined to make four total options.
This commit handles the four cases explicitly with a somewhat
more scaleable approach (though this should really be C++ code).

This commit also changes some related error messages, tooltips,
and an enum name, in order to make the functionality more obvious.

Differential Revision: https://developer.blender.org/D15244
2022-06-21 14:15:18 -05:00
7140016838 GPencil: Move New Layer option to menu top
The new layer option must be the first in the menu.

Differential Revision: https://developer.blender.org/D15255
2022-06-21 17:04:30 +02:00
d2f47017b9 Fix crash editing anisotropic filter preference from background mode 2022-06-21 16:00:56 +02:00
9622dace3e Cleanup: removed unused Blender Internal bump/normal mapping texture code
The TexResult.nor output does not appear to be used anywhere.
2022-06-21 16:00:56 +02:00
Colin Basnett
d90b320444 Fix T97533: Extrapolation of NLA strips outside current view are not rendered
Do a more thorough search for strips that are not visible themselves,
but still influence the viewed time range.

The problem before was that tracks not immediately visible would not be
drawn at all. The strategy for fixing this was to simply include strips
that are visible only because of their extrapolation mode.

To do this, there is now a new function `get_visible_nla_strips` which
gives a first and last `NlaTrack` that needs to  be drawn.

Tagging along with this is the removal of the strip index indicator from
the name on meta tracks. Because of the new structure of the code, it
would incur a performance penalty to restore the previous behavior
(requiring a linear search for the index). Since this number is of
virtually no utility to the user anyways (it has the look & feel of
developer debugging information), this is something I think we can
safely remove without regret.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D14738
2022-06-21 15:40:45 +02:00
7f3af2aaee NLA: when searching for active track/strip, shortcut when none is active
In the `update_active_track()` function, add a shortcut that just sets
`NULL`, instead of searching for `NULL` pointers. Should give a tiny
speedup.
2022-06-21 15:28:11 +02:00
15bc3d260d Fix 2 for T98700: Crash when recursively nesting NLA meta strips
When searching for the active NLA strip, avoid overwriting the found strip
pointer with NULL if it was already found in a previous iteration.

The active strip is searched for while looping over the NLA tracks. If the
active strip was found on a previous track, and not on the current track,
this would effectively set `actstrip = NULL`. This is now avoided.

Another benefit is that the search for the active strip is stopped as soon
as it's found, which should increase performance a tiny bit.
2022-06-21 15:28:11 +02:00
d373206c3f NLA: update comment to reflect the current implementation
No functional changes.
2022-06-21 15:28:11 +02:00
3bb34fb7ee NLA: add BLI_assert_msg() to check for assumption
`find_active_strip_from_listbase()` expects two lists of strips with an
equal number of items. This is now not only documented, but also checked
for in an assertion.
2022-06-21 15:22:52 +02:00
ee78c860b8 LineArt: Move style options to top of the modifier.
Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D15164
2022-06-21 16:10:35 +08:00
84fc086254 Fix T98919: Eevee unlinked aov output nodes don't render.
Eevee rendered an empty image for aov nodes that weren't linked to
any other nodes. When connected the result was OK. The root cause was
that the AOV nodes were not marked as output node and pruned when not
connected to any other nodes. The pruning process is there to reduce
the complexity of the GLSL and improve compilation time and
execution time.
2022-06-21 09:45:40 +02:00
5d3df1c296 Cleanup: remove unneeded code in eevee_bloom.
This had to be added to the previous commit.
2022-06-21 08:27:20 +02:00
3df6e75a26 Fix T98972: EEVEE Bloom Pass Outputs Final Image Instead of Bloom.
Regression introduced by {rBca37654b6327}. This commit reversed the
order of loading uniforms. The bloom renderpass used the previous
loading order to overwrite an existing uniform (bloomBaseAdd).

Due to the new ordering this doesn't work anymore where the render
pass outputted an image similar to the final image. This was fixed
by loading the correct value for bloomAddBase and remove the rewrite.
2022-06-21 08:20:26 +02:00
beaae4533a Cleanup: use full names for generated wayland headers, use own directory
Instead of providing our own names for wayland headers, use the filename
component as the basis for the header names. This matches most reference
documentation for Wayland.

Also generate client protocols into a sub-directory `libwayland`,
instead of generating headers into the ghost directory. Making the
include path more specific & makes it easier to differentiate generated
headers from other build files.
2022-06-21 16:08:03 +10:00
84315368ef Fix error in GHOST_ASSERT under Wayland 2022-06-21 16:08:03 +10:00
697363545f GPU subdiv: fix hidden faces in paint mode when hidden in edit mode
Pass `use_hide` to the compute shaders so that we can override the
hidden face flags, like CPU extraction is doing.
2022-06-21 07:39:37 +02:00
e42c662723 Cleanup: Fix format on previous commit 2022-06-21 17:37:15 +12:00
1154b45526 UV: Add "Select Similar" operator in UV editor
Resolves T47437.

Differential Revision: https://developer.blender.org/D15164
2022-06-21 17:33:39 +12:00
4144a85bda Cleanup: Type safety and asserts around ED_select_similar_compare 2022-06-21 16:39:47 +12:00
d7fbc5708a Fix T99016: GPU subdiv artifacts in weight paint with smooth shading
Flags in the smooth shading case were not properly set.
2022-06-21 06:25:08 +02:00
95465606b3 Fix T99033: KDTree deduplication can erase values
Differential Revision: https://developer.blender.org/D15220
2022-06-21 13:21:41 +12:00
a18c291435 Cleanup (UV): Use blenlib math utilities 2022-06-21 10:42:05 +12:00
3545d8a500 Cleanup: Move paint_vertex_color_ops.c to C++ 2022-06-20 13:57:21 -05:00
522dcc54af Fix T94969: Crash in Volume to Mesh with 0 voxels
Checks if voxel amount or -size is <= 0 and if so, returns early.

Differential Revision: https://developer.blender.org/D15241
2022-06-20 20:12:44 +02:00
9f8cc1bc34 Cleanup: Grammar: a vs an 2022-06-20 10:14:17 -05:00
549f9a1178 Build Deps: Disallow looking for Python in registry for ISPC
Should prevent accidental use of wrong Python.
2022-06-20 17:11:33 +02:00
df3a67fc52 Build Deps: Pass Python3 root to ISPC
Following what is done for LLVM. Being consistent feels good here.

Not strictly needed as the build here passed anyway, but it does
feel good to be consistent.
2022-06-20 17:10:15 +02:00
f86722afc7 Build Deps: Fix ISPVC and OIDN compilation on fresh Windows
Make them to use self-compiled Python, similar to previous fixes
for other libraries.
2022-06-20 16:50:24 +02:00
6a1cc0d855 Fix T99019 EEVEE: Regression: Specular BSDF does not apply occlusion
Since the occlusion input is going to be removed in EEVEE-Next, I just
added a temporary workaround. The occlusion is passed as SSS radius
as the Specular BSDF does not use it.

The final result matches 3.1 release
2022-06-20 16:33:04 +02:00
3bb8b64c47 Fix T99018: EEVEE: Regression: Specular BSDF apply specular color input twice
This was an oversight. I checked that no other node had the same regression.
2022-06-20 16:33:04 +02:00
d2e4bd7995 Curves: extract surface brush sampling into separate function
This functionality will also be necessary in the Density brush.
2022-06-20 16:27:57 +02:00
af983a3eef BLI: add min_inplace and max_inplace functions 2022-06-20 16:27:57 +02:00
06b212c446 Fix: assert when deleting all curves 2022-06-20 16:27:57 +02:00
Simon Lenz
eca0c95d51 Mask Editor: Add mask blending factor for combined overlay
This adds a new parameter to the "Combined" overlay mode of the mask editor.
The "blending factor" allows users to blend the mask exterior with the original
footage to visualise the content of the mask in a more intuitive way.  The
"Alpha" overlay is unaffected by this change.

The existing "Combined" overlay is used like before (covering everything
outside the mask in black), but can be blended with the slider in the mask
overlay to look at the exterior.

This is part of an effort to make mask editing more intuitive & easy to use:
https://developer.blender.org/T93097

Differential Revision: https://developer.blender.org/D13284
2022-06-20 16:04:15 +02:00
72a5bb8ba9 Fix artefacts with GPU subdiv and weight paint face selection
Addendum to previous fix, which was for point selection, this fixes the
face selection mode. The issue is caused by wrong flags used for paint
mode (the edit mode flag was always used). Also add back flag which was
accidentally removed in 16f5d51109.
2022-06-20 14:42:09 +02:00
ff1883307f Cleanup: renaming and consistency for kernel data
* Rename "texture" to "data array". This has not used textures for a long time,
  there are just global memory arrays now. (On old CUDA GPUs there was a cache
  for textures but not global memory, so we used to put all data in textures.)
* For CUDA and HIP, put globals in KernelParams struct like other devices.
* Drop __ prefix for data array names, no possibility for naming conflict now that
  these are in a struct.
2022-06-20 12:30:48 +02:00
b73a52302e Fix T98913: GPU Subdivision: "Show Wire" overlay glitch
Issue is caused by an off by one error which would map some edge loops to
the loops of some the next polygon in the list of polygon, which may not
be a topological neighbor.
2022-06-20 12:14:03 +02:00
088157e447 Cleanup: Add description of more mask editing poll functions
No functional changes.
2022-06-20 11:25:38 +02:00
e658c8851a Refactor: De-duplicate mask operator poll functions
The poll function with same semantic was defined in both screen and
mask space modules. The only reason for this seems to be that the
image editor needed a mask poll function which was private to the
mask module.

Make the mask editing poll functions public, avoiding code duplication.

Also, added a brief explanation about what the poll functions are
checking for.

No user-level changes are expected to happen.
2022-06-20 11:21:09 +02:00
f8cec1ff30 Cleanup: avoid duplicate lookups when setting the cursor
Also use `const char *` for cursor names as there isn't an advantage
in using `std::string`.
2022-06-20 12:18:36 +10:00
a76c1ddecc Fix setting the custom cursor for Hi-DPI displays in Wayland
Changing the cursor would intermittently close Blender's window
(without crashing).

This happened because the size of a cursor must be the a multiple of the
scale, for themed cursor this is always true but with custom cursors
it's not.

Separate theme scale from custom cursor scale to avoid this bug.
In the future we can support Hi-DPI custom cursors, for now they're
scale is always set to 1.
2022-06-20 12:12:05 +10:00
6e8217d35e GHOST/Wayland: refactor cursor handling & fix errors hiding the cursor
- Support showing & hiding the cursor without setting the buffer,
  needed to switch between software and hardware cursor.
- Track the state of the software/hardware cursor.

This resolves glitches switching between cursors sometimes hiding the
cursor.
2022-06-20 12:09:31 +10:00
Iyad Ahmed
6ad9d8e224 STL: Fix missing space in C++ .stl importer info output
Fixes C++ .stl importer info output having no space between the
number and the word after it.

Reviewed By: Aras Pranckevicius
Differential Revision: https://developer.blender.org/D15240
2022-06-19 17:42:58 +03:00
91b5254598 Fix T98874: new obj importer missing an option to import vertex groups
The old Python OBJ importer had a (somewhat confusingly named) "Keep
Vertex Order -> Poly Groups" option, that imported OBJ groups as
"vertex groups" on the resulting mesh. All vertices of any face were
assigned the vertex group, with a 1.0 weight.

The new C++ importer did not have this option. It was trying to do
something with vertex groups, but failing to actually achieve
anything :) -- the vertex groups were created on the wrong object
(later on overwritten by "nomain mesh to main mesh" operation);
vertex weights were set to 1.0/vertex_count, and each vertex was only
set to be in one group, even when it belongs to multiple faces from
different groups. End result was that to the user, vertex groups were
not visible/present at all (see T98874).

This patch adds the import option (named "Vertex Groups"), which is
off by default, and fixes the import code logic to actually do the
right thing. Tested on file from T98874; vertex groups are imported
just like with the Python importer.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D15200
2022-06-19 17:39:54 +03:00
cf8922ef57 Fix T97820: new OBJ importer wrongly producing "sharp" edges in some cases
The new OBJ importer is producing "sharp" edges on some meshes that
should be completely smooth. Only observed on UV-Sphere type meshes
so far (see T97820).

I'm not 100% sure what is the root cause, but my theory was that
maybe due to limited number of float digits that are printed for
vertex normals in the file, the normals that are read in are not
always exactly 1.0 length. And then the Blender's "set custom loop
normals" function (which expects normalized inputs) wrongly marks
some edges as sharp.

Adding explicit normalization for the normals that are read from the
file fixes the wrongly-sharp edges in test cases from T97820. I
have not observed measurable performance impact in importing large
models (e.g. 6-level subdivided Monkey) that contain vertex normals.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D15202
2022-06-19 17:38:32 +03:00
b7e193cdad BLI: avoid unnecessary allocation when converting virtual array 2022-06-19 14:52:51 +02:00
d48735cca2 Functions: speedup multi-function procedure executor
This improves performance of the procedure executor on secondary metrics
(i.e. not for the main use case when many elements are processed together,
but for the use case when a single element is processed at a time).

In my benchmark I'm measuring a 50-60% improvement:
* Procedure with a single function (executed many times): `5.8s -> 2.7s`.
* Procedure with 1000 functions (executed many times): `2.4 -> 1.0s`.

The speedup is mainly achieved in multiple ways:
* Store an `Array` of variable states, instead of a map. The array is indexed
  with indices stored in each variable. This also avoids separately allocating
  variable states.
* Move less data around in the scheduler and use a `Stack` instead of `Map`.
  `Map` was used before because it allows for some optimizations that might
  be more important in the future, but they don't matter right now (e.g. joining
  execution paths that diverged earlier).
* Avoid memory allocations by giving the `LinearAllocator` some memory
  from the stack.
2022-06-19 14:25:56 +02:00
575884b827 Update RNA Manual References 2022-06-18 18:14:54 -04:00
7bf306622e Constraints: handle the custom target at the constraint level.
Since the custom target is a feature implemented at constraint
level, it is more appropriate to handle it in the common wrapper
functions, instead of modifying all the type specific callbacks
like get_constraint_targets and flush_constraint_targets.

Also, tag the special target with a flag so other code can
handle it appropriately where necessary.

This was split from D9732, and effectively reverts and refactors
part of D7437. This patch should cause no functional changes.

Differential Revision: https://developer.blender.org/D15168
2022-06-18 18:43:02 +03:00
b8bd304bd4 Geometry Nodes: speedup Separate XYZ node
This speeds up the node ~20% in common cases, e.g. when only the
X axis is used. The main optimization comes from not writing to memory
that's not used afterwards anymore anyway.

The "optimal code" for just extracting the x axis in a separate loop was
not faster for me. That indicates that the node is bottlenecked by
memory bandwidth, which seems reasonable.
2022-06-18 13:41:08 +02:00
7d030213b2 GHOST/Wayland: implement getAllDisplayDimensions 2022-06-18 21:27:23 +10:00
cf3238c1c7 Fix initial window size being scaled down for Hi-DPI displays in Wayland
getMainDisplayDimensions return values were scaled by the UI-scale,
instead of returning pixel values.

Also correct an error accessing the rotated monitor size,
which happened to be harmless as the value isn't used at the moment.
2022-06-18 21:27:23 +10:00
ac4836af6a Cleanup: Remove unused argument, unnecessary struct keyword 2022-06-18 13:08:15 +02:00
30f244d96f Fix: curves have incorrect resolution attribute after realizing instances
If the resolution attribute existed on some curves, but not on others, it
was initialized to zero by default. However, zero is not a valid resolution.
2022-06-18 13:01:41 +02:00
3c2a2a6c96 Cleanup: Always store attribute name in attribute request
Previously the attribute name was only stored in the request for curves.
Instead, pass it as part of the "add request" function, so that it is
always used. Since the whole attribute pipeline is name-based,
this can simplify code in a few places.
2022-06-18 11:48:51 +02:00
8a3ff496a7 Cleanup: Remove unnecessary switch statement
The types are retrieved by the attribute matching above anyway,
there is no reason to have another switch based on the type.
2022-06-18 11:40:46 +02:00
498f079d2c GHOST/Wayland: support displaying custom software cursors
Add a method to access the custom cursor from GHOST which is used
for drawing a software cursor. This means the knife tools cursor now
work as expected.

Although non-custom cursors are still not supported.
2022-06-18 17:16:42 +10:00
881d1c9bc2 Fix crash in wayland when closing a window
The focus_pointer only pointer was only cleared when the window existed,
which caused a dangling focus_pointer when closing a window.
2022-06-18 16:50:25 +10:00
35b2b9b6e6 Fix T98793: Wayland clamps cursor movement fails with gnome-shell
The current gnome-shell (v42.2) has a bug where grabbing the cursor
doesn't scale the region when confining it to the window.

For Hi-DPI displays this means the cursor may be confined to a quarter
of the window, making grab unusable.

Even though this has been fixed up-stream the issue remains in the
latest release - so workaround the problem by implementing window
confined grab using a software cursor.

This is only used gnome-shell for displays that use Hi-DPI scaling.
2022-06-18 15:06:46 +10:00
5c814e75f2 GHOST: add GHOST_Rect.clampPoint method
Method for clamping a point inside a rectangle.
2022-06-18 14:33:50 +10:00
Ray Molenkamp
600c391a65 Cleanup: Compiler Warning of Sign Conversion #2
Second attempt to silence sign-conversion warning on Linux, introduced
in rB524a9e3db810. Confirmed fix on buildbot.
2022-06-17 13:59:25 -07:00
3d3c0dfe30 Cleanup: Compiler Warning of Sign Conversion
rB524a9e3db810 introduced sign-conversion warning on Linux.

Own Code
2022-06-17 12:46:37 -07:00
5b5811c97b USD: speed up large USD imports by not rebuilding material name map for each object
Previous code was rebuilding "name to material" map for each object
being imported. Which means O(N*M) complexity (N=object count,
M=material count). There was already a TODO comment suggesting that
a single map that's maintained for the whole import would be enough.
This commit does exactly that.

While importing Moana USD scene (260k objects, 18k materials) this
saves about 6 minutes of import time.

Reviewed By: Bastien Montagne
Differential Revision: https://developer.blender.org/D15222
2022-06-17 22:28:22 +03:00
230f72347a IO: speed up large Alembic & USD imports by doing fewer collection syncs
Previous code was doing N collection syncs when importing N objects
(essentially quadratic complexity in terms of object count). New
code avoids all the intermediate syncs by using
BKE_layer_collection_resync_forbid and
BKE_layer_collection_resync_allow, and then does one
BKE_main_collection_sync + BKE_main_collection_sync_remap for the
whole operation. The things done on the importer objects that are
dependent on the sync happening (marking them selected) are done in a
separate loop after the sync.

Timings: importing Moana USD scene (480k objects) on Windows, VS2022
Release build, AMD Ryzen 5950X: 12344sec -> 10979sec (saves 22 minutes).

Reviewed By: Bastien Montagne
Differential Revision: https://developer.blender.org/D15215
2022-06-17 22:22:30 +03:00
Patrick Huang
257b4d138c Fix T93446: search box active result does not reset when typing
Whenever the user edits the query in a search box, the active (highlighted)
result resets to the first. Previously, it would remain at the last
highlighted result, jumping around as the results update.

This is better than the previous behavior. If a user highlights a choice either
on purpose or by accidental mouse movement and continues to type, it is likely
that they are not looking for the currently highlighted choice, so setting it
to the top search result is more useful.

Differential Revision: https://developer.blender.org/D15211
2022-06-17 19:51:13 +02:00
Jim Eckerlein
33bad77043 Draco: update to version 1.5.2
Differential Revision: https://developer.blender.org/D15233
2022-06-17 19:40:01 +02:00
524a9e3db8 BLF: Fallback Font Stack
Allow use of multiple fonts acting together like a fallback stack,
where if a glyph is not found in one it can be retrieved from another.

See D12622 for much more detail

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

Reviewed by Brecht Van Lommel
2022-06-17 10:31:48 -07:00
5485057a27 Cleanup: compiler warnings 2022-06-17 19:18:47 +02:00
0ea173165b Revert "TEST COMMIT: API doc generation changes."
This reverts commit d86af60429.
2022-06-17 18:21:28 +02:00
9bae9d97b1 deps: fix llvm using system python
llvm was using system python, rather than our copy
this went unnoticed on both linux and windows until
sergey tried to build the deps on a clean system with
no system python installed.
2022-06-17 09:38:25 -06:00
d86af60429 TEST COMMIT: API doc generation changes.
This commit is intended to be reverted within a few minutes.

commit 50adc860a652508570dbc7102ef288049a9ffed4
Author: Bastien Montagne <bastien@blender.org>
Date:   Wed Jun 15 15:43:13 2022 +0200

    Py API Doc: add runtime changelog generation to `sphinx_doc_gen.py`.

    Optionally use `sphinx_changelog_gen.py` to dump current version of the
    API in a JSON file, and use closest previous one listed in given index
    file to create a changelog RST page for Sphinx.

commit 88fc683e78f866f1b3cda379c3b90e1f2916ce00
Author: Bastien Montagne <bastien@blender.org>
Date:   Wed Jun 15 15:36:19 2022 +0200

    Py API Doc: refactor changelog generation script.

    Main change is to make it use JSON format for its dump files, instead of
    some Python code.

    It also introduces an index for those API dump files, mapping a blender
    version to the relevant file path.

    This is then used to automatically the most recent (version-number wise)
    previous API dump to compare against current one, when generating the
    change log RST file.
2022-06-17 17:07:37 +02:00
3c0162295f Revert "TEST COMMIT: API doc generation changes."
This reverts commit 52b93c423d.
2022-06-17 17:03:32 +02:00
0d43117a40 Cleanup: deduplicate generating transform matrices in curves brushes 2022-06-17 16:57:36 +02:00
23662a9a84 Cleanup: simplify Add Curves brush 2022-06-17 16:57:36 +02:00
52b93c423d TEST COMMIT: API doc generation changes.
This commit is intended to be reverted within a few minutes.

commit 9442d8ef0f255d3c18b610b42aff71229904aaee
Author: Bastien Montagne <bastien@blender.org>
Date:   Wed Jun 15 15:43:13 2022 +0200

    Py API Doc: add runtime changelog generation to `sphinx_doc_gen.py`.

    Optionally use `sphinx_changelog_gen.py` to dump current version of the
    API in a JSON file, and use closest previous one listed in given index
    file to create a changelog RST page for Sphinx.

commit f7fb537078641d2e2de015c08554f5281ce9debd
Author: Bastien Montagne <bastien@blender.org>
Date:   Wed Jun 15 15:36:19 2022 +0200

    Py API Doc: refactor changelog generation script.

    Main change is to make it use JSON format for its dump files, instead of
    some Python code.

    It also introduces an index for those API dump files, mapping a blender
    version to the relevant file path.

    This is then used to automatically the most recent (version-number wise)
    previous API dump to compare against current one, when generating the
    change log RST file.
2022-06-17 16:39:36 +02:00
b8f489c65b Revert "TEST COMMIT: API doc generation changes."
This reverts commit 510f3fe9a9.
2022-06-17 16:30:42 +02:00
133095fff4 Curves: refactor Add brush
This splits out the code that samples points on a surface and the
code that initializes new curves. This code will be reused by D15134.

Differential Revision: https://developer.blender.org/D15216
2022-06-17 15:31:21 +02:00
18def163f8 Cleanup: Simplify syntax in curves draw cache file
Also remove some unnecessary logic and change a variable name.
2022-06-17 15:11:41 +02:00
f0b4aa5d59 LibOverride: Handle dependencies in both directions in partial override cases.
When creating etc. a liboverride based on a partial hierarchy
pre-selection (e.g: override hierarchy on the rig object of a
character), now all linked data also using that rig (e.g. all meshes
deformed by that armature) will also automatically be overridden.

This si achieved by following dependencies in the reversed order (from
used IDs to using IDs) when we find one tagged for override.
2022-06-17 14:10:51 +02:00
8d61ca5815 BKE_main: Relations: Add TO/FROM variants of processed flags.
In some cases, it can be usefull to distinguish when an entry has been
processed in which direction (`to` when handling ID pointers used by
the entry, `from` when handling ID using this entry).

Previous `MAINIDRELATIONS_ENTRY_TAGS_PROCESSED` tag is now a combination
of the two new ones.
2022-06-17 14:10:51 +02:00
2c1bffa286 Cleanup: add verbose logging category names instead of numbers
And use them more consistently than before.
2022-06-17 14:08:14 +02:00
24246d9870 Cleanup: replace uint4 by AttributeMap struct 2022-06-17 14:08:14 +02:00
Chris Clyne
838c4a97f1 Geometry Nodes: new Volume Cube node
This commit adds a Volume Cube primitive node. It outputs a volume that
contains a single "density" float grid. The density per voxel can be
controlled with a field that depends on the voxel position (using the
existing Position node). Other field inputs are not supported.

The density field is evaluated on every voxel.

Possible future improvements are listed in D15198.

Differential Revision: https://developer.blender.org/D15198
2022-06-17 13:30:44 +02:00
75489b5887 Geometry Nodes: tweak Volume to Mesh threshold declaration
* Remove the minimum value, because that doesn't make sense in general.
* Add a description.
2022-06-17 13:30:44 +02:00
d54eb5ed20 Fix crash invoking layer add/remove operators without mask 2022-06-17 12:14:30 +02:00
510f3fe9a9 TEST COMMIT: API doc generation changes.
This commit is intended to be reverted within a few minutes.

commit 088497c870630d9b0d405aaa5fd796c77b380731
Author: Bastien Montagne <bastien@blender.org>
Date:   Wed Jun 15 15:43:13 2022 +0200

    Py API Doc: add runtime changelog generation to `sphinx_doc_gen.py`.

    Optionally use `sphinx_changelog_gen.py` to dump current version of the
    API in a JSON file, and use closest previous one listed in given index
    file to create a changelog RST page for Sphinx.

commit 91801f47ad03f4739e97ae4b4edee09687e2cb85
Author: Bastien Montagne <bastien@blender.org>
Date:   Wed Jun 15 15:36:19 2022 +0200

    Py API Doc: refactor changelog generation script.

    Main change is to make it use JSON format for its dump files, instead of
    some Python code.

    It also introduces an index for those API dump files, mapping a blender
    version to the relevant file path.

    This is then used to automatically the most recent (version-number wise)
    previous API dump to compare against current one, when generating the
    change log RST file.
2022-06-17 10:46:06 +02:00
10981bc8c0 Fix T98944: Uninitialized XRFrameState can prevent VR/OpenXR viewing
This provides a workaround for the VR session stopping due to an error
in locating controller poses. The problem was that for the actions sync
on the first frame, the session's XrFrameState/predicted display time
had not been initialized yet, which led to an error in xrLocateSpace()
(the error was only observed for some OpenXR runtimes since the first
frame pose state would be inactive for other runtimes, skipping the
call to xrLocateSpace()).

The timing of action updates relative to frame state updates could be
reworked in the future, but for now simply check for a valid display
time to avoid an error on the first frame.
2022-06-17 17:25:48 +09:00
18960c08fd UI: Custom Properties - Rename properties to remove "Use/Is"
There is no need to have use/is in the final name. This is implicitly
represented by the checkbox already.

This does not change the Python API, only the names we show in the user
interface.

* Is Library Overridable -> Library Overridable
* Use Soft Limits -> Soft Limits

Differential Revision: https://developer.blender.org/D15217
2022-06-17 10:08:17 +02:00
96764c3a1f Cleanup: Remove redundant doxygen section
Also remove const for the object argument, since the object data
is logically modified by generating the data.
2022-06-17 09:44:46 +02:00
9830603620 GHOST/Wayland: skip cursor surface operations when hiding the cursor
Also set the buffer scale before setting the cursor (matching SDL).
2022-06-17 17:35:44 +10:00
f59418fd92 Cleanup: use booleans for GHOST C-API
Also use GHOST_ prefix for public functions.
2022-06-17 17:18:06 +10:00
5cda99ff52 Cleanup: clang-tidy for GHOST 2022-06-17 17:15:06 +10:00
c756d08b4a Cleanup: remove redundant string formatting 2022-06-17 17:14:00 +10:00
1152a437e0 Cleanup: remove r_ prefix for non-return values 2022-06-17 17:13:59 +10:00
0ff7a7b3b5 Fix T98663: Eevee compilation error cryptomatte shaders.
On MacOS Eevee cyptomatte shaders fails as it doesn't ignore the `attrib_load`
parameter. I validated that removind the parameter works on Linux/AMD and MacOS
Intel. It could be that there are other platforms that require the dummy parameter.

If this should use a forward declaration and implement an emoty function in the
cryptomatte vertex shader.
2022-06-17 08:25:21 +02:00
62346abc02 Cleanup: spelling in comments 2022-06-17 07:33:06 +10:00
483bc6c9c1 Cleanup: unused variable warning 2022-06-17 07:23:21 +10:00
e2975cb701 Geometry Nodes: add 'Intersecting Edges' output for boolean node
This patch adds a 'Intersecting Edges' output with a boolean selection
that only gives you the new edges on intersections.

Will work on a couple of examples next, this should make some
interesting effects possible (including getting us closer to the "bevel-
after-boolean-usecase")

To achieve this, a Vector is passed to `direct_mesh_boolean` when the
iMesh is still available (and intersecting edges appended), then from
those edge indices a selection will be stored as attribute.

Differential Revision: https://developer.blender.org/D15151
2022-06-16 20:34:27 +02:00
209bf7780e UI: Add file browser operator to edit directory field
This allows using a shortcut from the file browser to edit the directory
path. The shortcut Ctrl + L is quite standard and used in multiple
GNU/Linux desktop desktop environments, Windows, as well as most web
browsers. Safari on macOS uses Cmd + L.

Reviewed by: Jacques Lucke, Julian Eisel

Differential Revision: https://developer.blender.org/D15196
2022-06-16 19:46:37 +02:00
650d2f863d Cleanup: Use const in File Browser filtering operator 2022-06-16 19:46:37 +02:00
b6b5f317a3 Revert "Revert "Revert "TEST COMMIT: API doc generation changes."""
This reverts commit 5a30fe29ef.
2022-06-16 19:35:55 +02:00
23d2e77a54 UI: Add initial "grid view"
Part of T98560.
See https://wiki.blender.org/wiki/Source/Interface/Views

Adds all the basic functionality needed for grid views. They display
items in a grid of rows and columns, typically with a preview image and
a label underneath. Think of the main region in the Asset Browser.

Current features:
- Active item
- Notifier listening (also added this to the tree view)
- Performance: Skip adding buttons that are not scrolled into view
  (solves performance problems for big asset libraries, for example).
- Custom item size
- Preview items (items that draw a preview with a label underneath)
- Margins between items scale so the entire region width is filled with
  column, rather than leaving a big empty block at the right if there's
  not enough space for another column (like the File and current Asset
Browser does it).
- "Data-View Item" theme colors. Not shown in the UI yet.

No user visible changes expected since the grid views aren't used for
anything yet.

This was developed as part of a rewrite of the Asset Browser UI
(`asset-browser-grid-view` branch), see T95653. There's no reason to
keep this part in a branch, continuing development in master makes
things easier.

Grid and tree views have a lot of very similar code, so I'm planning to
unify them to a degree. I kept things separate for the start to first
find out how much and what exactly makes sense to override.
2022-06-16 19:25:50 +02:00
69d3f41d75 Cleanup: Spelling in comment 2022-06-16 17:36:58 +02:00
6562a11c60 Cleanup: use proper variable name
The `SpaceClip *sc` got incorrectly renamed to `SpaceClip *screen`
in the ad85989a3f.
2022-06-16 16:58:33 +02:00
dc11e1164a Fix T98796: avoid unnecessary mesh copy
The call to `get_component_for_write` would sometimes copy the mesh
even when the mesh is replaced with itself. The `replace_mesh` method
handles that case already, so just use that instead.
2022-06-16 16:45:31 +02:00
947ece8d39 LineArt: Variable name cleanups.
Use more descriptive names for some of the two character variables.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D15192
2022-06-16 22:43:53 +08:00
8b9469ec36 Cleanup: Fix build for make lite and add . to code comments
Issue introduced on e6eefdd402.
2022-06-16 16:37:54 +02:00
5a30fe29ef Revert "Revert "TEST COMMIT: API doc generation changes.""
This reverts commit 502089f275.

Enable again temporarily the new test code for API doc generation.
2022-06-16 16:36:42 +02:00
e0c966a3b9 Fix T98904: GPencil sculpt brushes break after you delete a brush
There were two problems here:

1) Console warnings due to brush was None.
2) It was impossible to recreate a brush.

This patch fixes both issues and it is now possible to recreate any brush.

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

Reviewed by: @dflelinto
2022-06-16 16:29:11 +02:00
49b068bc63 Fix T98847: missing null check in versioning code
It's perfectly legal for `nmd->settings.properties` to be null if
there are no properties.
2022-06-16 16:23:45 +02:00
Hamdi Ozbayburtlu
e6eefdd402 Fix T86076: MPEG Settings Ignored at Render
Add a RNA update function for output video codec setting to update
properties that are incompatible with defaults.

Previously video output bitrate settings were omitted because of the
Constant Rate Factor (CRF) default. CRF setting for video codec is only
available for H264, MPEG4 and WEBM/VP9 outputs, so for the others
changing encoder quality mode to constant bitrate (CBR) as CRF is not
supported.

Reviewed By: ISS, mano-wii

Differential Revision: https://developer.blender.org/D15201
2022-06-16 16:03:37 +02:00
dce03ecd5c LibOverride: 3DView: simplification and improvements of override creation.
This commit:
* Removes the popup to choose the root collection when called with a
  linked object selected (in typical cases there is only one valid
  option, if more then the operator fails and report to the user).
* Ensures that the linked reference of newly overridden collections are
  also removed from the ViewLayer (i.e. their local parent collections).
2022-06-16 15:58:40 +02:00
798b49109b ID Type: Sort the items alphabetically
This also renames Hair Curves to Curves. Meaning that until we get
rid of the old curve type we will have both of those entires there:

* Curve
* Curves

This rna enum is used among other things in the driver UI to pick
which data-block you want the property from.
2022-06-16 15:25:09 +02:00
9bed68de13 Fix T98860: VectorProperty type renamed to COORDS (breaking scripts)
Regression in [0] unintentionally renamed COORDINATES.
There was a naming discrepancy when two (nearly) identical arrays,
de-duplicating them caused the error.

[0]: 94444aaadf
2022-06-16 18:10:02 +10:00
36307d8fba Fix (studio-reported) broken 'system override' filtering in liboverride view of the Outliner.
Regression from recent rB717ab5aeaecc.
2022-06-16 09:56:15 +02:00
1064bf58c3 Cleanup: differentiate region/screen relative coordinates
- Avoid ambiguity which caused these values to be confused, use `mval`
  for region relative mouse coordinates, otherwise `event_xy`.

- Pass region relative coordinates to sample_detail_dyntopo &
  sample_detail_voxel as there is no reason to use screen-space values.

- Rename invalid use of mval for screen-space coordinates.
2022-06-16 16:32:35 +10:00
b19751bee2 Fix mouse coords for sculpt ignore background click, sample voxel detail
Both operations used screen-relative coordinates when region-relative
coordinates were expected.
2022-06-16 15:57:28 +10:00
65b1b1cd34 GHOST/Wayland: workaround inability to access window position
Wayland doesn't support accessing the position making functionality that
would map events to other windows fail, sometimes considering windows
overlapping when they weren't (as all window positions were zeroed).

Disable dragging between windows when accessing the window the position
isn't supported.
2022-06-16 15:22:46 +10:00
a17f74ab34 Fix memory leak plugging in new keyboards in wayland 2022-06-16 14:55:37 +10:00
0d644e6d06 Cleanup: return const vector for system & window outputs() method
Move the enter/leave logic into methods so the method can return a const
vector which isn't to be manipulated from other functions.
2022-06-16 14:27:57 +10:00
9dd5c2a7ec Fix error selecting the window scale in wayland
Regression in [0] caused all output to be considered when updating
after monitor outputs changed.

[0]: ac2a56d7f3
2022-06-16 14:18:45 +10:00
1fed24de5a GHOST/Wayland: acquire locks before freeing data on exit 2022-06-16 12:29:22 +10:00
409c62aa61 Fix missing free for drag & drop data with GHOST/Wayland 2022-06-16 12:29:20 +10:00
02012b0cce GHOST/Wayland: account for fractional scale when picking the output
Finding the output with the largest scale now checks fractional scaling.

While this is only a minor difference in most cases, it makes the scale
deterministic instead of depending on the order outputs are added.
2022-06-16 12:29:18 +10:00
fa99323f09 Cleanup: quiet compiler warnings 2022-06-16 12:29:10 +10:00
e6e9f1ac5a Fix T98239: During UV Unwrap, create unique indices for each pinned UV
Originally reported in T75007.

Differential Revision: https://developer.blender.org/D15199
2022-06-16 09:53:50 +12:00
Iyad Ahmed
2804497312 io: remove unnecessary transposes when using mat3_from_axis_conversion
Some I/O code paths (Collada, OBJ) were using mat3_from_axis_conversion
followed by transpose_m3, instead of swapping the axis arguments
which achieves exactly the same result.

Reviewed By: Aras Pranckevicius
Differential Revision: https://developer.blender.org/D15158
2022-06-15 21:46:38 +03:00
43ddfdb1a5 Fix T98909: Outliner - "Show Hierarchy" only shows one level
Error in a4a7af4732.

To allow deleting tree elements while iterating, the new iterators would
get needed data out of the tree element before calling the iterator
callback. This included the info if the element is open or collapsed. So
if the callback would open or collapse elements, the iterator wouldn't
respect that change. Luckily the way the open/collapsed state is stored,
we can still query it after the callback is executed, without having to
access the (possibly freed) tree element.
2022-06-15 20:14:29 +02:00
653100cd65 obj: reduce vertex colors to 4 decimal places, reenable tests
OBJ vertex color related tests were not producing identical results
across various platforms, primarily due to sRGB<->Linear color space
conversions.

While D15193 has just made the color space conversion accuracy match
much closer between platforms, it's still not 100% the same.

This change reduces the amount of decimal places used for exporting
vertex colors, to 4 digits (down from 6). Vertex normals were
already always printed with 4 digits, and colors are conceptually
similar (usually 0..1 range etc.).

This makes the vertex color tests pass again, so re-enable them
after adjusting to 4 decimals expectations.
2022-06-15 21:05:35 +03:00
004d858138 math: improve accuracy of Linear->sRGB conversion SIMD path
srgb_to_linearrgb_v3_v3 is using an approximation of powf that is
SIMD. However, while the accuracy of it is ok, a larger issue is that
it produces different results on Intel compared to ARM architectures.

On ARM (e.g. AppleSilicon), the result of the SIMD code path is much
closer to the reference implementation. This seems to be because of
_mm_rsqrt_ps usage in _bli_math_fastpow512. The ARM/NEON code path
emulates inverse square root with a combination of vrsqrteq_f32
followed by two Newton-Raphson iterations, because blender uses the
SSE2NEON_PRECISE_SQRT define.

This commit adds similar NR iterations to the "actual SSE" code path
as well.

Max error of srgb->linear->srgb conversion roundtrip goes from
0.000211 down to about 0.000062.

Reviewed By: Sergey Sharybin
Differential Revision: https://developer.blender.org/D15193
2022-06-15 20:51:25 +03:00
7e89bbb2ff UI: Implement icons for the curve sculpt tools brushes
I'm using the tool icons for the brush themselves.

Note: This includes a few brushes that are only defined in D15134.
Those are simply the icons rendered with a world background of #282828.
2022-06-15 18:59:33 +02:00
0a3650210f UI: Fix sculpt curve not being able to get brush icons
This commit doesn't add the brush icons themselves, but
it fix the code that allow them to be used.
2022-06-15 18:31:13 +02:00
d3edb3cfc7 Fix missing translation hint in tracking code
Is likely harmless due to Camera being covered by other areas,
but is still good to do a proper hint.
2022-06-15 17:15:05 +02:00
502089f275 Revert "TEST COMMIT: API doc generation changes."
This reverts commit 298372fa06.
2022-06-15 17:11:00 +02:00
298372fa06 TEST COMMIT: API doc generation changes.
This commit is intended to be reverted within a few minutes.

commit 39ffb045a52d16994c1c87ccf3249ff3222a8fca
Author: Bastien Montagne <bastien@blender.org>
Date:   Wed Jun 15 15:43:13 2022 +0200

    Py API Doc: add runtime changelog generation to `sphinx_doc_gen.py`.

    Optionally use `sphinx_changelog_gen.py` to dump current version of the
    API in a JSON file, and use closest previous one listed in given index
    file to create a changelog RST page for Sphinx.

commit fbe354d3fcfa2ad1ed430c3c27e19b99a0266dda
Author: Bastien Montagne <bastien@blender.org>
Date:   Wed Jun 15 15:36:19 2022 +0200

    Py API Doc: refactor changelog generation script.

    Main change is to make it use JSON format for its dump files, instead of
    some Python code.

    It also introduces an index for those API dump files, mapping a blender
    version to the relevant file path.

    This is then used to automatically the most recent (version-number wise)
    previous API dump to compare against current one, when generating the
    change log RST file.
2022-06-15 16:48:30 +02:00
f0fa90e156 GPencil: Fix crash when using time offset modifier
This fixes a mistake in 60bf561d37, which did not account for offset
frames by the time offset modifier.
2022-06-15 16:15:45 +02:00
fe988f6c7f depsbuilder: build_deps.cmd look for pythonw rather than python
There is a check to be sure no system python is in the path
on windows to be sure deps do not accidentally build against it.

The problem arises on certain versions of windows that ship a
python.exe that just opens up the MS store to download their
python version. The check takes this to be a real python
installation and refuses to build.

This change fixes the issue by looking for pythonw.exe which a
real python install would have, but the MS store opening one that
windows ships (as of now) would not.
2022-06-15 07:47:28 -06:00
60bf561d37 Fix T98853: Blender crashes when moving grease pencil object has any invisible layers
Whats happening is that the modifier keeps adding new frames to the evaluated object resulting in an exponential increase. This is because when preparing the data for the modifiers we only copy visible strokes to the eval object. But the modifiers do not consider visibility and will generate the mirrored strokes even for layers that are hidden. Because those layers have not been copied (only their structure) we run into this issue.

The solution is always copy the active frame of all layers (even if the layer is hidden).
2022-06-15 15:37:39 +02:00
Kevin Curry
2e33172719 Assets: Don't show duplicated catalog name when dragging assets
While dragging assets over a catalog, we would show both the name and
the full catalog path in the drag tooltip. For catalogs at the root
level (catalogs without parents) the name and the full path are the
same, so it would just display the name twice. This is more confusing
than helpful. Now skip displaying the full path in that case.

Reviewed by: Julian Eisel
Addresses T92855

Differential Revision: https://developer.blender.org/D15190
2022-06-15 15:27:20 +02:00
15b4120064 Make Instance Face: Support instanced collections too
Differential Revision: https://developer.blender.org/D15204
2022-06-15 13:53:37 +02:00
41053deba4 GPencil: Avoid console warnings when no Sculpt brush selected
If the brush is deleted, the panel must not be filled.

To recreate the missing Brush is necessary to use `Reset All`

This fix part of T98904
2022-06-15 13:30:14 +02:00
2e6cd70473 Clip editor: Default to average error sort in dopesheet
This is what we agreed on during the workshop.

Differential Revision: https://developer.blender.org/D15194
2022-06-15 12:37:35 +02:00
216a2c0f37 Clip editor: Use Ascending/Descending order instead of "Inverse"
This is more intuitive for artists.
2022-06-15 12:37:31 +02:00
c1a231f40b Clip editor: Sort tracks alphabetically when they have matched error
Is nice to ensure order of tracks when their error is the same or
is not known yet (the clip was not solved yet).
2022-06-15 12:37:31 +02:00
412c468893 UI: Icons - Rename Density and Slide sculpt curve icons
Those tools will get renamed to follow the standard we have
for the other tools (i.e., add sculpt_ in their name).
2022-06-15 11:46:08 +02:00
7cc8f2743e Cleanup: remove redundant key entry from key_repeat_payload_t 2022-06-15 19:33:41 +10:00
e550e400cd Cleanup: internalize struct members for internal wayland types
Missed from 9978689595.
2022-06-15 19:33:41 +10:00
ea39d808b5 Fix T98765: Regression: Unable to select mask points in clip editor
Re-organize de-selection so that there is less conflict between tracking
and masking operators.

Still not fully ideal: the LMB selection does not de-select everything
now since the `mask.select` with `deselect_all` is only added to the
keymap when the RMB is the select mouse. While this is sub-optimal, this
seems to be how mask selection behaved in the Image Editor in 3.1.

Not sure it worth looking into a more complete fix, as it will likely be
too big to be safe for a corrective release.

Differential Revision: https://developer.blender.org/D15183
2022-06-15 10:24:04 +02:00
fc79b17dce GHOST/Wayland: add NULL pointer checks on window access
There were a few callers that missed checking a NULL return value
which can happen in rare cases.
2022-06-15 18:12:09 +10:00
66483c58eb Cleanup: avoid static_cast when accessing wayland windows
Rename get_window to window_from_surface and return a
GHOST_WindowWayland instead of an GHOST_IWindow since most callers
needed to cast. It also makes sense that an call for accessing windows
would return the native type.
2022-06-15 17:54:28 +10:00
f5dae5844c Fix T98699: Face dot colors in UV editor was using wrong color from theme 2022-06-15 19:41:37 +12:00
9978689595 Cleanup: various minor changes to wayland internal conventions
- Initialize values in the struct declarations
  (help avoid accidental uninitialized struct members).
- Use `wl_` prefix for some types to avoid e.g. `output->output`.
- Use `_fn` suffix for locally defined function variables.
- Use `_handle_` as separator for handlers, making function names easier
  to follow as this separates the handler name from the interface.
- Add doxy sections for listeners in GHOST_WaylandWindow.cpp.
2022-06-15 17:38:54 +10:00
f7bfbc357c Fix T98708: Crash on startup - OpenGL4.2 without conservative depth.
Intel iGPU (HD4000) supports OpenGL 4.4 but doesn't support conservative
depth. (GL_ARB_conservative_depth). This change will only check for the
availability of the extension.
2022-06-15 09:12:22 +02:00
b83f33ffca Cleanup: Miscellaneous improvements to draw attribute extraction
- Remove unnecessary braces in switch statements
- Move `default` to the end of other switch items
- Use camel case for type names
- Use `BLI_assert_unreachable()`
2022-06-15 09:07:26 +02:00
4acbb84efa GHOST/Wayland: resolve glitch drawing the software cursor
When grab was disabled, the software cursor would remain displayed
in the image view. Ensure an additional redraw is done to clear the
cursor.
2022-06-15 15:45:50 +10:00
2770010224 GHOST/Wayland: fractional scaling support
GHOST_GetDPIHint now returns a value that takes fractional scaling into
account. Otherwise the integer scale is used since Wayland's API's use
integer scale values exclusively.

Use the same method as SDL to calculate the fractional scale.
2022-06-15 15:30:44 +10:00
08f5219d1c Cleanup: use int32_t[2] for Wayland display size variables 2022-06-15 14:34:06 +10:00
46f93ac6be Cleanup: unused argument warning 2022-06-15 14:30:07 +10:00
04a75c90d5 Cleanup: Move function definition to correct file
Function `SEQ_transform_handle_overlap` was declared in sequencer module
header file, but it was defined in editor/transform module.

Move definition to sequencer module.
2022-06-14 22:24:36 +02:00
20ba130315 Fix T72831: Incorrect animation handling when strips overlap
Function `SEQ_transform_seqbase_shuffle_time` did not have access to
strip effects, and therefore could not handle their animation. Since
now transformation knows what strips can't be directly moved, but their
position depends on other strips, this collection of strips is passed as
argument, so animation can be offset correctly.
2022-06-14 21:55:59 +02:00
a59fedb0bf Fix T98168: Meta strips do not copy animation to another scene
Copy animation for strips that are inside metas.
2022-06-14 20:13:45 +02:00
6737f89e49 Fix T98718: Face Is Planar Node Not handling Certain Conditions
The comparison between dot products of each point of the poly were
not taking into consideration negative values. FLT_MIN was used rather
than -FLT_MAX due to a misunderstanding of the FLT_MIN definition.

Maniphest Tasks: T98718

Differential Revision: https://developer.blender.org/D15161
2022-06-14 12:53:50 -05:00
7a24fe372c Fix T98879: PBVH active attrs only optimization is buggy
PBVH draw has an optimization where it only sends the
active attribute to the GPU in workbench mode.  This
fails if multiple viewports are open with a mix of
workbench and EEVEE mode; it also causes severe lag
if any workbench viewport is in material mode.

There are two solutions: either add the code in sculpt-dev
that checks for EEVEE viewports at the beginning of each frame,
or integrate pbvh draw properly inside the draw manager
and let it handle which attributes should go to the GPU.
2022-06-14 10:02:30 -07:00
f5e7221fbd Cleanup: Fix const correctness of attribute search function
Retrieving a mutable custom data layer from a const ID
should not be possible.
2022-06-14 17:26:07 +02:00
b690f4c2e6 Fix T98875: Adding camera background image shows error
Don't show an error if no operator property is set at all that can be
used to find an image file or ID for dropping. The caller can decide if
this is an error that needs reporting or a valid case, like it is here.
2022-06-14 17:07:40 +02:00
06780aa4e6 Fix T98797: VSE Slip Strip Contents doesn't work properly
Caused by oversight in 7afcfe111a - code relied on fact, that strip
boundary holds old value until updated.

Calculate new offsets based on stored orignal offsets.
2022-06-14 17:04:19 +02:00
25f18e6c49 Cleanup: Snake case for variable name 2022-06-14 16:41:43 +02:00
0f06de8072 Attributes: Add null check in color attribute duplicate operator
It's potentially possible that the attribute duplication could fail,
for whetever reason. There is no great reason not to be safe in
this high-level code.
2022-06-14 16:41:43 +02:00
58a67e6fb6 Attributes: Adjustments to duplicate attribute API function
Use a name argument, for the same reasons as 6eea5f70e3.
Also reuse the layer and unique name creation in `BKE_id_attribute_new`
instead of reimplementing it. Also include a few miscellaneous cleanups
like using const variables and `std::string`.
2022-06-14 16:41:43 +02:00
3012eca350 Fix T98700: Regression: Crash when recursively nesting NLA meta strips
The `update_active_strip_from_listbase()` function took meta-strips in
the "source" list into account, but didn't recurse into the
corresponding meta-strip of the "destination" list. This is now fixed.

`update_active_strip_from_listbase()` needed a few changes to resolve
the issue:
- It was renamed to `find_active_strip_from_listbase()` to limit its
  reponsibility to just finding the active strip. It now leaves the
  assignment to the caller. This reduces the number of parameters by 1
  and makes recursion simpler.
- The destination strips are now, like the source strips, passed as
  `ListBase`, so that both source & dest can be recursed simultaneously.
2022-06-14 16:25:20 +02:00
67254ea37c Outliner: Sanitize material unlinking callback, report errors
The callback would just assume that it's only called on materials, which
may in fact not be the case. It could also be called for other ID types
and layer collections (see `outliner_do_libdata_operation()`). Properly
check this now.

Also avoid faling silently when the object or object-data to unlink from
couldn't be determined. Report this to the user. Operators that just do
nothing are confusing.
2022-06-14 16:21:12 +02:00
e772087ed6 Fix T98753: Outliner Unlink material in Blender File mode crashes
This issue was only exposed by ba49345705. The ID pointer of the
material's parent tree-element wasn't actually pointing to an ID, but to
the list-base containing the IDs. It was just unlikely to cause issues
in practice, although an assert was thrown.

Just don't do anything if the object or object-data to unlink the
material from could not be found. The following commit will introduce a
error message about this.
2022-06-14 16:21:12 +02:00
c7942c31b2 Fix: Don't allow duplicate color attribute operator in edit mode
The internal function relies on `CustomData_copy_data_layer` currently,
which doesn't work for BMesh. Support could be added as a special case
for BMesh, but in the meantime avoid bugs by just changing the poll.
2022-06-14 16:01:52 +02:00
ca9d65cc97 Fix T98813: crash with GPU subdiv in edit mode and instanced geometry
Instancing with geometry nodes uses just the evaluated Mesh, and ignores the
Object that it came from. That meant that it would try to look up the subsurf
modifier on the instancer object which does not have the subsurf modifier.

Instead of storing a session UUID and looking up the modifier data, store a
point to the subsurf modifier runtime data. Unlike the modifier data, this
runtime data is preserved across depsgraph CoW. It must be for the subdiv
descriptor contained in it to stay valid along with the draw cache.

As a bonus, this moves various Mesh_Runtime variables into the subsurf runtime
data, reducing memory usage for meshes not using subdivision surfaces.

Also fixes T98693, issues with subdivision level >= 8 due to integer overflow.

Differential Revision: https://developer.blender.org/D15184
2022-06-14 14:54:25 +02:00
4e96d71ddb Render report: better wording for reference image updating
The old text was suggesting to run `BLENDER_TEST_UPDATE=1 ctest` for
failed tests. Now it's more clear that this is for the regeneration of
reference (ground truth) images, and that it will not touch passing test
cases.

It now also mentions to commit the new reference images to SVN, driving
the point home that this is for updating those, and not for making
failing tests succeed in general.

Over-the-shoulder reviewed by: @sergey
2022-06-14 13:02:39 +02:00
Sonny Campbell
d209629806 Fix T85729: Crash when exporting for USD and Alembic
Ensure the "null" node graph, which is the root node of the export
graph, always exists.

The crash occured when "Use Settings For" was set to Render, "Visible
Objects Only" was ticked, and a single parent object is in the scene but
disabled for render.

Because the only object attached to the root of the project was disabled
for export, there was no "null" root node added to the export graph.
This change will always add an empty "null" node with no children to the
graph at the start. Other objects will get added to its children as
required.

Reviewed By: sybren

Maniphest Tasks: T85729

Differential Revision: https://developer.blender.org/D15182
2022-06-14 12:29:56 +02:00
28f4fc664f Cleanup: Variable name style in STL importer
Designate private variable names as described by the style guide,
and also add `num` at the end of variable names rather than at
the beginning, as discussed in T85728.
2022-06-14 12:04:58 +02:00
4475c38c5c Fix T98715: Crash drag-dropping collection from outliner to ID property
The value of disabled buttons shouldn't be changed through dropping onto
it. Check for the disabled state in the drop operator poll, so the
dragging code will change the cursor to show that dropping isn't
possible at the given cursor location.
2022-06-14 11:56:51 +02:00
06e0776175 obj: disable vertex color tests until it produces identical results across platforms 2022-06-14 12:53:41 +03:00
e903403b41 Curves: support adding keymap items for operators
* Add a new keymap for `curves.*` operators. This is mainly for
  edit mode operators, but since we don't have edit mode yet,
  these operators are also exposed in sculpt mode currently.
* Fix the naming of the "sculpt curves" keymap.
2022-06-14 10:53:06 +02:00
c654a92237 Fix use after free error in 827fa81767 2022-06-14 18:01:51 +10:00
c1d295e905 Fix crash in 827fa81767
Missing null pointer check.
2022-06-14 17:36:18 +10:00
e1f15e3b32 Fix T98782: ignore OBJ face normal indices if no normals are present
Some OBJ files out there (see T98782) have face definitions that
contain vertex normal indices, but the files themselves don't
contain any vertex normals. The code was doing a "hey, that's an
invalid index" and skipping these faces. But the old python importer
was silently ignoring these normal indices, so do the same here.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D15177
2022-06-14 10:23:28 +03:00
1b4f35f6a5 obj: vertex colors support in importer and exporter
Adds support for vertex colors to OBJ I/O.

Importer:

- Supports both "xyzrgb" and "MRGB" vertex color formats.
- Whenever vertex color is present in the file for a model, it is
  imported and a Color attribute is created (per-vertex, full float
  color data type). Color coming from the file is assumed to be sRGB,
  and is converted to linear upon import.

Exporter:

- Option to export the vertex colors. Defaults to "off", since not
  all 3rd party software supports vertex colors.
- When the option is "on", if a mesh has a color attribute layer,
  the active one is exported in "xyzrgb" form. If the mesh has
  per-face-corner colors, they are averaged on the vertices.
  Colors are converted from linear to sRGB upon export.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D15159
2022-06-14 10:19:02 +03:00
827fa81767 Fix cursor coordinates being quantized to the window scale in Wayland
- Apply the scale before converting cursor coordinates to int.
- Store sub-pixel cursor coordinates internally since
  this is what Wayland uses.
- Use `wl_fixed_t xy[2]` for storing coordinates as it simplifies
  assigning/passing x/y coordinates to an argument / variable.
- Also fix drag-and-drop coordinates which ignored scale.
2022-06-14 16:59:33 +10:00
f001c85772 Cleanup: don't define wayland window methods as private
This meant the system couldn't call window methods unless the window
was cast to GHOST_Window.
2022-06-14 15:07:24 +10:00
97f894881c GHOST/Wayland add tablet support
Add support for tablet pressure, tilt and type detection
(eraser, pen.. etc).

There is currently an inconsistency where the tablets cursor is scaled
larger than the mouse cursor (when the UI is scaled). Although there
doesn't seem to be a way to control this from the client.
2022-06-14 14:53:41 +10:00
74e9605455 blend_render_info: minor improvements to file parsing
- Stop once `ENDB` is reached, as files could include additional data.

- Prevent the possibility of an infinite loop from malformed BHEAD
  blocks that could seek backwards in the file.
2022-06-14 14:30:15 +10:00
6c31bd80e3 Cleanup: spelling 2022-06-14 14:30:13 +10:00
b5a5c24396 Cleanup: redundant function calls 2022-06-14 14:30:11 +10:00
0bd6b3e5a0 Cleanup: unused argument, variable warnings 2022-06-14 14:30:09 +10:00
f89ea052f7 Cleanup: remove the need for image scale using a context
Scaling an image shouldn't depend on the current context.
2022-06-14 14:30:06 +10:00
9a063e85a5 Cleanup: quiet unused variable warning 2022-06-14 14:30:04 +10:00
67f5596f19 Fix T98866: GPU subdiv crash in edit mode with loose geometry
The BMesh case was missing when extracting the loose edges flags used for
display, so the code was crashing on unitialized `MEdge` pointer.
2022-06-14 01:39:28 +02:00
77b34a00f9 Fix T97987: Can not keyframe strip mirror in Y axis
Property shared row with toggle for mirror in X axis, so clicking on
decorator added only keyframe for X axis toggle.
2022-06-13 22:35:36 +02:00
afde12e066 Outliner performance: Only expand sub-trees if needed
Before this, we would build the sub-trees of some elements, just to
remove them afterwards. In big files, this would sometimes build ten
thousands of elements unnecessarily. Now support not building those
sub-trees in the first place.

Performance tests in a Sprite Fright production file (release build):
- View Layer display mode, reduced Outliner tree rebuilding from ~45ms
  to 12-17ms
- Library Overrides display mode, Hierarchies view, reduced tree
  rebuilding from 5-6s(!) to 220ms
2022-06-13 22:06:08 +02:00
988fc24930 Fix T93500: Sequence.fps returns 0 when proxy is used
Caused by `seq_open_anim_file` early returning if anim struct exists,
exen if it's not initialized. To ensure `anim` struct is initialized
when `openfile` argument is true, don't do early return.
2022-06-13 20:46:39 +02:00
3b7ce70232 Fix T94499: Knife missed clipping check
The knife BVH raycast functionality was missing a check to discard
points which were clipped.
2022-06-13 19:28:48 +01:00
1c5f09e8a8 Fix T93469: Image not moving in proportion to mouse
Apply scale factor when preview aspect ratio is not 1:1.
2022-06-13 20:12:35 +02:00
1243c2bdae Fix VSE: Effect strip has length of 1 frame when added
Length was set properly when added, but it was clamped by function
`seq_time_effect_range_set`

Add early return for generator effects where offsets can be used
normally.
2022-06-13 18:29:51 +02:00
40d700c6fb UI: Use "bl_order" for UI child panels
The "bl_order" property on add-on UI panels can be used to put
them in a specific order regardless of the order of registering.
This patch makes this ordering also possible for panels inside panels.

Differential Revision: https://developer.blender.org/D15174
2022-06-13 18:27:50 +02:00
e2993719a8 IO: update documentation for HierarchyIterator::weak_export
The documentation for `HierarchyIterator::weak_export` mentions a feature
that was removed at some point. Another example is used to illustrate its
functionality.

No functional changes.
2022-06-13 16:17:00 +02:00
5abe127b3d GPencil: Use better sampling limits.
The problem with T98683 is that sampling interval can be set to very small,
resulting in very dense points. This patch attempts to optimize that a little bit.

Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D15180
2022-06-13 22:13:16 +08:00
85fde25178 LineArt: General code cleanups.
- Use uintxx_t for all 8/16/64 bit integer types.
- Removed prepend_edge_direct thingy which is no longer needed in current edge iterator model.
- Minor code path adjustments like only copies view vector when necessary etc.
- Correctly handle ies==NULL in edge cutting function.
- White spaces and comments etc.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D15181
2022-06-13 22:13:16 +08:00
10850f0db9 Cleanup: Use more specific includes for grease pencil modifiers
Also remove unused includes in some cases.
This should make these files recompile less often.
2022-06-13 16:02:44 +02:00
19e0b60f3e Cycles: MetalDeviceQueue - capture of multiple dispatches, and some tidying
This patch adds a new mode of gpu capture (env var `CYCLES_DEBUG_METAL_CAPTURE_SAMPLES`) to capture a block of dispatches between "reset" calls. It also fixes member data naming inconsistencies and adds some missing OS version checks.

Screenshot showing .gputrace capture in Xcode 14.0 beta (using `CYCLES_DEBUG_METAL_CAPTURE_SAMPLES="1"` and `CYCLES_DEBUG_METAL_CAPTURE_LIMIT="10"`):

{F13155703}

Reviewed By: sergey, brecht

Differential Revision: https://developer.blender.org/D15179
2022-06-13 13:42:07 +01:00
5ada2afb6d Cleanup: fix various typos
Found via codespell -q 3 -S ./intern,./extern -L ans,ba,bording,datas,eiter,fiter,hist,inout,lod,ot,parm,parms,pixelx,pres,te

Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D15155
2022-06-13 13:17:32 +02:00
434133a631 Cleanup: Remove unused variable and parameter in pbvh_update_draw_buffers 2022-06-13 02:46:35 -07:00
9634f7fae3 Cleanup: Move dragging code for buttons to own file
Moves code for managing dragging data from buttons to a separate file.
This way all this closely related code is in one location, making it
easier to see how it all relates, and easier to find.
2022-06-13 11:15:39 +02:00
16f5d51109 Fix T98735: GPU subdiv displays normals for all elements
The normals flags were not setup properly which made normals for all
elements (vertices, faces) to be drawn when using the normals overlay.
Also remove usage of uints for the flag in the APIs.
2022-06-13 06:20:46 +02:00
c55dac9904 Fix T98745: Anchored mode not working for sculpt smear brush 2022-06-12 12:30:46 -07:00
afe57c4001 Fix T98784: PBVH gpu layout check being ignored
Moved gpu vert format checking outside of pbvh_update_draw_buffers,
which isn't called in every code path of BKE_pbvh_draw_cb. This led
to the draw cache being partially populated by old draw buffers
that were subsequently freed, causing a crash.
2022-06-12 12:12:41 -07:00
37097ae62a Fix T98714: Cursor grab restores to the initial location in Wayland
While Wayland can't warp the cursor, it can set a hint for the cursor
restore location when removing the lock.
2022-06-13 00:20:31 +10:00
3ac656d367 GHOST/Wayland: set the minimum window size
Setting Blender's window 1x1 can happen by accident & causes problems,
set the minimum size as all other GHOST implementations do.
2022-06-12 18:21:23 +10:00
7a849678c9 Fix GHOST/Wayland setting the window size
Zoom in the animation player wasn't working:

- The internal window size value wasn't being updated.
- The window size event wasn't being sent.
2022-06-12 17:48:56 +10:00
07a5869cf6 Fix GHOST/Wayland accessing Ctrl & Alt modifier keys
Only the Shift key was working with GHOST's getModifierKeys method.
Now all modifiers are accessible, since there is no way of detecting
left/right modifiers both are set.
2022-06-12 17:48:56 +10:00
ac2a56d7f3 Fix GHOST/Wayland display glitches on startup
Address two glitches on window creation:

- The DPI was zero until the `surface_enter` callback ran which happens
  after redrawing, causing the splash to display with incorrect scale
  before refreshing once the callback had run.

- The window scale was always 1, even when all outputs were HI-DPI.
  Now the maximum scale of all outputs is used. This isn't fool proof in
  the case of multiple monitors having different scales, however it
  doesn't seem possible to detect the scale used ahead of time
  (details in code-comment).
2022-06-12 17:46:39 +10:00
019df1fa73 Cleanup: use int[2] for window size & pending window size
Also store 'size_pending' with scale applied as it's confusing to only
apply scale to one of the size values.
2022-06-12 17:45:54 +10:00
4c7b0804f8 Cleanup (GPU): Improve efficiency of circle drawing. 2022-06-12 17:49:25 +12:00
cc4d46d91e Fix unreported: Choose nsegments for 2D rotation gizmo based on screen scale.
This mostly affects large rotation gizmos at high DPI.
Without this patch, they appear as 32-gons instead of circles.
2022-06-12 17:47:15 +12:00
9d7e731444 Fix unreported: 2D Gizmo bounding box updated to use gizmo scale. 2022-06-12 17:39:35 +12:00
f24d32f791 Fix T98517: Curve Fill Node creating extra edges.
The delaunay2d function, with mode CDT_CONSTRAINTS_VALID_BMESH_WITH_HOLES
sometimes didn't eat away all of the edges. Doing a prepass to remove
the outer edges until they hit the constraints solves this problem.
2022-06-11 12:33:27 -04:00
922861c5dc Cleanup: minor changes to GHOST/Wayland window output access
- Use a window method to handle updating the window after scale changes.
  This avoids the need for methods that return mutable references to
  DPI & scale.
- Remove window.outputs() method that returned window->system->outputs
  as it is misleading to expose these as window outputs when the outpurs
  returned are all known outputs.
- Use a vector instead of an unordered_set to store window outputs,
  while a 'set' does make sense, it means the outputs can't be accessed
  in the order they're added which may be useful for further changes.
- Use early returns.
2022-06-11 21:03:58 +10:00
add1da52ad Fix T97362: forward slashes in USD texture paths
Ensuring that relative paths to textures in exported USDs use
forward slash separators, for cross-platform compatibility.
2022-06-10 15:07:45 -04:00
9e622e1d02 LineArt: Clean up LineartRenderBuffer.
This patch does code clean ups in `LineartRenderBuffer` because it's
grown kinda big and we need better way to organize those variables inside.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D15172
2022-06-10 22:49:37 +08:00
f6268f921a USD import: Handle material name collisions
This is a partial fix for T90535.

Added Material Name Collision USD import menu option, to specify
the behavior when USD materials in different namespaces have the
same name.

The Material Name Collision menu options are

- Make Unique: Import each USD material as a unique Blender material.
- Reference Existing: If a material with the same name already
exists, reference that instead of importing.

Previously, the default behavior was to always keep the existing
material. This was causing an issue in the ALab scene, where
dozens of different USD materials all have the same name,
usdpreviewsurface1, so that only one instance of these materials
would be imported.

Reviewed by: Sybren

Differential Revision: https://developer.blender.org/D14869
2022-06-10 10:15:09 -04:00
717ab5aeae LibOverride: Consider animated/driven properties as part of the 'system override' ones in the Outliner.
Conceptually animated/driven properties are not controlled by the
liboverride system anymore, even though they may generate override
operations. So consider them as part of the 'system overrides' category,
and hide them by default in the Outliner.
2022-06-10 15:56:55 +02:00
4d0f7c3dcd LibOverride: Add util to check if a given Override Property is animated.
Searches in available animdata for fcuve(s) with matching RNA path.
2022-06-10 15:56:55 +02:00
f5d0a40122 RNA path: add util to find the char in an RNA path where the array indexing starts.
Usefull to easily trim away the 'aray index' part of an RNA path, e.g.
when searching for an FCurve (which never contains that index part in
its RNA path).
2022-06-10 15:56:55 +02:00
07341d7b32 Liboverride: Add rna array index return value to BKE_lib_override_rna_property_find.
Very useful e.g. for dealing with FCurves search.
2022-06-10 15:56:55 +02:00
9cad614ad5 Fix T98756: GPencil Set Vertex Color Attribute does not color unpainted
The operator set the color but the factor of the mix value was not updated and as the default value was 0, the color was not vivible and only worked when the stroke was previously painted.
2022-06-10 15:25:56 +02:00
Ramil Roosileht
9670c649d8 Fix regression in the recent unit system change
Resolves unit tests failure since the D15085.
Also addressed API documentation and formatting format.

Differential Revision: https://developer.blender.org/D15162
2022-06-10 11:17:14 +02:00
a24a28db7b Cleanup: inconsistent naming with recent locking checks in Wayland 2022-06-10 18:58:37 +10:00
d83a418c45 Fix T98727: Dynamic Paint does not update normals
Caused by {rB6a3c3c77b3eb}.

Displacement and wave were tagging the original mesh normals dirty,
instead the result's normals need tagging. Seems like a typo in above
commit (similar to rBfe43c170831f).

Maniphest Tasks: T98727

Differential Revision: https://developer.blender.org/D15165
2022-06-10 10:52:42 +02:00
28f852ccc3 Fix T98758: Crash setting the clipboard in Wayland
Accessing the clipboard in wayland wasn't thread safe,
use locks for the clipboard, drag & drop data access and when
setting the systems clipboard.
2022-06-10 18:42:34 +10:00
00aa57594c Fix dropping files in Wayland
There were two problems dropping files into blender:

- The inputs `focus_pointer` was NULL, causing a crash.
- The wl_data_device_manager version was set to 1, causing the Blender
  window to close (when dropping files in gnome-shell 42).

Resolve by storing the drop surface separately from the pointer surface
and bump the device manager version to 3.
2022-06-10 18:36:10 +10:00
178c184825 GHOST/Wayland: define a log handler to help tracking down errors
Many errors involving mis-use or unexpected situations report an
error and close Blender's window buy don't crash, making it difficult
to track down when the error occurs.

Define an error handler prints the error and a back-trace,
it can also be useful for setting a break-point
2022-06-10 18:36:10 +10:00
2601b9832d GHOST: add back-trace handler to the API
Add a back-trace handler to GHOST, so error handlers can include a
back-trace (when supported).

No functional changes.
2022-06-10 18:36:10 +10:00
eb9fa052a1 Clenaup: use early returns in GHOST/Wayland 2022-06-10 18:36:10 +10:00
6a11cd036c Cleanup: Clang tidy 2022-06-10 10:29:35 +02:00
aebca2bd65 Fix: Missing include 2022-06-10 10:11:49 +02:00
e6548c03f9 UI: Sculpt Curves Slide icon 2022-06-09 17:17:58 +02:00
32ee2ffc7d Fix: Crash in selection paint brush with empty curves 2022-06-09 15:40:07 +02:00
14d1ad8dd8 FCurve: optimize search from an RNA path + index.
By checking the index value first instead of a full fledge string
comparision in `BKE_fcurve_find`, we can make that code significatly
faster (from about 10% in a Heist production file to over 45% in a
heavily animated test file).

While this code was already very fast (a few microseconds per call
typically), it gets called a lot from the UI (several hundreds of time
per refresh), among other things.

NOTE: the `UNLIKELY` hint is responsible for 25% to 30% of the
speed improvement.
2022-06-09 15:17:20 +02:00
6d726192be Fix variable being used without being initialized 2022-06-09 10:11:14 -03:00
f37a37cafe Fix GHOST/Wayland memory leak when copying text 2022-06-09 21:32:49 +10:00
41c7c744eb Cleanup: use C-style comments, add missing doxy section 2022-06-09 21:31:08 +10:00
ed15900473 Cleanup: use const variables & arguments 2022-06-09 21:26:48 +10:00
8a6cbcf386 Curves: Port delete geometry node to the new curves type
Add a method to remove points from the new curves type, just like
the existing curve removal function. No functional changes are expected.
The code is simpler because all data is just stored as attributes, but
also different because the point data for all curves is stored in the same
arrays.

Similar performance improvements as other commits in T95443 are
expected, expecially for cases where there are many small curves.

Differential Revision: https://developer.blender.org/D15130
2022-06-09 13:09:04 +02:00
0fddff027e Cleanup: Unused but set variable in Cycles Metal profiler 2022-06-09 10:20:26 +02:00
a91c8d8efa Fix T98686: Cant rename local NLA tracks within a local library override data-block.
We need a specific exception to general rule 'no rename of anim channels
in liboverride data' for the locally-inserted NLA tracks.
2022-06-09 09:50:27 +02:00
62dece5c86 Cleanup: return true/false instead of 0/1 when returnin boolean. 2022-06-09 09:37:19 +02:00
38bfa53081 Fix T78815: Redraw UV Editor on collection visibility change 2022-06-09 17:39:56 +12:00
0926495de4 UI: Tooltip Edit - Copy to selected button
This commit changes the tool tip for the "Copy To Selected Button" operator.
The exiting tool tip for this operator suggests that it will "copy property to selected objects or bones".

However, it will only copies the property value to the selected objects or bones if the property already exists on the selected items.
It does not copy the property.

Differential Revision: https://developer.blender.org/D14528
2022-06-08 23:26:15 -04:00
a632260828 Cleanup: Removed unused variable 2022-06-08 22:28:46 -04:00
96f88511ee Fix T98688: Snapping not working in curve objects with evaluated geometry
It's an old behavior. Not really considered a bug.

But snapping to faces is already supported in this case.
And allowing snapping to other elements is not disruptive.
2022-06-08 21:49:11 -03:00
132e58610d Cleanup: spelling in comments & variables 2022-06-09 10:27:20 +10:00
3bdf1c11fb Cleanup: warnings 2022-06-09 10:17:39 +10:00
84906d47dc Cleanup: format 2022-06-09 10:11:25 +10:00
8b8fbffeea Fix software cursor being used with absolute events in Wayland
The software cursor was being enabled with absolute events,
causing a problem with absolute tablet events.

This caused both cursors to be visible at once when using a tablet
(with D15152 applied).
2022-06-09 10:11:25 +10:00
8a02696724 Fix assert triggered when snapping to evaluated geometry of a Curve
Curves can have a Mesh evaluated, but only objects of type Mesh have
EditMesh.

This bug is harmless because `sctx->editmesh_caches.remove(value)` only
works with pointers and `BKE_editmesh_from_object(ob_eval)`, even though
it doesn't actually return a `BMEditMesh`, it still returns a pointer
that doesn't exist as a key.
2022-06-08 20:52:34 -03:00
530f2abb9b Cleanup: quiet warnings 2022-06-09 09:48:37 +10:00
4ff9c0f4e3 Fix armatures not visible in VR
Now that VR offscreen drawing accounts for object type visibility,
armatures should be displayed when specified.
2022-06-09 06:59:03 +09:00
371fc68678 Paint: Fix Image Editor Cursor Disappearing (T90120)
This patch fixes T90120.  The fundamental problem is that 2d and the old 3d paint modes share a single Paint struct, ToolSettings->imapaint.  This patch is a temporary fix until the new 3d paint mode (which has its own Paint struct) is released.

The patch works by listening for `NC_SCENE|ND_MODE` inside `image_listener` in `space_image.c`.   It does not use `ED_space_image_paint_update` since that requires a `bMain.`  Instead it calls `paint_cursor_start` (which is promoted to `ED_paint_cursor_start`).  `image_paint_poll` is also promoted to an `ED_` function.

Reviewed By: Campbell Barton
Differential Revision: https://developer.blender.org/D14946
Ref D14946
2022-06-08 12:37:29 -07:00
285a68b7bb Sculpt: PBVH Draw Support for EEVEE
This patch adds support for PBVH drawing in EEVEE.

Notes:
  # PBVH_FACES only.  For Multires we'll need an API to get/cache attributes.  DynTopo support will be merged in later with sculpt-dev's DynTopo implementation.
  # Supports vertex color and UV attributes only; other types can be added fairly easily though.
  # Workbench only sends the active vertex color and UV layers to the GPU.
  # Added a new draw engine API method, DRW_cdlayer_attr_aliases_add.  Please review.
  # The vertex format object is now stored in the pbvh.

Reviewed By: Clément Foucault & Brecht Van Lommel & Jeroen Bakker
Differential Revision: https://developer.blender.org/D13897
Ref D13897
2022-06-08 12:30:01 -07:00
Dennis Ranish
9c28f0eb37 D14823: Adds operator to duplicate the active color attribute layer
Fixes T97706

Adds operator to duplicate the active color attribute layer.
Adds `"Color Attribute Specials"` menu to color attribute ui to access the `"geometry.color_attribute_duplicate"` operator.
Internally adds a function that duplicates a referenced CustomDataLayer
- `BKE_id_attribute_duplicate` mostly copies the existing `BKE_id_attribute_new`
- but gets the type and domain from the referenced layer
- and copies the data from the old layer into the new layer

Reviewed By: Joseph Eagar & Hans Goudey & Julien Kaspar
Differential Revision: https://developer.blender.org/D14823
Ref D14823
2022-06-08 12:10:32 -07:00
Ramil Roosileht
f69c565a33 D15085: Fix numbers jumping in edit voxel size widget
Introduces an option for BKE_unit_value_as_string to skip stripping of zeroes, thus reducing flickering when using edit voxel size widget.

{F13125416}

Reviewed By: Julien Kaspar & Joseph Eagar
Differential Revision: https://developer.blender.org/D15085
Ref D15085
2022-06-08 11:51:29 -07:00
fe4e646405 Fix: Incorrect curves and pointcloud bounding boxes
The generic bounds utility used an incorrect initial value. The value
cannot be zero-initialized, because that breaks the case where all
values are greater than zero.
2022-06-08 18:40:14 +02:00
a3e7280bd8 LibOverride: Make 'image/movieclip user` properties editable. 2022-06-08 18:00:42 +02:00
8843705f65 Fix (unreported) missing rna path for some background image properties.
RNA camera code did not handle path for its image/movieclip users
sub-data, and moviclip RNA struct definition did not have a rna path
function at all.
2022-06-08 18:00:42 +02:00
d62e6f1225 RNA nodetree: improve ImageUser path helper.
Refactor the code, and optimize it slightly (no need e.g. to check for
nodes when the nodetree is of a type that cannot have image user nodes).
2022-06-08 18:00:42 +02:00
1a71f9d2b8 Curves: use radius of middle point to determine curve shape
See {rBb69aad60bda23a53482b2c2ae98715c23a715bc8}
for more details.
2022-06-08 16:52:13 +02:00
cc1cc46099 Fix: incorrect curve parameter for catmull rom curves 2022-06-08 16:42:46 +02:00
17971b8a5b Fix: Heap buffer overflow in new curves set type node 2022-06-08 16:16:45 +02:00
9e393fc2f1 Curves: Port set type node to new data-block
This commit ports the "Set Spline Type" node to the new curves type.
Performance should be improved in similar ways to the other refactors
from the conversion task (T95443). Converting to and from Catmull Rom
curves is now supported. There are a few cases where a lot of work can
be skipped: when the number of points doesn't change, and when the
types already match the goal type.

The refactor has a few other explicit goals as well:
 - Don't count on initialization of attribute arrays when they are
   first allocated.
 - Avoid copying the entire data-block when possible.
 - Make decisions about which attributes to copy when changing curves
   more obvious.
 - Use higher-level methods to copy data between curve points.
 - Optimize for the common cases of single types and full selections.
 - Process selected curves of the same types in the same loop.

The Bezier to NURBS conversion is written by Piotr Makal (@pmakal).

Differential Revision: https://developer.blender.org/D14769
2022-06-08 15:37:46 +02:00
Dilith Jayakody
520be607e8 Fix T98624: Curve Pen NURBS extrusion creates duplicates
The initial point count check was only being done for Bezier curves.
This revision fixes T98624 by adding the check for NURBS curves as well.

Reviewed By: HooglyBoogly

Maniphest Tasks: T98624

Differential Revision: https://developer.blender.org/D15140
2022-06-08 18:37:09 +05:30
7a751327fa Fix T98620: Video sequencer screen corruption occurs when resizing.
Added Windows/Intel GPU to the list of work-a-rounds. This will
reduce the performance when using Intel GPUs on all platforms.
2022-06-08 13:15:28 +02:00
ca29376e00 Cleanup: Move sculpt_automasking.c to c++ 2022-06-08 03:33:18 -07:00
b52760a023 Fix T98565: remove unused BRUSH_PAINT icon definition
This could spam the console with errors (potentionally slowing down in
cases).

Was added in rBeae36be372a6, but not used.

Maniphest Tasks: T98565

Differential Revision: https://developer.blender.org/D15113
2022-06-08 11:21:43 +02:00
fe746b2738 Cleanup: Remove unnecessary namespace specification 2022-06-08 11:04:00 +02:00
5b0e9bd975 Cleanup: Use const variables/pointers 2022-06-08 10:48:19 +02:00
6eea5f70e3 Attributes: Use names instead of layers for some functions
This mirrors the C++ attribute API better, separates the implementation
of attributes from CustomData slightly, and makes functions simpler,
clearer, and safer.

Also fix an issue with removing an attribute caused by 97712b018d
meant the first attribute with the given type was removed instead of
the attribute with the given name.
2022-06-08 10:48:19 +02:00
1af652d42e Fix: Improve poll for convert attribute operator
Converting an attribute does not work from edit mode because
there is no attribute API implemented for BMesh, so disable the
operation in that mode and add a poll message.
2022-06-08 10:48:19 +02:00
83fd3767d3 Fix T98618: Drivers don't automatically update when changing active camera
Active camera is a property of Scene, so need to take scene changes into
account for such drivers to work reliably.

The fix covers all the common cases of such configurations, but some of
them might not be yet fully supported. Mainly cases when the target ID
is not covered by the copy-on-write mechanism.

There is a fuller explanation available in the code for the ease of reading
by the future generations.

Differential Revision: https://developer.blender.org/D15146
2022-06-08 09:12:14 +02:00
8d09a12414 Correct missing doxy-sections in 1269bcce81 2022-06-08 16:19:35 +10:00
1269bcce81 Cleanup: use doxy sections for wayland listeners 2022-06-08 16:05:36 +10:00
8edd1d8aa5 CMake: optionally disable OBJ, STL & GPencil SVG support
The following CMake options have been added (enabled by default),
except for the lite build configuration.

- WITH_IO_STL
- WITH_IO_WAVEFRONT_OBJ
- WITH_IO_GPENCIL (for grease pencil SVG importing).
  Note that it was already possible to disable grease pencil export
  by disabling WITH_PUGIXML & WITH_HARU.

This is intended to keep the lite builds fast and small for building,
linking & execution.

Reviewed By: iyadahmed2001, aras_p, antoniov, mont29

Ref D15141
2022-06-08 13:29:32 +10:00
a1d2efd190 GHOST/Wayland: draw a software-cursor when wrapping cursor motion
As Wayland doesn't support moving the cursor, draw a cross-hair cursor
at the location used by Blender.

Without this, the cursor was locked at the location where grab started,
making some actions unusable since the cursor location was invisible.

Resolves T77311.
2022-06-08 13:16:14 +10:00
b3e0101a35 GHOST/Wayland: non-wrapping grab no longer locks the cursor
Grab which didn't wrap would lock the cursor, making actions such
as resizing areas lock the cursor in-place.

Confine the cursor to the window instead.

This behavior was also used for X11 when grabbing the cursor was first
supported but could lock the system if Blender froze while grabbing so
it was disabled [0].

For Wayland this shouldn't be a problem as compositors implement grab
in a way that prevents the client from locking the system.

[0]: 3e3d2b7a4c
2022-06-08 11:45:44 +10:00
173a15bcda BLI: Math: Add description and test to ceil_to_multiple and divide_ceil
I took the decision to assert on unexpected value as the behavior of these
functions are not consistent across the whole integer domain.
2022-06-07 20:08:39 +02:00
a857156578 UI: Curves Sculpt density + smooth brushes
More information in the svn log. But basically the smooth brush
is re-using the previous one we had for hair, and the density is
representing the hair root points that are removed to reach the
desired density.

Those brushes are used by D15134.
2022-06-07 19:08:07 +02:00
3e7d977886 IME Cleanup: Removal of BLT_lang_is_ime_supported
Removal of BLT_lang_is_ime_supported which is always returns true and
is no longer needed.

See D11800 for more details.

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

Reviewed by Campbell Barton
2022-06-07 10:03:26 -07:00
9fda233897 Cleanup: Use const pointers in attribute API 2022-06-07 18:55:56 +02:00
d39e0f9616 Fix: Incorrect logic in attribute search function
If a geometry does not have CustomData for a certain domain,
it may still have CustomData on other domains. In that case
we need to continue to the other domains instead of returning.
This worked for meshes because the domains are all at the
start of the `info` array. It didn't work for curves.
2022-06-07 18:38:39 +02:00
627d42cd56 Merge branch 'blender-v3.2-release'
# Conflicts:
#	source/blender/draw/engines/eevee/shaders/volumetric_vert.glsl
2022-06-07 18:32:34 +02:00
ec493d79fa BLI: Math: Add math::divide_ceil and math::ceil_to_multiple
`math::divide_ceil` is just the vector implementation of `divide_ceil_u`.

`math::ceil_to_multiple` is similar but finaly multiply by the divisor.
It is handy to handle tile buffers resolutions.
2022-06-07 18:31:06 +02:00
b568f445a5 Fix T98647: EEVEE: Camera Data Node's View Vector Broken
Fix regression and remove duplicated computation.
2022-06-07 18:14:16 +02:00
391485f412 Fix EEVEE: Shader error when using volume temperature or color attributes
This bug was unreported. This was triggering a linking error caused by
the vertex shader not having a local version of `attr_load_temperature_post`
and `attr_load_color_post`.
2022-06-07 18:13:09 +02:00
60442b0292 Fix T98091: EEVEE: Volume: Crash caused by non-present grid
This was caused by the `copy_m4_m4` trying to copy the `object_to_texture`
from `drw_grid` which was `nullptr`.

Fixing this also exposed that rendering such volumes (without any valid
grid attributes) is not supported and we should follow what Cycles does.

Differential Revision: https://developer.blender.org/D15147
2022-06-07 18:12:19 +02:00
7974d2bff6 CustomData: Add function to free a named layer
This can be useful to avoid unnecessary boilerplate in various users
of the CustomData API. Split from D14685 and D14769.
2022-06-07 18:00:30 +02:00
9c029a3eb0 Fix T98621: Image does not update when tweaking strip properties
Problem was caused by `startdisp` and `enddisp` still being used after changes
implemented in rB7afcfe111aac.
2022-06-07 17:02:40 +02:00
Monique Dewanchand
e62a33e572 Nodes: Show node description in Node add menu
Though no nodes have descriptions currently, this patch makes it
possible to add descriptions that display in the add menu, for
custom node systems and existing builtin nodes.

Differential Revision: https://developer.blender.org/D14963
2022-06-07 15:40:31 +02:00
ccf0d22e92 Fix T98626: Mesh Deform modifier stops working on a linked collection upon undo.
Regression from rBb66368f3fd9c, we still need to store all data on undo
writes, since overrides are not re-applied after undo/redo.
2022-06-07 15:30:05 +02:00
b69aad60bd Curves: use root/tip radius of the first curve in the viewport
Viewport drawing does not support a per point radius attribute yet.
Instead, it has a fixed set of radius parameters that are used for all
curves in the same object. Now those radii are retrieved from the
radius attribute of the points on the first curve. This allows users
to control the radius of curves to some degree until proper per-point
radius is supported.
2022-06-07 15:03:58 +02:00
Martijn Versteegh
1203bd58be Fix: Make renaming attributes check uniqueness on all domains
This function only checked for uniqueness in the current domain,
while attribute names should be unique among all domains within
a geometry.

Differential Revision: https://developer.blender.org/D15144
2022-06-07 14:52:27 +02:00
503bcaf1a2 Marker drawing: don't restore GPU line width
Adhere to the documented use of `GPU_line_width()` and don't restore the
previously set line width.
2022-06-07 14:36:45 +02:00
f49efed953 Curves: fix transforms in Add brush
Symmetry should be applied in the space of the curves object,
not in the space of the surface object.
2022-06-07 14:21:02 +02:00
3b7e314a28 Cleanup: remove dead code 2022-06-07 14:21:02 +02:00
d422715094 Fix drawing increments after running Spin gizmo
Caused by {ea182deeb9cdd2a9137e98eb0072f57c0fb1e09f}.
2022-06-07 09:12:20 -03:00
1456f30b02 Cleanup: potential dereferencing of a NULL pointer
If `cancel` is `false`, `NULL` `inter` pointer dereferencing could occur.

Currently I haven't found a case where this can happen.

But it's best to avoid.
2022-06-07 09:01:46 -03:00
2918a3a2a3 Cleanup: spelling in comments, minor formatting tweaks 2022-06-07 21:22:55 +10:00
1e0e1ad20f Cleanup: note that checking only the left modifiers isn't a mistake 2022-06-07 21:22:55 +10:00
2935b6a2ac Add Instance Offset operators to Collections property panel
Add three operators to the Collections properties panel:

- `object.instance_offset_to_cursor`, which is already available from
  the Object properties panel. The operator works on the active
  collection, though, so it's weird to not have it in the Collections
  panel.
- `object.instance_offset_from_object` is a new operator, which performs
  the same operation as above, but then based on the active object's
  evaluated world position.
- `object.instance_offset_to_cursor` is also new, and performs the
  opposite of the first operator: it moves the 3D cursor to the
  collection's instance offset.

The first two operators make it easier to set the instance offset. The
last operator makes it possible to actually see the offset in the 3D
viewport; drawing it using some overlay could also work, but that would
be more effort to get right, and then snapping the 3D cursor would still
be useful.

The operators are placed in a popup menu, as to not clutter the
interface too much with various buttons.

Reviewed By: dfelinto, eyecandy

Differential Revision: https://developer.blender.org/D14966
2022-06-07 13:10:13 +02:00
3a8a44b3f9 Keymap: use both left/right modifier keys
Use both left/right modifier keys for:

- Fly Mode.
- Walk Mode.
- Area Split.
- Sculpt Detail Map.
- Sculpt Expand.
- Standard Modal Map

Resolves T98638.
2022-06-07 21:03:08 +10:00
16934c198a LibOverride: Attempt to improve handling of cyclic deps between libraries.
Those cyclic dependencies (lib_A depends on a texture from lib_B, which
links geometry from lib_A) are bad, but previous code did not always
helped much in idendtifying to actuall issue point.

Now, reduce maximum 'recursion' level to 100 (this should already never
be reached in practice), and additionally report warnings when reaching
level 90, so that user gets more context data to identify more easily
the culprit.
2022-06-07 12:53:04 +02:00
Michael Jones
4412e14708 Cycles: Useful Metal backend debug & profiling functionality
This patch adds some useful debugging & profiling env vars to the Metal backend:

- `CYCLES_METAL_PROFILING`: output a per-kernel timing report at the end of the render
- `CYCLES_METAL_DEBUG`: enable per-dispatch tracing (very verbose)
- `CYCLES_DEBUG_METAL_CAPTURE_KERNEL`: enable programatic .gputrace capture for a specified kernel index

Here's an example of the timing report with `CYCLES_METAL_PROFILING` enabled:

```
---------------------------------------------------------------------------------------------------
Kernel name                                 Total threads   Dispatches     Avg. T/D    Time   Time%
---------------------------------------------------------------------------------------------------
integrator_init_from_camera                   657,407,232          161    4,083,274   0.24s   0.51%
integrator_intersect_closest                1,629,288,440          681    2,392,494  15.18s  32.12%
integrator_intersect_shadow                   751,652,291          470    1,599,260   5.80s  12.28%
integrator_shade_background                   304,612,074          263    1,158,220   1.16s   2.45%
integrator_shade_surface                    1,159,764,041          676    1,715,627  20.57s  43.52%
integrator_shade_shadow                       598,885,847          418    1,432,741   1.27s   2.69%
integrator_queued_paths_array               2,969,650,130          805    3,689,006   0.35s   0.74%
integrator_queued_shadow_paths_array          593,936,619          379    1,567,115   0.14s   0.29%
integrator_terminated_paths_array              22,205,417          155      143,260   0.05s   0.10%
integrator_sorted_paths_array               2,517,140,043          676    3,723,579   1.65s   3.50%
integrator_compact_paths_array                648,912,748          155    4,186,533   0.03s   0.07%
integrator_compact_states                      20,872,687          155      134,662   0.14s   0.29%
integrator_terminated_shadow_paths_array      374,100,675          438      854,111   0.16s   0.33%
integrator_compact_shadow_paths_array         503,768,657          438    1,150,156   0.05s   0.10%
integrator_compact_shadow_states               37,664,941          202      186,460   0.23s   0.50%
integrator_reset                               25,165,824            6    4,194,304   0.06s   0.12%
film_convert_combined_half_rgba                 3,110,400            6      518,400   0.00s   0.01%
prefix_sum                                            676          676            1   0.19s   0.40%
---------------------------------------------------------------------------------------------------
                                                                 6,760               47.27s 100.00%
---------------------------------------------------------------------------------------------------
```

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D15044
2022-06-07 11:08:39 +01:00
4fc7e1a880 Cleanup: Correct comments 2022-06-07 11:55:52 +02:00
4637f3e83c Merge branch 'blender-v3.2-release' 2022-06-07 10:52:38 +02:00
58d350b489 GPUMaterial: Make compilation fail when reusing failed GPUPass
This avoid leaving a `GPUMaterial` in a `GPU_MAT_QUEUED` state which would
block rendering.

Fix T98603: Hang when saving project in material preview mode

Maniphest Tasks: T98603

Differential Revision: https://developer.blender.org/D15135
2022-06-07 10:48:13 +02:00
dcbbdc89ea Cleanup: Fix missing-braces warning in draw manager
Good side effect of the change is that it makes it so that the
size of an array is more likely to be calculated at a compile time.

More ideally we'll be using bli::Array instead of the bare array,
but that is outside of the scope of this change.
2022-06-07 10:35:33 +02:00
9ccc21dde3 VSE preview transform autokeying improvements
NOTE: this patch originated in T98015 which was split into multiple
reports. While it could be split into multiple patches these are very
much related so keeping as one for now

This patch fixes the following issues:

[1] autokeying transforms in preview only creates keyframes if there is
an FCurve already
[2] autokeying transforms in preview only creates keyframes for
rotation/scale if rotating/scaling around cursor (should keyframe
position as well)
[3] autokeying transforms in preview does not work during animation
playback

For [1], a param was added to `ED_autokeyframe_property` which can tweak
its default behavior of only creating keyframes on already keyed
properties (which was fine because this is mostly called from buttons
where this behavior is desired). Callers such as gizmos (or the VSE in
our case) can use this additional param so that keyframes are also
created on "not-yet-keyframed" properties.

For [2], the pivot is checked and position properties also keyed if
necessary (which is also consistent with the way objects are keyed in
the 3DView)

For [3], `animrecord_check_state` was changed to be able to work on
scenes as well and the transform system in the VSE preview was made
aware of the screen's `animtimer`.

NOTE: there are still things to be improved for keyframing in the VSE,
the most obvious is probably a `keyframe_insert` operator (with
keyingsets)

Fixes T98429, T98430, T98431

Maniphest Tasks: T98015, T98431, T98430, T98429

Differential Revision: https://developer.blender.org/D15047
2022-06-07 09:53:11 +02:00
4580c18c56 Correct error in 7c4826d971 2022-06-07 17:42:11 +10:00
Joseph Faulkner
b77494ec61 Fix T98527 : corrected label for Korean language in Blender preferences
Patch changes label from '한국 언어' to '한국어'

Reviewed By: persun, PratikPB2123, mont29

Maniphest Tasks: T98527

Differential Revision: https://developer.blender.org/D15120
2022-06-07 09:35:27 +02:00
7c4826d971 Fix T98552: Experimental Tweak Select: Curve handle tweak is difficult
The previous fix [0] only resolved the issue for RMB select,
this works for the tweak tool with LMB select.

[0]: 0f73a27b76
2022-06-07 16:53:54 +10:00
99847cd642 OBJ: Use filename as the default object name
To match the existing Python .obj importer, and to make it easier for
the user to determine which object is which, use the filename for the
default object name instead of "New object".

Differential Revision: https://developer.blender.org/D15133
2022-06-06 22:38:02 -07:00
b4d3ca624e Logging: remove unnecessary newlines 2022-06-07 15:01:03 +10:00
263371dc4e Cleanup: spelling in comments, additional white space 2022-06-07 15:01:03 +10:00
243891104f Cleanup: use doxy sections for mask add operators & functions 2022-06-07 14:40:51 +10:00
af6a68217f Cleanup: format 2022-06-07 14:40:51 +10:00
ea182deeb9 Remove workaround for drawing the rotation gizmo
Since [0], transform gizmos are no longer hidden during transform.

The same can be observed for rotation gizmos.

However, as a workaround for these rotation gizmos, there was already a
drawing utility running.

With the gizmo and the utility this drawing is now being done twice.

So remove the utility/workaround and update the gizmo accordingly.

[0] {648350e456490f8d6258e7de9bf94d3a6a34dbb2}

Differential Revision: https://developer.blender.org/D9542
2022-06-07 00:38:23 -03:00
b3101abcce blend_render_info: Zstd support, skip redundant file reading & cleanup
- Use a context manager to handle file handlers (closing both in the
  case of compressed files).

- Seek past BHead data instead of continually reading
  (checking for 'REND').

- Write errors to the stderr (so callers can differentiate it from the
  stdout).

- Use `surrogateescape` in the unlikely event of encoding errors
  so the result is always a string (possible with files pre 2.4x).

- Remove '.blend' extension check as it excludes `.blend1` files
  (we can assume the caller is passing in blend files).

- Define `__all__` to make it clear only one function is intended
  to be used.
2022-06-07 13:15:56 +10:00
56ede578e7 Cleanup: compiler warnings: unused args, missing include, parenthesis 2022-06-07 11:50:10 +10:00
Iyad Ahmed
7c511f1b47 STL: Add new C++ based STL importer
A new experimentatl STL importer, written in C++. Roughly 7-9x faster than the
Python based one.

Reviewed By: Aras Pranckevicius, Hans Goudey.
Differential Revision: https://developer.blender.org/D14941
2022-06-06 20:57:38 +03:00
14fc89f38f Geometry Nodes: Add Instance Scale Input Node
A field input node for the scale of each top-level instance transform.
The scale can be set with the "Scale Instances" node, but previously
could not be retrieved.

Differential Revision: https://developer.blender.org/D15132
2022-06-06 12:02:59 -05:00
3a57f5a9cf Geometry Nodes: Instance Rotation Node
A field input node for the rotation of each top-level instance transform.
The rotation can be set with the "Rotate Instances" node, but previously
could not be retrieved.

Differential Revision: https://developer.blender.org/D15131
2022-06-06 11:50:13 -05:00
f700aa67ac Geometry Nodes: Fix Assert in Duplicate Elements
The original assert did not take into account the offset size in the loop being -1. The tests were then run in non-debug mode, so while the mesh regressions still passed, the false positive asserts that happened were not caught.

Differential Revision: https://developer.blender.org/D15136
2022-06-06 11:15:24 -05:00
128aa7f3b0 Geometry Nodes: Fix Assert in Duplicate Elements
The original assert did not take into account the offset size in the loop being -1. The tests were then run in non-debug mode, so while the mesh regressions still passed, the false positive asserts that happened were not caught.

Differential Revision: https://developer.blender.org/D15136
2022-06-06 11:10:27 -05:00
3772dda4ab Refactor: Snap-related. Clarified attribute names and refactored #defines into enums
The transformation snapping code contains a bunch of `#define`s, some ambiguously or incorrectly named attributes.  This patch contains refactored code to improve this.  This patch does (should) not change functionality of snapping.

Clarified ambiguously / incorrectly named attributes.

  - "Target" is used to refer to the part of the source that is to be snapped (Active, Median, Center, Closest), but several other areas of Blender use the term "target" to refer to the thing being snapped to and "source" to refer to the thing getting snapped.  Moreover, the implications of the previous terms do not match the descriptions.  For example: `SCE_SNAP_TARGET_CENTER` does not snap the grabbed geometry to the center of the target, but instead "Snap transforamtion center onto target".
  - "Select" refers to the condition for an object to be a possible target for snapping.
  - `SCE_SNAP_MODE_FACE` is renamed to `SCE_SNAP_MODE_FACE_RAYCAST` to better describe its affect and to make way for other face snapping methods (ex: nearest).

Refactored related `#define` into `enum`s.  In particular, constants relating to...

  - `ToolSettings.snap_flag` are now in `enum eSnapFlag`
  - `ToolSettings.snap_mode` are now in `enum eSnapMode`
  - `ToolSettings.snap_source` (was `snap_target`) are now in `enum eSnapSourceSelect`
  - `ToolSettings.snap_flag` (`SCE_SNAP_NO_SELF`) and `TransSnap.target_select` are now in `enum eSnapTargetSelect`

As the terms became more consistent and the constants were packed together into meaningful enumerations, some of the attribute names seemed ambiguous.  For example, it is unclear whether `SnapObjectParams.snap_select` referred to the target or the source.  This patch also adds a small amount of clarity.

This patch also swaps out generic types (ex: `char`, `short`, `ushort`) and unclear hard coded numbers (ex: `0`) used with snap-related enumerations with the actual `enum`s and values.

Note: I did leave myself some comments to follow-up with further refactoring.  Specifically, using "target" and "source" consistently will mean the Python API will need to change (ex: `ToolSettings.snap_target` is not `ToolSettings.snap_source`).  If the API is going to change, it would be good to make sure that the used terms are descriptive enough.  For example, `bpy.ops.transform.translate` uses a `snap` argument to determine if snapping should be enabled while transforming.  Perhaps `use_snap` might be an improvement that's more consistent with other conventions.

This patch is (mostly) a subset of D14591, as suggested by @mano-wii.

Task T69342 proposes to separate the `Absolute Grid Snap` option out from `Increment` snapping method into its own method.  Also, there might be reason to create additional snapping methods or options.  (Indeed, D14591 heads in this direction).  This patch can work along with these suggestions, as this patch is trying to clarify the snapping code and to prompt more work in this area.

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D15037
2022-06-06 10:56:22 -04:00
a094cdacf8 BLI: fix memory error when moving VArray_Span
The issue was that the new span still referenced data that was potentially
stored in the old VArray_Span.
2022-06-06 14:01:25 +02:00
7eb2018a0b Fix Windows compiler error
This error was introduced in 176d7bcc2e

Fix provided by @deadpin
2022-06-06 09:42:36 +02:00
bb9647b703 PyDocs: remove sphinx-intl
Cop paste mistake from rB3cd283a424ec92ef85e1856d66f0baa4d2253fc5
2022-06-05 23:13:26 -04:00
3cd283a424 Py Docs: Update Sphinx and dependencies
- Adds python 3.10 support
- Slightly improves performance
2022-06-05 23:05:48 -04:00
011d9cce19 UI: offset scale gizmos instead of scaling their shape
Scaling handles while dragging could be distracting, especially at
extreme values where handles could become large on-screen.

Now all gizmos are shown while scaling.

GIZMO_GT_arrow_3d now now support changing their length while being
dragged as well as negative lengths.
2022-06-06 12:48:49 +10:00
bb34afac56 Cleanup: quiet compiler warning 2022-06-06 12:45:42 +10:00
8589f60546 Curves: Port bounding box node to the new curves type
Avoid the conversion to and from the old type, which could
be a substantial improvement in somce cases.
2022-06-05 21:05:13 +02:00
c7e4c43072 Cleanup: Remove unused BKE_spline.hh includes 2022-06-05 21:00:03 +02:00
93a68f2a90 Curves: Fix overallocation for curve attributes when deleting curves
Curve attributes were allocated to the size of the point domain, which
wouldn't cause bad behavior, just potentially worse performance.
2022-06-05 20:00:06 +02:00
270a24cc64 Fix: incorrect operator warning 2022-06-05 17:51:37 +02:00
545d469879 Cleanup: Move wm_event_system.c to C++
This allows the use of C++ data structures to simplify code and
improve performance.
2022-06-05 16:47:42 +02:00
c4e11122c5 Geometry Nodes: Use fields for delete geometry inversion
The separate geometry and delete geometry nodes often invert the
selection so that deleting elements from a geometry can be implemented
as copying the opposite selection of elements. This should make the two
nodes faster in some cases, since the generic versions of selection
creation functions (i.e. from d3a1e9cbb9) are used instead
of the single threaded code that was used for this node.

The change also makes the deletion/separation code easier to
understand because it doesn't have to pass around the inversion.
2022-06-05 16:46:20 +02:00
72ea37ae5f UI: align gizmo scale handles to both Y and Z axes
This resolves a minor inconsistency displaying the scale gizmo handles
since they're cubes it's noticeable when they're not axes aligned.
2022-06-05 23:43:07 +10:00
648350e456 UI: show gizmo while transforming
When interacting with translate/rotate/scale gizmo, show the gizmo while
it's in use. There are some exceptions to this, as showing all scale
gizmos while scaling causes the gizmos to become large & distracting so
in this case only the gizmo being dragged is shown.

Resolves T63743.
2022-06-05 23:21:50 +10:00
d450a791c3 Cleanup: assign operator type flags in their initialization
Some operators OR'ed the existing flags in a way that made it seem
the value might already have some values set.
Replace this with assignment as no flags are set and the convention
with almost all operators is to write the value directly.
2022-06-05 23:05:38 +10:00
4e3ce04855 Cleanup: Use shorter variable name 2022-06-05 12:37:45 +02:00
e37eebf16f Cleanup: Comments and formatting in mesh extract headers
Also remove accidentally committed WIP commented code.
2022-06-05 12:15:31 +02:00
899ec8b6b8 Curves: use uv coordinates to attach curves to mesh
This implements the new way to attach curves to a mesh surface using
a uv map (based on the recent discussion in T95776).

The curves data block now not only stores a reference to the surface object
but also a name of a uv map on that object. Having a uv map is optional
for most operations, but it will be required later for animation (when the
curves are supposed to be deformed based on deformation of the surface).

The "Empty Hair" operator in the Add menu sets the uv map name automatically
if possible. It's possible to start working without a uv map and to attach the
curves to a uv map later on. It's also possible to reattach the curves to a new
uv map using the "Curves > Snap to Nearest Surface" operator in curves sculpt
mode.

Note, the implementation to do the reverse lookup from uv to a position on the
surface is trivial and inefficient now. A more efficient data structure will be
implemented separately soon.

Differential Revision: https://developer.blender.org/D15125
2022-06-05 12:14:32 +02:00
176d7bcc2e Cleanup: Move remaining mesh draw code to C++
After this commit, all mesh data extraction and drawing code is in C++,
including headers, making it possible to use improved types for future
performance improvements and simplifications.

The only non-trivial changes are in `draw_cache_impl_mesh.cc`,
where use of certain features and macros in C necessitated larger
changes.

Differential Revision: https://developer.blender.org/D15088
2022-06-05 12:04:58 +02:00
31da775ec2 Fix compiling debug build 2022-06-05 12:04:24 +02:00
Pablo Dobarro
e90ba74d3e D15041: Sculpt: Elastic Transform
This implements transform modes for the transform tool and Elastic
Transform. This mode uses the Kelvinlets from elastic deform to apply
the transformation to the mesh, using the cursor radius to control the
elasticity falloff.

{F9269771}

In order for this to work, the transform tool uses incremental mode when
elastic transform is enabled. This allows to integrate the displacement of
the Kelvinet in multiple steps.

Review By: Sergey Sharbin & Daniel Bystedt & Julian Kaspar & Campbell
Barton

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

Ref D15041
2022-06-04 13:50:28 -07:00
e230ccaf8c Fix Wintab button tracking logic.
Shifted flag for buttons changed was incorrectly compared with
unshifted packet flag to determine button press state.

Also fix button tracking storage; button flags are 32 bits whereas the
member variable was 8.

Differential Revision: https://developer.blender.org/D14915
2022-06-04 09:39:32 -07:00
db5ffdd1a4 Cleanup: Use const for retrieved custom data layers 2022-06-04 17:12:17 +02:00
6572ad8620 Cleanup: Use const, make format 2022-06-04 16:51:20 +02:00
a5190dce9d Mesh: Only check dirty normals flag of current domain
The code that checked whether vertex normals needed to be recalculated
was checking the dirty tag for face normals and vertex normals, in an
attempt at increased safety. However, those tags are always set
together anyway. Only checking the vertex dirty tag allows potentially
allocating or updating the normals on the two domains independently,
which could allow further skipping of calculations in some cases.
2022-06-04 16:30:57 +02:00
23f8fc38d9 Cleanup: Remove unnecessary struct keywords 2022-06-04 13:31:30 +02:00
9531eb24b3 Fix T98580: image flip/invert/resize don't work on active UDIM tile 2022-06-03 19:42:22 +02:00
8e02b53ae7 Sculpt: Fix zeroing of last position on stroke start
Fixes bug where clicking in empty space resets
viewport pivot in rotate around active mode
to zero.
2022-06-03 10:41:05 -07:00
2681e480ea Fix T98579: image save operators changing file path to absolute 2022-06-03 19:25:57 +02:00
da45c12bef Merge branch 'blender-v3.2-release' 2022-06-03 19:02:46 +02:00
34f94a02f3 Fix use of OpenGL interop breaking in Hydra viewports that do not support it
Rendering directly to a resource using OpenGL interop and Hgi
doesn't work in Houdini, since it never uses the resulting resource
(it does not call `HdRenderBuffer::GetResource`). But since doing
that simultaneously disables mapping (`HdRenderBuffer::Map` is
not implemented then), nothing was displayed. To fix this, keep
track of whether a Hydra viewport does support displaying a Hgi
resource directly, by checking whether
`HdRenderBuffer::GetResource` is ever called and only enable use
of OpenGL interop if that is the case.

Differential Revision: https://developer.blender.org/D15090
2022-06-03 18:56:30 +02:00
3fe7d049d2 Fix new curve objects showing as UNKNOWN in the outliner
The fix is to unify with the name we had for the old Curves objects.

That means that we will see them bothi (old and new curves) in the outliner
(under two different categories but with different names).

This is considered to be a temporary solution until we remove the old
curve system entirely.
2022-06-03 18:40:14 +02:00
5cc118fc09 Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-06-03 17:10:16 +02:00
7f7ed8e098 Fix T98571: corrupted face selection drawing with GPU subdivision
Simple typo in rB55e3930b253e.
2022-06-03 17:09:44 +02:00
6b9a3be03d Cleanup: clang-format 2022-06-03 16:55:21 +02:00
e7156be86e Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-06-03 16:13:51 +02:00
0b38b8dafa Spreadsheet Editor: Support int 8 attribute
This was leading to some crashes and warnings such as:

"Code marked as unreachable has been executed. Please report this as a bug."

Differential Revision: https://developer.blender.org/D15116
2022-06-03 16:13:28 +02:00
e73fd4f0c0 Fix (unreported) important memory leak in Boolean modifier using a Collection operand and Fast mode.
Code handling repetitive boolean operations when using several objects
from a Collection would not handle result mesh properly, re-creating for
each object without properly freeing it.

Further more, existing code was effectively converting the BMesh to mesh
twice, including a modification of the initial (input) mesh, which
modifiers should never do!

Removed the extra useless conversion, which also gives a small
improvement in performances:

With as simple of a scene as four objects (three operands in a
collection, and the modified one) totalling 20k vertices/faces, this
commit:
* Avoids 2MB memory leak per evaluation (!).
* Speeds up boolean evaluation by 5-10%.

Found while investigating some production files of the Project Heist
here at the Blender Studio.
2022-06-03 16:07:05 +02:00
691ab3fc46 Fix (unreported) invalid debug timing code in Boolean modifier code. 2022-06-03 16:07:05 +02:00
1a3ac2f750 Tests: Add basic testing for boolean modifiers.
Test basic Difference operation with both a single Objetc and a
collection of three objects as operands, using BMesh (aka 'FAST') mode.
2022-06-03 16:07:05 +02:00
5d9ebea15d Cleanup: remove unused code 2022-06-03 16:02:04 +02:00
12722bd354 Curves: Add surface UV map name property
In the latest discussions about curves/hair mesh attachement
information (T95776), it was decided to use UV coordinates to
store where on the mesh each root is. For that, we have to specify
which of the UV map attributes to use for UV lookups.

This property isn't used yet, but it will be shortly when refactoring
the attachement information in the add brush and the to particle
system conversion.

Differential Revision: https://developer.blender.org/D15115
2022-06-03 15:54:03 +02:00
2780c7e312 Cleanup: deduplicate resampling curve after moving last point 2022-06-03 15:40:18 +02:00
074010ad6d Fix T98570: Cycles AOVs not working in background shader
Must include the AOV writing feature in background shader evaluation.

Differential Revision: https://developer.blender.org/D15114
2022-06-03 15:34:31 +02:00
9d8fb80f21 Eevee/Workbench: store 8 bit image textures as half float for some color spaces
Same as in Cycles, this is needed for some color space conversions that don't
compress well to byte sRGB, like for example Filmic sRGB.

Ref T68926
2022-06-03 15:25:23 +02:00
4c4056579b Fix typo in colorspace description 2022-06-03 15:25:23 +02:00
d040e1da4f Constraints: introduce wrapper functions to access target lists.
Instead of directly accessing constraint-specific callbacks
in code all over blender, introduce two wrappers to retrieve
and free the target list.

This incidentally revealed a place within the Collada exporter
in BCAnimationSampler.cpp that didn't clean up after retrieving
the targets, resulting in a small memory leak. Fixing this should
be the only functional change in this commit.

This was split off from D9732.

Differential Revision: https://developer.blender.org/D13844
2022-06-03 16:18:26 +03:00
284a3431ae Cycles: Fix rendering of packed UDIM tiles with different sizes
The packed image loader was not aware of the fact that UDIM tiles
can be of a different size.

Exposed Python API required to access this information. It has the
same complexity as the "regular" packed files: in both cases the
ImBuf will be acquired and released to access the information.

While the current workflow of packing UDIMs is not very streamlined,
it is still possible and is something what the studio is using here.

Test file:
{F13130516}

Expected behavior achieved with this patch: a bigger checker board
pattern in viewport render

Actual behavior prior to this patch: either memory corruption, or
wrong/black render result on the plane

Differential Revision: https://developer.blender.org/D15111
2022-06-03 14:23:23 +02:00
fa5cf5360c Merge branch 'blender-v3.2-release' 2022-06-03 14:11:48 +02:00
cf6c8ae01b Fix T98573: Rescaling Image by python wrong
This did not refresh the Image editor, but more importantly this now
appeared cropped (a regression from the partial image updater).

Solved in the RNA function by:
- calling BKE_image_partial_update_mark_full_update
- sending appropriate notifier

Maniphest Tasks: T98573

Differential Revision: https://developer.blender.org/D15110
2022-06-03 14:08:21 +02:00
6b84465352 Cleanup: remove dead code 2022-06-03 13:51:05 +02:00
0a2a8d702a Fix: Curves sculpt mode keymaps missing in preferences
These changes make the curves sculpt mode keymap consistent
with other modes. They now show up in the keymap, for potential
editing of tool shortcuts, etc. I don't fully understand this system,
but at least these changes should make it consistent.

Differential Revision: https://developer.blender.org/D15112
2022-06-03 13:41:16 +02:00
3b51d9065c Cleanup: deduplicate retrieving data from context in curves brushes 2022-06-03 13:39:59 +02:00
5c6053ccb1 Fix misaligned address error when rendering 3D curves in the viewport with Cycles and OptiX 7.4
Acceleration structures in the viewport default to building with the fast
build flag, but the intersection program used for curves was queried with
the fast trace flag. The resulting mismatch caused an exception in the
intersection kernel. Since it's difficult to predict whether dynamic or static
acceleration structures are going to be built at the time of kernel loading,
this fixes the mismatch by always using the fast trace flag for curves.
2022-06-03 12:24:13 +02:00
Angus Stanton
50976657ac Geometry Nodes: Show supported types in geo socket tooltip
Show the supported geometry types returned by geometry
node socket declarations in the socket inspection tooltip.

Differential Revision: https://developer.blender.org/D14802
2022-06-03 10:11:06 +02:00
4eb5163b18 Fix T98459: vertex weight paste/copy inconsistent
In the editmode sidebar, pasting a particular vertex's weight in a
single group was not behaving the same as copying for all groups [in
that the former dis not copy to unassigned vertices whereas the later
did copy to unassigned vertices].

This behaves like this since the introduction in {rB70fd2320c8d2}, but
there does not seem to be a good reason for this?

Now make this consistent and use `BKE_defvert_copy_index` in both cases
(instead of earlying out if unassigned, this will make sure this will
also copy to unassigned).

Maniphest Tasks: T98459

Differential Revision: https://developer.blender.org/D15062
2022-06-03 09:50:45 +02:00
16d329da28 Compositor: add pre/post/cancel handlers and background job info
Main motivation is from T54314 where there was no way to read from a
Viewer image datablock after the compositor has run.
The only solution there was to do a full rerender (which obviously takes
much longer). Adding a handler avoids having to rerender.

This uses new syntax from rBf4456a4d3c97 and also adds "COMPOSITE" as a
job type that can be queried by `bpy.app.is_job_running`.

NOTE: there is another issue when multiple viewers are used and these
get active via RNA (compo execution is not triggered there yet -- unlike
when a viewer is selected in the Editor -- this is an issue of
`ED_node_set_active` vs. only `nodeSetActive`, but this will be tackled
separately)

Maniphest Tasks: T54314

Differential Revision: https://developer.blender.org/D15078
2022-06-03 09:45:08 +02:00
9babe39de9 LineArt: Include minor fixes in branch that's missing in master. 2022-06-03 15:36:27 +08:00
cf5529af12 Cleanup: remove gizmo transform workaround which is no longer needed
Now gizmos forward the original event to transform so assuming an LMB
event is no longer needed.
2022-06-03 15:08:11 +10:00
e87082d8a7 Cleanup: spelling in comments 2022-06-03 15:08:11 +10:00
379672ca0b Cleanup: remove unused, commented MTexFace assignments 2022-06-03 15:08:11 +10:00
9ad19b0453 Merge branch 'blender-v3.2-release' 2022-06-03 13:15:35 +10:00
c4701a027f Fix T98558: island selection in UV editor can crash
Regression in [0]. When zoomed in, we can be within the face of an
island but too far from an edge, in this case
uv_find_nearest_face_multi_ex is used instead of
uv_find_nearest_edge_multi with the consequence that hit.l cannot be
used in uvedit_uv_select_test (it is NULL).

Instead, use uvedit_face_select_test instead in this case.

[0]: d356edf420

Reviewed By: campbellbarton

Ref D15100
2022-06-03 13:14:20 +10:00
1fb36e9a7c Cleanup: DRW: Overlay: Make simple fragment shaders local
This avoids reusing gpu shader files that have different requirements.
2022-06-02 23:50:29 +02:00
4a72b64c7b Cleanup: Split large block of versioning code to separate function
Large blocks of versioning code should be separate to keep
`blo_do_versions_300` more readable.
2022-06-02 22:26:34 +02:00
545b9ddc34 Cleanup: Simplify curves toolbar drawing logic
Use `elif` to clarify that only one case happens.
2022-06-02 22:18:07 +02:00
049e42ef20 Cleanup: DRW: Added basic_ prefix to all *.glsl files in basic/shaders
This is needed to avoid potential naming collision with other engines.
2022-06-02 21:25:38 +02:00
c15e913df8 Cleanup: DRW: Added overlay_ prefix to all *.glsl files in overlay/shaders
This is needed to avoid potential naming collision with other engines
2022-06-02 21:08:05 +02:00
7f47f187c1 EEVEE-Next: Fix compilation of hair domain materials
Also fix formating of `curves_attribute_element_id` which was copy pasted.

# Conflicts:
#	source/blender/draw/engines/eevee_next/shaders/eevee_attributes_lib.glsl
2022-06-02 20:00:05 +02:00
b5fe0f02be Cleanup: DRW: Added overlay_ prefix to all *_info.hh files in overlay 2022-06-02 19:58:10 +02:00
73d8015aa3 Fix T79801: openvdb cache does not support Unicode paths on windows
"Fix" should be taken with a grain of salt, this will fix
the issue on win10 1903 and newer.

OpenVDB uses boosts memory mapped files which call
CreateFileA in the back-end when you feed it a
regular string.

now the encoding for CreateFileA will be whatever the
default is for the system, it internally turns it into
a wide string with said encoding and calls CreateFileW.

This change changes that encoding to UTF-8 for just
blender so we can use utf-8 with any of the narrow
api functions. This is a manifest change and only win10
1903 will look for it, so that sadly limits the fix
to only a subset of users.

While ideally we would have fixed the issue our selves,
some of the calls to openvdb::io::file::open are beyond
our control (ie from inside USD or Mantaflow)

Note: This only changes the behaviour in regard to Win32
API functions, regular CRT functions like fopen or if_stream will
still not accept utf-8 filenames.

Differential Revision: https://developer.blender.org/D14981
Reviewed by: brecht
2022-06-02 11:18:43 -06:00
2b80bfe9d0 Color Management: add Filmic sRGB as an image colorspace
A typical use case is when you want to render with the Filmic view transform, but
composite an existing image in the background that should not be affected by the
view transform.

With this colorspace it's possible to do an inverse Filmic transform, render
everything in scene linear space, and then apply the Filmic transform again.

This is pretty basic in that this is not going to take into account the full view
transform including looks, curves and exposure. But it can be helpful anyway.

Ref T68926
2022-06-02 18:49:04 +02:00
33f5e8f239 Cycles: load 8 bit image textures as half float for some color spaces
For non-raw, non-sRGB color spaces, always use half float even if that uses
more memory. Otherwise the precision loss from conversion to scene linear or
sRGB (as natively understood by the texture sampling) can be too much.

This also required a change to do alpha association ourselves instead of OIIO,
because in OIIO alpha multiplication happens before conversion to half float
and that gives too much precision loss.

Ref T68926
2022-06-02 18:04:38 +02:00
10488d54d9 Cleanup: Use const pointers 2022-06-02 18:02:48 +02:00
91c44920dd Fix: Build error after merge from release branch 2022-06-02 18:02:32 +02:00
3cd6ccd968 Merge branch 'blender-v3.2-release' 2022-06-02 17:54:17 +02:00
2d9c5f3dcf Fix T98556: Crash with extrude node in edit mode
The original index layer was not initialized properly.
Supporting original indices properly for this node is
doable, but for now it is better to simply initialize them
to the "none" value to fix the crash.

Differential Revision: https://developer.blender.org/D15105
2022-06-02 17:53:35 +02:00
96a47af413 Fix T98546: Crash with multires bake and zero levels
The problem was that copying a `CDDerivedMesh` (`CDDM_copy`) doesn't
copy the `vert_normals` reference that it takes from a mesh. Since this
entire area is almost completely broken anyway (mainly in terms of
ownership handling), for now we can just avoid copying the `DerivedMesh`
in the zero levels case.

Longer term, this area should be refactored to remove `DerivedMesh`
and use the newer subdivision evaluation system.

Differential Revision: https://developer.blender.org/D15099
2022-06-02 17:46:38 +02:00
9e43a57d22 Cycles: fix missing attribute update
Differential Revision: https://developer.blender.org/D15102
2022-06-02 16:42:53 +02:00
9580f23596 install_deps: Add support for oneAPI Level Zero library. 2022-06-02 15:53:50 +02:00
1174cdc914 install_deps: raise default ffmpeg version to 5.0, minimum 4.0.
Ref. T98555.
2022-06-02 15:53:50 +02:00
9bb7de274d USD: Enable operator presets when exporting
This patch enables operator presets for USD exports.
The export menu has many options, so enabling the feature
will help users manage their export settings in the same
way they can with other filetypes.

Same as {rB1d668b635632}

Differential Revision: https://developer.blender.org/D14896
2022-06-02 15:07:54 +02:00
7575 changed files with 2994676 additions and 755201 deletions

View File

@@ -1,8 +0,0 @@
{
"project_id" : "Blender",
"conduit_uri" : "https://developer.blender.org/",
"phabricator.uri" : "https://developer.blender.org/",
"git.default-relative-commit" : "origin/master",
"arc.land.update.default" : "rebase",
"arc.land.onto.default" : "master"
}

View File

@@ -61,17 +61,17 @@ ContinuationIndentWidth: 4
# This tries to match Blender's style as much as possible. One
BreakBeforeBraces: Custom
BraceWrapping: {
AfterClass: 'false'
AfterControlStatement: 'false'
AfterEnum : 'false'
AfterFunction : 'true'
AfterNamespace : 'false'
AfterStruct : 'false'
AfterUnion : 'false'
BeforeCatch : 'true'
BeforeElse : 'true'
IndentBraces : 'false'
AfterObjCDeclaration: 'true'
AfterClass: 'false',
AfterControlStatement: 'false',
AfterEnum : 'false',
AfterFunction : 'true',
AfterNamespace : 'false',
AfterStruct : 'false',
AfterUnion : 'false',
BeforeCatch : 'true',
BeforeElse : 'true',
IndentBraces : 'false',
AfterObjCDeclaration: 'true',
}
# For switch statements, indent the cases.
@@ -130,7 +130,7 @@ PenaltyReturnTypeOnItsOwnLine: 10000
#
PenaltyBreakAssignment: 100
AllowShortFunctionsOnASingleLine: None
AllowShortFunctionsOnASingleLine: Empty
SortIncludes: true
@@ -162,6 +162,7 @@ PenaltyBreakString: 1000000
ForEachMacros:
- BEGIN_ANIMFILTER_SUBCHANNELS
- BKE_pbvh_vertex_iter_begin
- BKE_pbvh_face_iter_begin
- BLI_FOREACH_SPARSE_RANGE
- BLI_SMALLSTACK_ITER_BEGIN
- BMO_ITER
@@ -235,6 +236,8 @@ ForEachMacros:
- LOOP_UNSELECTED_POINTS
- LOOP_VISIBLE_KEYS
- LOOP_VISIBLE_POINTS
- LIGHT_FOREACH_BEGIN_DIRECTIONAL
- LIGHT_FOREACH_BEGIN_LOCAL
- LISTBASE_CIRCULAR_BACKWARD_BEGIN
- LISTBASE_CIRCULAR_FORWARD_BEGIN
- LISTBASE_FOREACH
@@ -265,11 +268,13 @@ ForEachMacros:
- SET_SLOT_PROBING_BEGIN
- MAP_SLOT_PROBING_BEGIN
- VECTOR_SET_SLOT_PROBING_BEGIN
- WL_ARRAY_FOR_EACH
- FOREACH_SPECTRUM_CHANNEL
StatementMacros:
- PyObject_HEAD
- PyObject_VAR_HEAD
- ccl_gpu_kernel_postfix
MacroBlockBegin: "^BSDF_CLOSURE_CLASS_BEGIN$"
MacroBlockEnd: "^BSDF_CLOSURE_CLASS_END$"
MacroBlockBegin: "^OSL_CLOSURE_STRUCT_BEGIN$"
MacroBlockEnd: "^OSL_CLOSURE_STRUCT_END$"

View File

@@ -0,0 +1,5 @@
${CommitTitle}
${CommitBody}
Pull Request: https://projects.blender.org/blender/blender/pulls/${PullRequestIndex}

View File

@@ -0,0 +1,3 @@
${PullRequestTitle}
Pull Request: https://projects.blender.org/blender/blender/pulls/${PullRequestIndex}

View File

@@ -0,0 +1,45 @@
name: Bug Report
about: File a bug report
labels:
- "Type/Report"
- "Status/Needs Triage"
- "Priority/Normal"
body:
- type: markdown
attributes:
value: |
### Instructions
First time reporting? See [tips](https://wiki.blender.org/wiki/Process/Bug_Reports).
* Use **Help > Report a Bug** in Blender to fill system information and exact Blender version.
* Test [daily builds](https://builder.blender.org/) to verify if the issue is already fixed.
* Test [previous versions](https://download.blender.org/release/) to find an older working version.
* For feature requests, feedback, questions or build issues, see [communication channels](https://wiki.blender.org/wiki/Communication/Contact#User_Feedback_and_Requests).
* Security vulnerabilities should be [reported privately](https://wiki.blender.org/wiki/Process/Vulnerability_Reports).
* If there are multiple bugs, make multiple bug reports.
- type: textarea
id: body
attributes:
label: "Description"
hide_label: true
value: |
**System Information**
Operating system:
Graphics card:
**Blender Version**
Broken: (example: 2.80, edbf15d3c044, master, 2018-11-28, as found on the splash screen)
Worked: (newest version of Blender that worked as expected)
**Short description of error**
**Exact steps for others to reproduce the error**
Based on the default startup or an attached .blend file (as simple as possible).
- type: markdown
attributes:
value: |
### Help the developers
Bug fixing is important, the developers will handle reports swiftly. For that reason, carefully provide exact steps and a **small and simple .blend file** to reproduce the problem. You do your half of the work, then we do our half!

View File

@@ -0,0 +1 @@
blank_issues_enabled: false

View File

@@ -0,0 +1,10 @@
name: Design
about: Create a design task (for developers only)
labels:
- "Type/Design"
body:
- type: textarea
id: body
attributes:
label: "Description"
hide_label: true

View File

@@ -0,0 +1,10 @@
name: To Do
about: Create a to do task (for developers only)
labels:
- "Type/To Do"
body:
- type: textarea
id: body
attributes:
label: "Description"
hide_label: true

View File

@@ -0,0 +1,17 @@
name: Pull Request
about: Contribute code to Blender
body:
- type: markdown
attributes:
value: |
### Instructions
Guides to [contributing code](https://wiki.blender.org/index.php/Dev:Doc/Process/Contributing_Code) and effective [code review](https://wiki.blender.org/index.php/Dev:Doc/Tools/Code_Review).
By submitting code here, you agree that the code is (compatible with) GNU GPL v2 or later.
- type: textarea
id: body
attributes:
label: "Description"
hide_label: true

View File

@@ -1,5 +1,4 @@
This repository is only used as a mirror of git.blender.org. Blender development happens on
https://developer.blender.org.
This repository is only used as a mirror. Blender development happens on projects.blender.org.
To get started with contributing code, please see:
https://wiki.blender.org/wiki/Process/Contributing_Code

3
.github/stale.yml vendored
View File

@@ -15,8 +15,7 @@ staleLabel: stale
# Comment to post when closing a stale Issue or Pull Request.
closeComment: >
This issue has been automatically closed, because this repository is only
used as a mirror of git.blender.org. Blender development happens on
developer.blender.org.
used as a mirror. Blender development happens on projects.blender.org.
To get started contributing code, please read:
https://wiki.blender.org/wiki/Process/Contributing_Code

27
.gitignore vendored
View File

@@ -39,7 +39,7 @@ Desktop.ini
/doc/python_api/rst/bmesh.ops.rst
# in-source lib downloads
/build_files/build_environment/downloads
/build_files/build_environment/downloads/
# in-source buildbot signing configuration
/build_files/buildbot/codesign/config_server.py
@@ -48,4 +48,27 @@ Desktop.ini
waveletNoiseTile.bin
# testing environment
/Testing
/Testing/
# Translations.
/locale/user-config.py
# External repositories.
/scripts/addons/
/scripts/addons_contrib/
# Ignore old submodules directories.
# Eventually need to get rid of those, but for the first time of transition
# avoid indidents when the folders exists after bisect and developers staging
# them by accident.
/release/scripts/addons/
/release/datafiles/locale/
/release/scripts/addons_contrib/
/source/tools/
# Build files for VS and VS Code.
/build/
/out/
CMakeSettings.json
CMakePresets.json
CMakeUserPresets.json

20
.gitmodules vendored
View File

@@ -1,20 +0,0 @@
[submodule "release/scripts/addons"]
path = release/scripts/addons
url = ../blender-addons.git
branch = master
ignore = all
[submodule "release/scripts/addons_contrib"]
path = release/scripts/addons_contrib
url = ../blender-addons-contrib.git
branch = master
ignore = all
[submodule "release/datafiles/locale"]
path = release/datafiles/locale
url = ../blender-translations.git
branch = master
ignore = all
[submodule "source/tools"]
path = source/tools
url = ../blender-dev-tools.git
branch = master
ignore = all

File diff suppressed because it is too large Load Diff

View File

@@ -69,7 +69,14 @@ Static Source Code Checking
* 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.
see: tools/check_source/check_mypy_config.py scripts which are included.
Documentation Checking
* check_wiki_file_structure:
Check the WIKI documentation for the source-tree's file structure
matches Blender's source-code.
See: https://wiki.blender.org/wiki/Source/File_Structure
Spell Checkers
This runs the spell checker from the developer tools repositor.
@@ -78,7 +85,7 @@ Spell Checkers
* check_spelling_osl: Check for spelling errors (OSL only).
* check_spelling_py: Check for spelling errors (Python only).
Note: an additional word-list is maintained at: 'source/tools/check_source/check_spelling_c_config.py'
Note: an additional word-list is maintained at: 'tools/check_source/check_spelling_c_config.py'
Note: that spell checkers can take a 'CHECK_SPELLING_CACHE' filepath argument,
so re-running does not need to re-check unchanged files.
@@ -162,6 +169,7 @@ CPU:=$(shell uname -m)
# Source and Build DIR's
BLENDER_DIR:=$(shell pwd -P)
BUILD_TYPE:=Release
BLENDER_IS_PYTHON_MODULE:=
# CMake arguments, assigned to local variable to make it mutable.
CMAKE_CONFIG_ARGS := $(BUILD_CMAKE_ARGS)
@@ -210,7 +218,7 @@ endif
# Set the LIBDIR, an empty string when not found.
LIBDIR:=$(wildcard ../lib/${OS_NCASE}_${CPU})
ifeq (, $(LIBDIR))
LIBDIR:=$(wildcard ../lib/${OS_NCASE}_centos7_${CPU})
LIBDIR:=$(wildcard ../lib/${OS_NCASE}_${CPU}_glibc_228)
endif
ifeq (, $(LIBDIR))
LIBDIR:=$(wildcard ../lib/${OS_NCASE})
@@ -229,9 +237,18 @@ endif
# -----------------------------------------------------------------------------
# additional targets for the build configuration
# Additional targets for the build configuration
# support 'make debug'
# NOTE: These targets can be combined and are applied in reverse order listed here.
# So it's important that `bpy` comes before `release` (for example)
# `make bpy release` first loads `release` configuration, then `bpy`.
# This is important as `bpy` will turn off some settings enabled by release.
ifneq "$(findstring bpy, $(MAKECMDGOALS))" ""
BUILD_DIR:=$(BUILD_DIR)_bpy
CMAKE_CONFIG_ARGS:=-C"$(BLENDER_DIR)/build_files/cmake/config/bpy_module.cmake" $(CMAKE_CONFIG_ARGS)
BLENDER_IS_PYTHON_MODULE:=1
endif
ifneq "$(findstring debug, $(MAKECMDGOALS))" ""
BUILD_DIR:=$(BUILD_DIR)_debug
BUILD_TYPE:=Debug
@@ -256,10 +273,6 @@ ifneq "$(findstring headless, $(MAKECMDGOALS))" ""
BUILD_DIR:=$(BUILD_DIR)_headless
CMAKE_CONFIG_ARGS:=-C"$(BLENDER_DIR)/build_files/cmake/config/blender_headless.cmake" $(CMAKE_CONFIG_ARGS)
endif
ifneq "$(findstring bpy, $(MAKECMDGOALS))" ""
BUILD_DIR:=$(BUILD_DIR)_bpy
CMAKE_CONFIG_ARGS:=-C"$(BLENDER_DIR)/build_files/cmake/config/bpy_module.cmake" $(CMAKE_CONFIG_ARGS)
endif
ifneq "$(findstring developer, $(MAKECMDGOALS))" ""
CMAKE_CONFIG_ARGS:=-C"$(BLENDER_DIR)/build_files/cmake/config/blender_developer.cmake" $(CMAKE_CONFIG_ARGS)
@@ -286,7 +299,11 @@ else
ifneq ("$(wildcard $(DEPS_BUILD_DIR)/build.ninja)","")
DEPS_BUILD_COMMAND:=ninja
else
DEPS_BUILD_COMMAND:=make -s
ifeq ($(OS), Darwin)
DEPS_BUILD_COMMAND:=make -s
else
DEPS_BUILD_COMMAND:="$(BLENDER_DIR)/build_files/build_environment/linux/make_deps_wrapper.sh" -s
endif
endif
endif
@@ -297,8 +314,10 @@ endif
# use the default build path can still use utility helpers.
ifeq ($(OS), Darwin)
BLENDER_BIN?="$(BUILD_DIR)/bin/Blender.app/Contents/MacOS/Blender"
BLENDER_BIN_DIR?="$(BUILD_DIR)/bin/Blender.app/Contents/MacOS/Blender"
else
BLENDER_BIN?="$(BUILD_DIR)/bin/blender"
BLENDER_BIN_DIR?="$(BUILD_DIR)/bin"
endif
@@ -355,8 +374,12 @@ all: .FORCE
@echo Building Blender ...
$(BUILD_COMMAND) -C "$(BUILD_DIR)" -j $(NPROCS) install
@echo
@echo edit build configuration with: "$(BUILD_DIR)/CMakeCache.txt" run make again to rebuild.
@echo Blender successfully built, run from: $(BLENDER_BIN)
@echo Edit build configuration with: \"$(BUILD_DIR)/CMakeCache.txt\" run make again to rebuild.
@if test -z "$(BLENDER_IS_PYTHON_MODULE)"; then \
echo Blender successfully built, run from: $(BLENDER_BIN); \
else \
echo Blender successfully built as a Python module, \"bpy\" can be imported from: $(BLENDER_BIN_DIR); \
fi
@echo
debug: all
@@ -379,7 +402,7 @@ endif
deps: .FORCE
@echo
@echo Configuring dependencies in \"$(DEPS_BUILD_DIR)\"
@echo Configuring dependencies in \"$(DEPS_BUILD_DIR)\", install to \"$(DEPS_INSTALL_DIR)\"
@cmake -H"$(DEPS_SOURCE_DIR)" \
-B"$(DEPS_BUILD_DIR)" \
@@ -467,18 +490,22 @@ check_smatch: .FORCE
$(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)/tools/check_source/check_mypy.py"
check_wiki_file_structure: .FORCE
@PYTHONIOENCODING=utf_8 $(PYTHON) \
"$(BLENDER_DIR)/tools/check_wiki/check_wiki_file_structure.py"
check_spelling_py: .FORCE
@cd "$(BUILD_DIR)" ; \
PYTHONIOENCODING=utf_8 $(PYTHON) \
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
"$(BLENDER_DIR)/release/scripts"
"$(BLENDER_DIR)/tools/check_source/check_spelling.py" \
"$(BLENDER_DIR)/scripts"
check_spelling_c: .FORCE
@cd "$(BUILD_DIR)" ; \
PYTHONIOENCODING=utf_8 $(PYTHON) \
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
"$(BLENDER_DIR)/tools/check_source/check_spelling.py" \
--cache-file=$(CHECK_SPELLING_CACHE) \
"$(BLENDER_DIR)/source" \
"$(BLENDER_DIR)/intern/cycles" \
@@ -488,21 +515,21 @@ check_spelling_c: .FORCE
check_spelling_osl: .FORCE
@cd "$(BUILD_DIR)" ; \
PYTHONIOENCODING=utf_8 $(PYTHON) \
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
"$(BLENDER_DIR)/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_DIR)/source/tools/check_source/check_descriptions.py"
"$(BLENDER_DIR)/tools/check_source/check_descriptions.py"
check_deprecated: .FORCE
@PYTHONIOENCODING=utf_8 $(PYTHON) \
source/tools/check_source/check_deprecated.py
tools/check_source/check_deprecated.py
check_licenses: .FORCE
@PYTHONIOENCODING=utf_8 $(PYTHON) \
"$(BLENDER_DIR)/source/tools/check_source/check_licenses.py" \
"$(BLENDER_DIR)/tools/check_source/check_licenses.py" \
"--show-headers=$(SHOW_HEADERS)"
check_pep8: .FORCE
@@ -511,7 +538,7 @@ check_pep8: .FORCE
check_cmake: .FORCE
@PYTHONIOENCODING=utf_8 $(PYTHON) \
source/tools/check_source/check_cmake_consistency.py
tools/check_source/check_cmake_consistency.py
# -----------------------------------------------------------------------------
@@ -549,8 +576,8 @@ update_code: .FORCE
@$(PYTHON) ./build_files/utils/make_update.py --no-libraries
format: .FORCE
@PATH="${LIBDIR}/llvm/bin/:$(PATH)" $(PYTHON) source/tools/utils_maintenance/clang_format_paths.py $(PATHS)
@$(PYTHON) source/tools/utils_maintenance/autopep8_format_paths.py --autopep8-command="$(AUTOPEP8)" $(PATHS)
@PATH="${LIBDIR}/llvm/bin/:$(PATH)" $(PYTHON) tools/utils_maintenance/clang_format_paths.py $(PATHS)
@$(PYTHON) tools/utils_maintenance/autopep8_format_paths.py --autopep8-command="$(AUTOPEP8)" $(PATHS)
# -----------------------------------------------------------------------------

38
README.md Normal file
View File

@@ -0,0 +1,38 @@
<!--
Keep this document short & concise,
linking to external resources instead of including content in-line.
See 'release/text/readme.html' for the end user read-me.
-->
Blender
=======
Blender is the free and open source 3D creation suite.
It supports the entirety of the 3D pipeline-modeling, rigging, animation, simulation, rendering, compositing,
motion tracking and video editing.
![Blender screenshot](https://code.blender.org/wp-content/uploads/2018/12/springrg.jpg "Blender screenshot")
Project Pages
-------------
- [Main Website](http://www.blender.org)
- [Reference Manual](https://docs.blender.org/manual/en/latest/index.html)
- [User Community](https://www.blender.org/community/)
Development
-----------
- [Build Instructions](https://wiki.blender.org/wiki/Building_Blender)
- [Code Review & Bug Tracker](https://projects.blender.org)
- [Developer Forum](https://devtalk.blender.org)
- [Developer Documentation](https://wiki.blender.org)
License
-------
Blender as a whole is licensed under the GNU General Public License, Version 3.
Individual files may have a different, but compatible license.
See [blender.org/about/license](https://www.blender.org/about/license) for details.

View File

@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
####################################################################################################
##################################################################################################
#
# This is a build system used by platform maintainers to build library dependencies on
# Windows, macOS and Linux.
@@ -22,24 +22,29 @@
# Install compiler cmake autoconf automake libtool yasm tcl
# Run "make deps" from main Blender directory
#
####################################################################################################
##################################################################################################
project("BlenderDependencies")
cmake_minimum_required(VERSION 3.5)
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW) # CMake 3.24+ Set the date/time for extracted files to time of extraction
endif()
include(ExternalProject)
include(cmake/check_software.cmake)
include(cmake/versions.cmake)
include(cmake/options.cmake)
# `versions.cmake` needs to be included after `options.cmake`
# due to the `BLENDER_PLATFORM_ARM` variable being needed.
include(cmake/versions.cmake)
include(cmake/boost_build_options.cmake)
include(cmake/download.cmake)
include(cmake/macros.cmake)
if(ENABLE_MINGW64)
include(cmake/setup_mingw64.cmake)
else()
set(mingw_LIBDIR ${LIBDIR})
endif()
include(cmake/ssl.cmake)
include(cmake/zlib.cmake)
include(cmake/zstd.cmake)
include(cmake/openal.cmake)
@@ -51,57 +56,68 @@ include(cmake/imath.cmake)
include(cmake/openexr.cmake)
include(cmake/brotli.cmake)
include(cmake/freetype.cmake)
include(cmake/epoxy.cmake)
include(cmake/freeglut.cmake)
include(cmake/glew.cmake)
include(cmake/alembic.cmake)
include(cmake/opensubdiv.cmake)
include(cmake/sdl.cmake)
include(cmake/opencollada.cmake)
include(cmake/llvm.cmake)
if(APPLE)
include(cmake/openmp.cmake)
endif()
if(UNIX)
include(cmake/nasm.cmake)
endif()
include(cmake/openimageio.cmake)
include(cmake/tiff.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)
include(cmake/python.cmake)
option(USE_PIP_NUMPY "Install NumPy using pip wheel instead of building from source" OFF)
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64"))
set(USE_PIP_NUMPY ON)
else()
include(cmake/numpy.cmake)
endif()
include(cmake/llvm.cmake)
include(cmake/osl.cmake)
include(cmake/numpy.cmake)
include(cmake/python_site_packages.cmake)
include(cmake/package_python.cmake)
include(cmake/openimageio.cmake)
include(cmake/usd.cmake)
include(cmake/materialx.cmake)
include(cmake/openvdb.cmake)
include(cmake/potrace.cmake)
include(cmake/haru.cmake)
# Boost needs to be included after python.cmake due to the PYTHON_BINARY variable being needed.
# Boost needs to be included after `python.cmake` due to the PYTHON_BINARY variable being needed.
include(cmake/boost.cmake)
include(cmake/pugixml.cmake)
include(cmake/ispc.cmake)
include(cmake/openimagedenoise.cmake)
include(cmake/embree.cmake)
include(cmake/openpgl.cmake)
include(cmake/fmt.cmake)
include(cmake/robinmap.cmake)
include(cmake/xml2.cmake)
include(cmake/fribidi.cmake)
include(cmake/harfbuzz.cmake)
if(NOT APPLE)
include(cmake/xr_openxr.cmake)
if(NOT WIN32 OR BUILD_MODE STREQUAL Release)
include(cmake/dpcpp.cmake)
include(cmake/dpcpp_deps.cmake)
endif()
if(NOT WIN32)
include(cmake/igc.cmake)
include(cmake/gmmlib.cmake)
include(cmake/ocloc.cmake)
endif()
endif()
# OpenColorIO and dependencies.
include(cmake/expat.cmake)
include(cmake/pystring.cmake)
include(cmake/yamlcpp.cmake)
include(cmake/minizipng.cmake)
include(cmake/opencolorio.cmake)
if(BLENDER_PLATFORM_ARM)
@@ -128,6 +144,7 @@ if(NOT WIN32 OR ENABLE_MINGW64)
include(cmake/vpx.cmake)
include(cmake/x264.cmake)
include(cmake/xvidcore.cmake)
include(cmake/aom.cmake)
include(cmake/ffmpeg.cmake)
include(cmake/fftw.cmake)
include(cmake/sndfile.cmake)
@@ -136,7 +153,6 @@ if(NOT WIN32 OR ENABLE_MINGW64)
endif()
if(UNIX)
include(cmake/flac.cmake)
include(cmake/xml2.cmake)
if(NOT APPLE)
include(cmake/spnav.cmake)
include(cmake/jemalloc.cmake)
@@ -149,7 +165,6 @@ if(UNIX)
include(cmake/bzip2.cmake)
include(cmake/ffi.cmake)
include(cmake/lzma.cmake)
include(cmake/ssl.cmake)
include(cmake/sqlite.cmake)
endif()
@@ -157,6 +172,13 @@ if(UNIX AND NOT APPLE)
include(cmake/libglu.cmake)
include(cmake/mesa.cmake)
include(cmake/wayland_protocols.cmake)
# Can be removed when the build-bot upgrades to v1.20.x or newer.
include(cmake/wayland.cmake)
include(cmake/wayland_libdecor.cmake)
endif()
include(cmake/shaderc_deps.cmake)
include(cmake/shaderc.cmake)
include(cmake/vulkan.cmake)
include(cmake/pybind11.cmake)
include(cmake/harvest.cmake)
include(cmake/cve_check.cmake)

View File

@@ -17,6 +17,7 @@ ExternalProject_Add(external_alembic
URL file://${PACKAGE_DIR}/${ALEMBIC_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${ALEMBIC_HASH_TYPE}=${ALEMBIC_HASH}
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
PREFIX ${BUILD_DIR}/alembic
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/alembic -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${ALEMBIC_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/alembic
@@ -41,5 +42,5 @@ endif()
add_dependencies(
external_alembic
external_openexr
external_imath
)

View File

@@ -0,0 +1,41 @@
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
# The default generator on windows is msbuild, which we do not
# want to use for this dep, as needs to build with mingw
set(AOM_GENERATOR "Ninja")
# The default flags are full of MSVC options given this will be
# building with mingw, it'll have an unhappy time with that and
# we need to clear them out.
set(AOM_CMAKE_FLAGS )
else()
set(AOM_GENERATOR "Unix Makefiles")
set(AOM_CMAKE_FLAGS ${DEFAULT_CMAKE_FLAGS})
endif()
set(AOM_EXTRA_ARGS
-DENABLE_TESTDATA=OFF
-DENABLE_TESTS=OFF
-DENABLE_TOOLS=OFF
-DENABLE_EXAMPLES=OFF
${AOM_EXTRA_ARGS_WIN32}
)
# This is slightly different from all other deps in the way that
# aom uses cmake as a build system, but still needs the environment setup
# to include perl so we manually setup the environment and call
# cmake directly for the configure, build and install commands.
ExternalProject_Add(external_aom
URL file://${PACKAGE_DIR}/${AOM_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${AOM_HASH_TYPE}=${AOM_HASH}
PREFIX ${BUILD_DIR}/aom
PATCH_COMMAND ${PATCH_CMD} --verbose -p 1 -N -d ${BUILD_DIR}/aom/src/external_aom < ${PATCH_DIR}/aom.diff
CONFIGURE_COMMAND ${CONFIGURE_ENV} &&
cd ${BUILD_DIR}/aom/src/external_aom-build/ &&
${CMAKE_COMMAND} -G "${AOM_GENERATOR}" -DCMAKE_INSTALL_PREFIX=${LIBDIR}/aom ${AOM_CMAKE_FLAGS} ${AOM_EXTRA_ARGS} ${BUILD_DIR}/aom/src/external_aom/
BUILD_COMMAND ${CMAKE_COMMAND} --build .
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install
INSTALL_DIR ${LIBDIR}/aom
)

View File

@@ -38,19 +38,3 @@ if(WIN32)
external_pthreads
)
endif()
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_blosc after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/blosc/lib/libblosc.lib ${HARVEST_TARGET}/blosc/lib/libblosc.lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/blosc/include/ ${HARVEST_TARGET}/blosc/include/
DEPENDEES install
)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_blosc after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/blosc/lib/libblosc_d.lib ${HARVEST_TARGET}/blosc/lib/libblosc_d.lib
DEPENDEES install
)
endif()
endif()

View File

@@ -3,8 +3,18 @@
if(WIN32)
set(BOOST_CONFIGURE_COMMAND bootstrap.bat)
set(BOOST_BUILD_COMMAND b2)
set(BOOST_BUILD_OPTIONS runtime-link=shared )
set(BOOST_HARVEST_CMD ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/boost/lib/ ${HARVEST_TARGET}/boost/lib/ )
set(BOOST_BUILD_OPTIONS runtime-link=shared)
if(BUILD_MODE STREQUAL Debug)
list(APPEND BOOST_BUILD_OPTIONS python-debugging=on variant=debug)
if(WITH_OPTIMIZED_DEBUG)
list(APPEND BOOST_BUILD_OPTIONS debug-symbols=off)
else()
list(APPEND BOOST_BUILD_OPTIONS debug-symbols=on)
endif()
else()
list(APPEND BOOST_BUILD_OPTIONS variant=release)
endif()
set(BOOST_HARVEST_CMD ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/boost/lib/ ${HARVEST_TARGET}/boost/lib/)
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()
@@ -13,28 +23,24 @@ elseif(APPLE)
set(BOOST_BUILD_COMMAND ./b2)
set(BOOST_BUILD_OPTIONS toolset=clang-darwin cxxflags=${PLATFORM_CXXFLAGS} linkflags=${PLATFORM_LDFLAGS} visibility=global --disable-icu boost.locale.icu=off)
set(BOOST_HARVEST_CMD echo .)
set(BOOST_PATCH_COMMAND echo .)
else()
set(BOOST_HARVEST_CMD echo .)
set(BOOST_CONFIGURE_COMMAND ./bootstrap.sh)
set(BOOST_BUILD_COMMAND ./b2)
set(BOOST_BUILD_OPTIONS cxxflags=${PLATFORM_CXXFLAGS} --disable-icu boost.locale.icu=off)
set(BOOST_PATCH_COMMAND echo .)
endif()
if(WITH_BOOST_PYTHON)
set(JAM_FILE ${BUILD_DIR}/boost.user-config.jam)
configure_file(${PATCH_DIR}/boost.user.jam.in ${JAM_FILE})
set(JAM_FILE ${BUILD_DIR}/boost.user-config.jam)
configure_file(${PATCH_DIR}/boost.user.jam.in ${JAM_FILE})
set(BOOST_PYTHON_OPTIONS
--with-python
--user-config=${JAM_FILE}
)
if(WIN32 AND BUILD_MODE STREQUAL Debug)
set(BOOST_PYTHON_OPTIONS
--with-python
--user-config=${JAM_FILE}
${BOOST_PYTHON_OPTIONS}
define=BOOST_DEBUG_PYTHON
)
if(WIN32 AND BUILD_MODE STREQUAL Debug)
set(BOOST_PYTHON_OPTIONS
${BOOST_PYTHON_OPTIONS}
define=BOOST_DEBUG_PYTHON
)
endif()
endif()
set(BOOST_OPTIONS
@@ -64,17 +70,15 @@ ExternalProject_Add(external_boost
URL_HASH ${BOOST_HASH_TYPE}=${BOOST_HASH}
PREFIX ${BUILD_DIR}/boost
UPDATE_COMMAND ""
PATCH_COMMAND ${BOOST_PATCH_COMMAND}
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/boost/src/external_boost < ${PATCH_DIR}/boost.diff
CONFIGURE_COMMAND ${BOOST_CONFIGURE_COMMAND}
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_COMMAND ${BOOST_BUILD_COMMAND} ${BOOST_BUILD_OPTIONS} -j${MAKE_THREADS} architecture=${BOOST_ARCHITECTURE} address-model=${BOOST_ADDRESS_MODEL} link=shared threading=multi ${BOOST_OPTIONS} --prefix=${LIBDIR}/boost install
BUILD_IN_SOURCE 1
INSTALL_COMMAND "${BOOST_HARVEST_CMD}"
)
if(WITH_BOOST_PYTHON)
add_dependencies(
external_boost
external_python
external_numpy
)
endif()
add_dependencies(
external_boost
external_python
external_numpy
)

View File

@@ -20,11 +20,12 @@ endif()
set(DEFAULT_BOOST_FLAGS
-DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING}
-DBoost_USE_MULTITHREADED=ON
-DBoost_USE_STATIC_LIBS=ON
-DBoost_USE_STATIC_LIBS=OFF
-DBoost_USE_STATIC_RUNTIME=OFF
-DBOOST_ROOT=${LIBDIR}/boost
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_NO_BOOST_CMAKE=ON
-DBoost_ADDITIONAL_VERSIONS=${BOOST_VERSION_SHORT}
-DBOOST_LIBRARYDIR=${LIBDIR}/boost/lib/
-DBoost_USE_DEBUG_PYTHON=On
)

View File

@@ -12,19 +12,16 @@ if(UNIX)
automake
bison
${_libtoolize_name}
ninja
pkg-config
tclsh
yasm
)
if(NOT APPLE)
set(_required_software
${_required_software}
# Needed for Mesa.
meson
ninja
)
if(APPLE)
list(APPEND _required_software dos2unix)
else()
list(APPEND _required_software patchelf)
endif()
foreach(_software ${_required_software})
@@ -54,13 +51,10 @@ if(UNIX)
" ${_software_missing}\n"
"\n"
"On Debian and Ubuntu:\n"
" apt install autoconf automake libtool yasm tcl ninja-build meson python3-mako\n"
" apt install autoconf automake bison libtool yasm tcl ninja-build meson python3-mako patchelf\n"
"\n"
"On macOS Intel (with homebrew):\n"
" brew install autoconf automake bison libtool pkg-config yasm\n"
"\n"
"On macOS ARM (with homebrew):\n"
" brew install autoconf automake bison flex libtool pkg-config yasm\n"
"On macOS (with homebrew):\n"
" brew install autoconf automake bison dos2unix flex libtool meson ninja pkg-config yasm\n"
"\n"
"Other platforms:\n"
" Install equivalent packages.\n")

View File

@@ -0,0 +1,75 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# CVE Check requirements
#
# - A working installation of intels cve-bin-tool [1] has to be available in
# your path
#
# - Not strictly required, but highly recommended is obtaining a NVD key from
# nist since it significantly speeds up downloading/updating the required
# databases one can request a key on the following website:
# https://nvd.nist.gov/developers/request-an-api-key
# Bill of Materials construction
#
# This constructs a CSV cve-bin-tool [1] can read and process. Sadly
# cve-bin-tool at this point does not take a list of CPE's and output a check
# based on that list. so we need to pick apart the CPE retrieve the vendor,
# product and version tokens and generate a CSV.
#
# [1] https://github.com/intel/cve-bin-tool
# Because not all deps are downloaded (ie python packages) but can still have a
# xxx_CPE declared loop over all variables and look for variables ending in CPE.
set(SBOMCONTENTS)
get_cmake_property(_variableNames VARIABLES)
foreach(_variableName ${_variableNames})
if(_variableName MATCHES "CPE$")
string(REPLACE ":" ";" CPE_LIST ${${_variableName}})
string(REPLACE "_CPE" "_ID" CPE_DEPNAME ${_variableName})
list(GET CPE_LIST 3 CPE_VENDOR)
list(GET CPE_LIST 4 CPE_NAME)
list(GET CPE_LIST 5 CPE_VERSION)
set(${CPE_DEPNAME} "${CPE_VENDOR},${CPE_NAME},${CPE_VERSION}")
set(SBOMCONTENTS "${SBOMCONTENTS}${CPE_VENDOR},${CPE_NAME},${CPE_VERSION},,,\n")
endif()
endforeach()
configure_file(${CMAKE_SOURCE_DIR}/cmake/cve_check.csv.in ${CMAKE_CURRENT_BINARY_DIR}/cve_check.csv @ONLY)
# Custom Targets
#
# This defines two new custom targets one could run in the build folder
# `cve_check` which will output the report to the console, and `cve_check_html`
# which will write out blender_dependencies.html in the build folder that one
# could share with other people or be used to get more information on the
# reported CVE's.
#
# cve-bin-tool takes data from the nist nvd database which rate limits
# unauthenticated requests to 1 requests per 6 seconds making the database
# download take "quite a bit" of time.
#
# When adding -DCVE_CHECK_NVD_KEY=your_api_key_here to your cmake invocation
# this key will be passed on to cve-bin-tool speeding up the process.
#
if(DEFINED CVE_CHECK_NVD_KEY)
set(NVD_ARGS --nvd-api-key ${CVE_CHECK_NVD_KEY})
endif()
# This will just report to the console
add_custom_target(cve_check
COMMAND cve-bin-tool
${NVD_ARGS}
-i ${CMAKE_CURRENT_BINARY_DIR}/cve_check.csv
--affected-versions
SOURCES ${CMAKE_CURRENT_BINARY_DIR}/cve_check.csv
)
# This will write out blender_dependencies.html
add_custom_target(cve_check_html
COMMAND cve-bin-tool
${NVD_ARGS}
-i ${CMAKE_CURRENT_BINARY_DIR}/cve_check.csv
-f html
SOURCES ${CMAKE_CURRENT_BINARY_DIR}/cve_check.csv
)

View File

@@ -0,0 +1,29 @@
vendor,product,version,cve_number,remarks,comment
@OPENJPEG_ID@,CVE-2016-9675,Ignored,issue in convert command line tool not used by blender
@PYTHON_ID@,CVE-2009-2940,Ignored,issue in pygresql not used by blender
@PYTHON_ID@,CVE-2020-29396,Ignored,issue in odoo not used by blender
@PYTHON_ID@,CVE-2021-32052,Ignored,issue in django not used by blender
@PYTHON_ID@,CVE-2009-3720,Ignored,already fixed in libexpat version used
@SSL_ID@,CVE-2009-1390,Ignored,issue in mutt not used by blender
@SSL_ID@,CVE-2009-3765,Ignored,issue in mutt not used by blender
@SSL_ID@,CVE-2009-3766,Ignored,issue in mutt not used by blender
@SSL_ID@,CVE-2009-3767,Ignored,issue in ldap not used by blender
@SSL_ID@,CVE-2019-0190,Ignored,issue in apache not used by blender
@TIFF_ID@,CVE-2022-2056,Ignored,issue in tiff command line tool not used by blender
@TIFF_ID@,CVE-2022-2057,Ignored,issue in tiff command line tool not used by blender
@TIFF_ID@,CVE-2022-2058,Ignored,issue in tiff command line tool not used by blender
@TIFF_ID@,CVE-2022-2519,Ignored,issue in tiff command line tool not used by blender
@TIFF_ID@,CVE-2022-2520,Ignored,issue in tiff command line tool not used by blender
@TIFF_ID@,CVE-2022-2521,Ignored,issue in tiff command line tool not used by blender
@TIFF_ID@,CVE-2022-2953,Ignored,issue in tiff command line tool not used by blender
@TIFF_ID@,CVE-2022-34526,Ignored,issue in tiff command line tool not used by blender
@TIFF_ID@,CVE-2022-3570,Ignored,issue in tiff command line tool not used by blender
@TIFF_ID@,CVE-2022-3597,Ignored,issue in tiff command line tool not used by blender
@TIFF_ID@,CVE-2022-3598,Ignored,issue in tiff command line tool not used by blender
@TIFF_ID@,CVE-2022-3599,Ignored,issue in tiff command line tool not used by blender
@TIFF_ID@,CVE-2022-3626,Ignored,issue in tiff command line tool not used by blender
@TIFF_ID@,CVE-2022-3627,Ignored,issue in tiff command line tool not used by blender
@XML2_ID@,CVE-2016-3709,Ignored,not affecting blender and not considered a security issue upstream
@GMP_ID@,CVE-2021-43618,Mitigated,patched using upstream commit 561a9c25298e
@SQLITE_ID@,CVE-2022-35737,Ignored,only affects SQLITE_ENABLE_STAT4 compile option not used by blender or python
@SBOMCONTENTS@

View File

@@ -10,20 +10,65 @@ function(download_source dep)
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})
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})
set(TARGET_URI https://svn.blender.org/svnroot/bf-blender/trunk/lib/packages/${TARGET_FILE})
endif()
# Validate all required variables are set and give an explicit error message
# rather than CMake erroring out later on with a more ambigious error.
if(NOT DEFINED TARGET_FILE)
message(FATAL_ERROR "${dep}_FILE variable not set")
endif()
if(NOT DEFINED TARGET_HASH)
message(FATAL_ERROR "${dep}_HASH variable not set")
endif()
if(NOT DEFINED TARGET_HASH_TYPE)
message(FATAL_ERROR "${dep}_HASH_TYPE variable not set")
endif()
if(NOT DEFINED TARGET_URI)
message(FATAL_ERROR "${dep}_URI variable not set")
endif()
set(TARGET_FILE ${PACKAGE_DIR}/${TARGET_FILE})
message("Checking source : ${dep} (${TARGET_FILE})")
if(NOT EXISTS ${TARGET_FILE})
message("Checking source : ${dep} - source not found downloading from ${TARGET_URI}")
file(DOWNLOAD ${TARGET_URI} ${TARGET_FILE}
TIMEOUT 1800 # seconds
EXPECTED_HASH ${TARGET_HASH_TYPE}=${TARGET_HASH}
TLS_VERIFY ON
SHOW_PROGRESS
)
file(
DOWNLOAD ${TARGET_URI} ${TARGET_FILE}
TIMEOUT 1800 # seconds
EXPECTED_HASH ${TARGET_HASH_TYPE}=${TARGET_HASH}
TLS_VERIFY ON
SHOW_PROGRESS
)
endif()
if(EXISTS ${TARGET_FILE})
# Sometimes the download fails, but that is not a
# fail condition for "file(DOWNLOAD" it will warn about
# a CRC mismatch and just carry on, we need to explicitly
# catch this and remove the bogus 0 byte file so we can
# retry without having to go find the file and manually
# delete it.
file(SIZE ${TARGET_FILE} TARGET_SIZE)
if(${TARGET_SIZE} EQUAL 0)
file(REMOVE ${TARGET_FILE})
message(FATAL_ERROR "for ${TARGET_FILE} file size 0, download likely failed, deleted...")
endif()
# If we are using sources from the blender repo also
# validate that the hashes match, this takes a
# little more time, but protects us when we are
# building a release package and one of the packages
# is missing or incorrect.
#
# For regular platform maintenaince this is not needed
# since the actual build of the dep will notify the
# platform maintainer if there is a problem with the
# source package and refuse to build.
if(NOT PACKAGE_USE_UPSTREAM_SOURCES OR FORCE_CHECK_HASH)
file(${TARGET_HASH_TYPE} ${TARGET_FILE} LOCAL_HASH)
if(NOT ${TARGET_HASH} STREQUAL ${LOCAL_HASH})
message(FATAL_ERROR "${TARGET_FILE} ${TARGET_HASH_TYPE} mismatch\nExpected\t: ${TARGET_HASH}\nActual\t: ${LOCAL_HASH}")
endif()
endif()
endif()
endfunction(download_source)
@@ -36,13 +81,14 @@ download_source(BLOSC)
download_source(PTHREADS)
download_source(OPENEXR)
download_source(FREETYPE)
download_source(GLEW)
download_source(EPOXY)
download_source(FREEGLUT)
download_source(ALEMBIC)
download_source(OPENSUBDIV)
download_source(SDL)
download_source(OPENCOLLADA)
download_source(OPENCOLORIO)
download_source(MINIZIPNG)
download_source(LLVM)
download_source(OPENMP)
download_source(OPENIMAGEIO)
@@ -51,7 +97,6 @@ download_source(OSL)
download_source(PYTHON)
download_source(TBB)
download_source(OPENVDB)
download_source(NANOVDB)
download_source(NUMPY)
download_source(LAME)
download_source(OGG)
@@ -71,7 +116,6 @@ download_source(WEBP)
download_source(SPNAV)
download_source(JEMALLOC)
download_source(XML2)
download_source(TINYXML)
download_source(YAMLCPP)
download_source(EXPAT)
download_source(PUGIXML)
@@ -83,21 +127,51 @@ download_source(SSL)
download_source(SQLITE)
download_source(EMBREE)
download_source(USD)
download_source(MATERIALX)
download_source(OIDN)
download_source(LIBGLU)
download_source(MESA)
download_source(NASM)
download_source(XR_OPENXR_SDK)
download_source(WL_PROTOCOLS)
download_source(WAYLAND)
download_source(WAYLAND_LIBDECOR)
download_source(ISPC)
download_source(GMP)
download_source(POTRACE)
download_source(HARU)
download_source(ZSTD)
download_source(SSE2NEON)
download_source(FLEX)
download_source(BROTLI)
download_source(FMT)
download_source(ROBINMAP)
download_source(IMATH)
download_source(PYSTRING)
download_source(OPENPGL)
download_source(LEVEL_ZERO)
download_source(DPCPP)
download_source(VCINTRINSICS)
download_source(OPENCLHEADERS)
download_source(ICDLOADER)
download_source(MP11)
download_source(SPIRV_HEADERS)
download_source(IGC)
download_source(IGC_LLVM)
download_source(IGC_OPENCL_CLANG)
download_source(IGC_VCINTRINSICS)
download_source(IGC_SPIRV_HEADERS)
download_source(IGC_SPIRV_TOOLS)
download_source(IGC_SPIRV_TRANSLATOR)
download_source(GMMLIB)
download_source(OCLOC)
download_source(AOM)
download_source(FRIBIDI)
download_source(HARFBUZZ)
download_source(SHADERC)
download_source(SHADERC_SPIRV_TOOLS)
download_source(SHADERC_SPIRV_HEADERS)
download_source(SHADERC_GLSLANG)
download_source(VULKAN_HEADERS)
download_source(VULKAN_LOADER)
download_source(PYBIND11)

View File

@@ -0,0 +1,116 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# LLVM does not switch over to cpp17 until llvm 16 and building ealier versions with
# MSVC is leading to some crashes in ISPC. Switch back to their default on all platforms
# for now.
string(REPLACE "-DCMAKE_CXX_STANDARD=17" " " DPCPP_CMAKE_FLAGS "${DEFAULT_CMAKE_FLAGS}")
if(WIN32)
set(LLVM_GENERATOR "Ninja")
else()
set(LLVM_GENERATOR "Unix Makefiles")
endif()
set(DPCPP_CONFIGURE_ARGS
# When external deps dpcpp needs are not found it will automatically
# download the during the configure stage using FetchContent. Given
# we need to keep an archive of all source used during build for compliance
# reasons it CANNOT download anything we do not know about. By setting
# this property to ON, all downloads are disabled, and we will have to
# provide the missing deps some other way, a build error beats a compliance
# violation
--cmake-opt FETCHCONTENT_FULLY_DISCONNECTED=ON
)
set(DPCPP_SOURCE_ROOT ${BUILD_DIR}/dpcpp/src/external_dpcpp/)
set(DPCPP_EXTRA_ARGS
# When external deps dpcpp needs are not found it will automatically
# download the during the configure stage using FetchContent. Given
# we need to keep an archive of all source used during build for compliance
# reasons it CANNOT download anything we do not know about. By setting
# this property to ON, all downloads are disabled, and we will have to
# provide the missing deps some other way, a build or configure error
# beats a compliance violation
-DFETCHCONTENT_FULLY_DISCONNECTED=ON
-DLLVMGenXIntrinsics_SOURCE_DIR=${BUILD_DIR}/vcintrinsics/src/external_vcintrinsics/
-DOpenCL_HEADERS=file://${PACKAGE_DIR}/${OPENCLHEADERS_FILE}
-DOpenCL_LIBRARY_SRC=file://${PACKAGE_DIR}/${ICDLOADER_FILE}
-DBOOST_MP11_SOURCE_DIR=${BUILD_DIR}/mp11/src/external_mp11/
-DLEVEL_ZERO_LIBRARY=${LIBDIR}/level-zero/lib/${LIBPREFIX}ze_loader${SHAREDLIBEXT}
-DLEVEL_ZERO_INCLUDE_DIR=${LIBDIR}/level-zero/include
-DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=${BUILD_DIR}/spirvheaders/src/external_spirvheaders/
# Below here is copied from an invocation of buildbot/config.py
-DLLVM_ENABLE_ASSERTIONS=ON
-DLLVM_TARGETS_TO_BUILD=X86
-DLLVM_EXTERNAL_PROJECTS=sycl^^llvm-spirv^^opencl^^libdevice^^xpti^^xptifw
-DLLVM_EXTERNAL_SYCL_SOURCE_DIR=${DPCPP_SOURCE_ROOT}/sycl
-DLLVM_EXTERNAL_LLVM_SPIRV_SOURCE_DIR=${DPCPP_SOURCE_ROOT}/llvm-spirv
-DLLVM_EXTERNAL_XPTI_SOURCE_DIR=${DPCPP_SOURCE_ROOT}/xpti
-DXPTI_SOURCE_DIR=${DPCPP_SOURCE_ROOT}/xpti
-DLLVM_EXTERNAL_XPTIFW_SOURCE_DIR=${DPCPP_SOURCE_ROOT}/xptifw
-DLLVM_EXTERNAL_LIBDEVICE_SOURCE_DIR=${DPCPP_SOURCE_ROOT}/libdevice
-DLLVM_ENABLE_PROJECTS=clang^^sycl^^llvm-spirv^^opencl^^libdevice^^xpti^^xptifw
-DLIBCLC_TARGETS_TO_BUILD=
-DLIBCLC_GENERATE_REMANGLED_VARIANTS=OFF
-DSYCL_BUILD_PI_HIP_PLATFORM=AMD
-DLLVM_BUILD_TOOLS=ON
-DSYCL_ENABLE_WERROR=OFF
-DSYCL_INCLUDE_TESTS=ON
-DLLVM_ENABLE_DOXYGEN=OFF
-DLLVM_ENABLE_SPHINX=OFF
-DBUILD_SHARED_LIBS=OFF
-DSYCL_ENABLE_XPTI_TRACING=ON
-DLLVM_ENABLE_LLD=OFF
-DXPTI_ENABLE_WERROR=OFF
-DSYCL_CLANG_EXTRA_FLAGS=
-DSYCL_ENABLE_PLUGINS=level_zero
-DCMAKE_INSTALL_RPATH=\$ORIGIN
-DPython3_ROOT_DIR=${LIBDIR}/python/
-DPython3_EXECUTABLE=${PYTHON_BINARY}
-DPYTHON_EXECUTABLE=${PYTHON_BINARY}
-DLLDB_ENABLE_CURSES=OFF
-DLLVM_ENABLE_TERMINFO=OFF
)
if(WIN32)
list(APPEND DPCPP_EXTRA_ARGS -DPython3_FIND_REGISTRY=NEVER)
endif()
ExternalProject_Add(external_dpcpp
URL file://${PACKAGE_DIR}/${DPCPP_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${DPCPP_HASH_TYPE}=${DPCPP_HASH}
PREFIX ${BUILD_DIR}/dpcpp
CMAKE_GENERATOR ${LLVM_GENERATOR}
SOURCE_SUBDIR llvm
LIST_SEPARATOR ^^
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/dpcpp ${DPCPP_CMAKE_FLAGS} ${DPCPP_EXTRA_ARGS}
# CONFIGURE_COMMAND
# ${PYTHON_BINARY}
# ${BUILD_DIR}/dpcpp/src/external_dpcpp/buildbot/configure.py ${DPCPP_CONFIGURE_ARGS}
# BUILD_COMMAND
# echo "." # ${PYTHON_BINARY} ${BUILD_DIR}/dpcpp/src/external_dpcpp/buildbot/compile.py
INSTALL_COMMAND ${CMAKE_COMMAND} --build . -- deploy-sycl-toolchain
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/dpcpp/src/external_dpcpp < ${PATCH_DIR}/dpcpp.diff
INSTALL_DIR ${LIBDIR}/dpcpp
)
add_dependencies(
external_dpcpp
external_python
external_python_site_packages
external_vcintrinsics
external_openclheaders
external_icdloader
external_mp11
external_level-zero
external_spirvheaders
)
if(BUILD_MODE STREQUAL Release AND WIN32)
ExternalProject_Add_Step(external_dpcpp after_install
COMMAND ${CMAKE_COMMAND} -E rm -f ${LIBDIR}/dpcpp/bin/clang-cl.exe
COMMAND ${CMAKE_COMMAND} -E rm -f ${LIBDIR}/dpcpp/bin/clang-cpp.exe
COMMAND ${CMAKE_COMMAND} -E rm -f ${LIBDIR}/dpcpp/bin/clang.exe
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/dpcpp ${HARVEST_TARGET}/dpcpp
)
endif()

View File

@@ -0,0 +1,61 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# These are build time requirements for dpcpp
# We only have to unpack these dpcpp will build
# them.
ExternalProject_Add(external_vcintrinsics
URL file://${PACKAGE_DIR}/${VCINTRINSICS_FILE}
URL_HASH ${VCINTRINSICS_HASH_TYPE}=${VCINTRINSICS_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/vcintrinsics
CONFIGURE_COMMAND echo .
BUILD_COMMAND echo .
INSTALL_COMMAND echo .
)
# opencl headers do not have to be unpacked, dpcpp will do it
# but it wouldn't hurt to do it anyway as an opertunity to validate
# the hash is correct.
ExternalProject_Add(external_openclheaders
URL file://${PACKAGE_DIR}/${OPENCLHEADERS_FILE}
URL_HASH ${OPENCLHEADERS_HASH_TYPE}=${OPENCLHEADERS_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/openclheaders
CONFIGURE_COMMAND echo .
BUILD_COMMAND echo .
INSTALL_COMMAND echo .
)
# icdloader does not have to be unpacked, dpcpp will do it
# but it wouldn't hurt to do it anyway as an opertunity to validate
# the hash is correct.
ExternalProject_Add(external_icdloader
URL file://${PACKAGE_DIR}/${ICDLOADER_FILE}
URL_HASH ${ICDLOADER_HASH_TYPE}=${ICDLOADER_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/icdloader
CONFIGURE_COMMAND echo .
BUILD_COMMAND echo .
INSTALL_COMMAND echo .
)
ExternalProject_Add(external_mp11
URL file://${PACKAGE_DIR}/${MP11_FILE}
URL_HASH ${MP11_HASH_TYPE}=${MP11_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/mp11
CONFIGURE_COMMAND echo .
BUILD_COMMAND echo .
INSTALL_COMMAND echo .
)
ExternalProject_Add(external_spirvheaders
URL file://${PACKAGE_DIR}/${SPIRV_HEADERS_FILE}
URL_HASH ${SPIRV_HEADERS_HASH_TYPE}=${SPIRV_HEADERS_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/spirvheaders
CONFIGURE_COMMAND echo .
BUILD_COMMAND echo .
INSTALL_COMMAND echo .
)

View File

@@ -6,47 +6,38 @@
set(EMBREE_EXTRA_ARGS
-DEMBREE_ISPC_SUPPORT=OFF
-DEMBREE_TUTORIALS=OFF
-DEMBREE_STATIC_LIB=ON
-DEMBREE_STATIC_LIB=OFF
-DEMBREE_RAY_MASK=ON
-DEMBREE_FILTER_FUNCTION=ON
-DEMBREE_BACKFACE_CULLING=OFF
-DEMBREE_MAX_ISA=AVX2
-DEMBREE_BACKFACE_CULLING_CURVES=ON
-DEMBREE_BACKFACE_CULLING_SPHERES=ON
-DEMBREE_TASKING_SYSTEM=TBB
-DEMBREE_TBB_ROOT=${LIBDIR}/tbb
-DTBB_ROOT=${LIBDIR}/tbb
-DTBB_STATIC_LIB=${TBB_STATIC_LIBRARY}
)
if(BLENDER_PLATFORM_ARM)
if(WIN32)
set(EMBREE_EXTRA_ARGS
${EMBREE_EXTRA_ARGS}
-DEMBREE_MAX_ISA=NEON)
else()
-DCMAKE_DEBUG_POSTFIX=_d
)
endif()
if(NOT BLENDER_PLATFORM_ARM)
set(EMBREE_EXTRA_ARGS
${EMBREE_EXTRA_ARGS}
-DEMBREE_MAX_ISA=AVX2)
-DEMBREE_MAX_ISA=AVX2
)
endif()
if(TBB_STATIC_LIBRARY)
set(EMBREE_EXTRA_ARGS
${EMBREE_EXTRA_ARGS}
-DEMBREE_TBB_LIBRARY_NAME=tbb_static
-DEMBREE_TBBMALLOC_LIBRARY_NAME=tbbmalloc_static
-DEMBREE_TBB_COMPONENT=tbb_static
)
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()
ExternalProject_Add(external_embree
URL file://${PACKAGE_DIR}/${EMBREE_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
@@ -63,25 +54,19 @@ add_dependencies(
)
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_embree after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/embree ${HARVEST_TARGET}/embree
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/embree/include ${HARVEST_TARGET}/embree/include
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/embree/lib ${HARVEST_TARGET}/embree/lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/embree/share ${HARVEST_TARGET}/embree/share
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/bin/embree4.dll ${HARVEST_TARGET}/embree/bin/embree4.dll
DEPENDEES install
)
else()
ExternalProject_Add_Step(external_embree after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree3.lib ${HARVEST_TARGET}/embree/lib/embree3_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree_avx.lib ${HARVEST_TARGET}/embree/lib/embree_avx_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree_avx2.lib ${HARVEST_TARGET}/embree/lib/embree_avx2_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree_sse42.lib ${HARVEST_TARGET}/embree/lib/embree_sse42_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/lexers.lib ${HARVEST_TARGET}/embree/lib/lexers_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/math.lib ${HARVEST_TARGET}/embree/lib/math_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/simd.lib ${HARVEST_TARGET}/embree/lib/simd_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/sys.lib ${HARVEST_TARGET}/embree/lib/sys_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/tasking.lib ${HARVEST_TARGET}/embree/lib/tasking_d.lib
ExternalProject_Add_Step(external_embree after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/bin/embree4_d.dll ${HARVEST_TARGET}/embree/bin/embree4_d.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree4_d.lib ${HARVEST_TARGET}/embree/lib/embree4_d.lib
DEPENDEES install
)
endif()
endif()

View File

@@ -0,0 +1,31 @@
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
set(EPOXY_LIB_TYPE shared)
else()
set(EPOXY_LIB_TYPE static)
endif()
ExternalProject_Add(external_epoxy
URL file://${PACKAGE_DIR}/${EPOXY_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${EPOXY_HASH_TYPE}=${EPOXY_HASH}
PREFIX ${BUILD_DIR}/epoxy
PATCH_COMMAND ${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/epoxy/src/external_epoxy/ < ${PATCH_DIR}/epoxy.diff
CONFIGURE_COMMAND ${CONFIGURE_ENV} && ${MESON} setup --prefix ${LIBDIR}/epoxy --default-library ${EPOXY_LIB_TYPE} --libdir lib ${BUILD_DIR}/epoxy/src/external_epoxy-build ${BUILD_DIR}/epoxy/src/external_epoxy -Dtests=false ${MESON_BUILD_TYPE}
BUILD_COMMAND ninja
INSTALL_COMMAND ninja install
)
if(BUILD_MODE STREQUAL Release AND WIN32)
ExternalProject_Add_Step(external_epoxy after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/epoxy/include ${HARVEST_TARGET}/epoxy/include
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/epoxy/bin/epoxy-0.dll ${HARVEST_TARGET}/epoxy/bin/epoxy-0.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/epoxy/lib/epoxy.lib ${HARVEST_TARGET}/epoxy/lib/epoxy.lib
DEPENDEES install
)
endif()
add_dependencies(
external_epoxy
# Needed for `MESON`.
external_python_site_packages
)

View File

@@ -1,9 +1,55 @@
# 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")
set(FFMPEG_EXTRA_FLAGS --pkg-config-flags=--static --extra-cflags=${FFMPEG_CFLAGS} --extra-ldflags=${FFMPEG_LDFLAGS})
set(FFMPEG_ENV PKG_CONFIG_PATH=${mingw_LIBDIR}/openjpeg/lib/pkgconfig:${mingw_LIBDIR}/x264/lib/pkgconfig:${mingw_LIBDIR}/vorbis/lib/pkgconfig:${mingw_LIBDIR}/ogg/lib/pkgconfig:${mingw_LIBDIR}:${mingw_LIBDIR}/vpx/lib/pkgconfig:${mingw_LIBDIR}/theora/lib/pkgconfig:${mingw_LIBDIR}/openjpeg/lib/pkgconfig:${mingw_LIBDIR}/opus/lib/pkgconfig:)
if(WIN32)
set(temp_LIBDIR ${mingw_LIBDIR})
else()
set(temp_LIBDIR ${LIBDIR})
endif()
set(FFMPEG_CFLAGS "\
-I${temp_LIBDIR}/lame/include \
-I${temp_LIBDIR}/openjpeg/include/ \
-I${temp_LIBDIR}/ogg/include \
-I${temp_LIBDIR}/vorbis/include \
-I${temp_LIBDIR}/theora/include \
-I${temp_LIBDIR}/opus/include \
-I${temp_LIBDIR}/vpx/include \
-I${temp_LIBDIR}/x264/include \
-I${temp_LIBDIR}/xvidcore/include \
-I${temp_LIBDIR}/zlib/include \
-I${temp_LIBDIR}/aom/include"
)
set(FFMPEG_LDFLAGS "\
-L${temp_LIBDIR}/lame/lib \
-L${temp_LIBDIR}/openjpeg/lib \
-L${temp_LIBDIR}/ogg/lib \
-L${temp_LIBDIR}/vorbis/lib \
-L${temp_LIBDIR}/theora/lib \
-L${temp_LIBDIR}/opus/lib \
-L${temp_LIBDIR}/vpx/lib \
-L${temp_LIBDIR}/x264/lib \
-L${temp_LIBDIR}/xvidcore/lib \
-L${temp_LIBDIR}/zlib/lib \
-L${temp_LIBDIR}/aom/lib"
)
set(FFMPEG_EXTRA_FLAGS
--pkg-config-flags=--static
--extra-cflags=${FFMPEG_CFLAGS}
--extra-ldflags=${FFMPEG_LDFLAGS}
)
set(FFMPEG_ENV "PKG_CONFIG_PATH=\
${temp_LIBDIR}/openjpeg/lib/pkgconfig:\
${temp_LIBDIR}/x264/lib/pkgconfig:\
${temp_LIBDIR}/vorbis/lib/pkgconfig:\
${temp_LIBDIR}/ogg/lib/pkgconfig:\
${temp_LIBDIR}/vpx/lib/pkgconfig:\
${temp_LIBDIR}/theora/lib/pkgconfig:\
${temp_LIBDIR}/openjpeg/lib/pkgconfig:\
${temp_LIBDIR}/opus/lib/pkgconfig:\
${temp_LIBDIR}/aom/lib/pkgconfig"
)
unset(temp_LIBDIR)
if(WIN32)
set(FFMPEG_ENV set ${FFMPEG_ENV} &&)
@@ -16,12 +62,6 @@ if(WIN32)
--enable-libopenjpeg
--disable-mediafoundation
)
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "4")
set(FFMPEG_EXTRA_FLAGS
${FFMPEG_EXTRA_FLAGS}
--x86asmexe=yasm
)
endif()
else()
set(FFMPEG_EXTRA_FLAGS
${FFMPEG_EXTRA_FLAGS}
@@ -79,6 +119,7 @@ ExternalProject_Add(external_ffmpeg
--disable-librtmp
--enable-libx264
--enable-libxvid
--enable-libaom
--disable-libopencore-amrnb
--disable-libopencore-amrwb
--disable-libdc1394
@@ -125,6 +166,7 @@ add_dependencies(
external_vorbis
external_ogg
external_lame
external_aom
)
if(WIN32)
add_dependencies(

View File

@@ -1,7 +1,8 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(FMT_EXTRA_ARGS
-DFMT_TEST=Off
-DFMT_TEST=OFF
-DFMT_DOC=OFF
)
ExternalProject_Add(external_fmt

View File

@@ -7,8 +7,11 @@ set(FREETYPE_EXTRA_ARGS
-DFT_DISABLE_HARFBUZZ=ON
-DFT_DISABLE_PNG=ON
-DFT_REQUIRE_BROTLI=ON
-DFT_REQUIRE_ZLIB=ON
-DPC_BROTLIDEC_INCLUDEDIR=${LIBDIR}/brotli/include
-DPC_BROTLIDEC_LIBDIR=${LIBDIR}/brotli/lib
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include
)
ExternalProject_Add(external_freetype
@@ -23,11 +26,16 @@ ExternalProject_Add(external_freetype
add_dependencies(
external_freetype
external_brotli
external_zlib
)
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
# harfbuzz *NEEDS* to find freetype.lib and will not be conviced to take alternative names so just give it
# what it wants.
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/freetype/lib/freetype2st.lib ${LIBDIR}/freetype/lib/freetype.lib
DEPENDEES install
)
endif()

View File

@@ -0,0 +1,31 @@
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
set(CONFIGURE_ENV ${CONFIGURE_ENV_MSVC})
endif()
ExternalProject_Add(external_fribidi
URL file://${PACKAGE_DIR}/${FRIBIDI_FILE}
URL_HASH ${FRIBIDI_HASH_TYPE}=${FRIBIDI_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/fribidi
CONFIGURE_COMMAND ${MESON} setup --prefix ${LIBDIR}/fribidi ${MESON_BUILD_TYPE} -Ddocs=false --default-library static --libdir lib ${BUILD_DIR}/fribidi/src/external_fribidi-build ${BUILD_DIR}/fribidi/src/external_fribidi
BUILD_COMMAND ninja
INSTALL_COMMAND ninja install
INSTALL_DIR ${LIBDIR}/fribidi
)
add_dependencies(
external_fribidi
external_python
# Needed for `MESON`.
external_python_site_packages
)
if(BUILD_MODE STREQUAL Release AND WIN32)
ExternalProject_Add_Step(external_fribidi after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/fribidi/include ${HARVEST_TARGET}/fribidi/include
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/fribidi/lib/libfribidi.a ${HARVEST_TARGET}/fribidi/lib/libfribidi.lib
DEPENDEES install
)
endif()

View File

@@ -1,16 +0,0 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(GLEW_EXTRA_ARGS
-DBUILD_UTILS=Off
-DBUILD_SHARED_LIBS=Off
)
ExternalProject_Add(external_glew
URL file://${PACKAGE_DIR}/${GLEW_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${GLEW_HASH_TYPE}=${GLEW_HASH}
PATCH_COMMAND COMMAND ${CMAKE_COMMAND} -E copy ${PATCH_DIR}/cmakelists_glew.txt ${BUILD_DIR}/glew/src/external_glew/CMakeLists.txt
PREFIX ${BUILD_DIR}/glew
CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=${LIBDIR}/glew ${DEFAULT_CMAKE_FLAGS} ${GLEW_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/glew
)

View File

@@ -0,0 +1,13 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(GMMLIB_EXTRA_ARGS
)
ExternalProject_Add(external_gmmlib
URL file://${PACKAGE_DIR}/${GMMLIB_FILE}
URL_HASH ${GMMLIB_HASH_TYPE}=${GMMLIB_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/gmmlib
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/gmmlib ${DEFAULT_CMAKE_FLAGS} ${GMMLIB_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/gmmlib
)

View File

@@ -22,11 +22,20 @@ elseif(UNIX AND NOT APPLE)
)
endif()
# Boolean crashes with Arm assembly, see #103423.
if(BLENDER_PLATFORM_ARM)
set(GMP_OPTIONS
${GMP_OPTIONS}
--disable-assembly
)
endif()
ExternalProject_Add(external_gmp
URL file://${PACKAGE_DIR}/${GMP_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${GMP_HASH_TYPE}=${GMP_HASH}
PREFIX ${BUILD_DIR}/gmp
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/gmp/src/external_gmp < ${PATCH_DIR}/gmp.diff
CONFIGURE_COMMAND ${CONFIGURE_ENV_NO_PERL} && cd ${BUILD_DIR}/gmp/src/external_gmp/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/gmp ${GMP_OPTIONS} ${GMP_EXTRA_ARGS}
BUILD_COMMAND ${CONFIGURE_ENV_NO_PERL} && cd ${BUILD_DIR}/gmp/src/external_gmp/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV_NO_PERL} && cd ${BUILD_DIR}/gmp/src/external_gmp/ && make install
@@ -39,19 +48,21 @@ endif()
if(BUILD_MODE STREQUAL Release AND WIN32)
ExternalProject_Add_Step(external_gmp after_install
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-3.dll.def ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.def
COMMAND lib /def:${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.def /machine:x64 /out:${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/gmp/bin/libgmp-10.dll ${HARVEST_TARGET}/gmp/lib/libgmp-10.dll
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.lib ${HARVEST_TARGET}/gmp/lib/libgmp-10.lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/gmp/include ${HARVEST_TARGET}/gmp/include
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-3.dll.def ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.def
COMMAND lib /def:${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.def /machine:x64 /out:${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/gmp/bin/libgmp-10.dll ${HARVEST_TARGET}/gmp/lib/libgmp-10.dll
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.lib ${HARVEST_TARGET}/gmp/lib/libgmp-10.lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/gmp/include ${HARVEST_TARGET}/gmp/include
DEPENDEES install
)
endif()
if(BUILD_MODE STREQUAL Debug AND WIN32)
ExternalProject_Add_Step(external_gmp after_install
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-3.dll.def ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.def
COMMAND lib /def:${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.def /machine:x64 /out:${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.lib
ExternalProject_Add_Step(external_gmp after_install
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-3.dll.def ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.def
COMMAND lib /def:${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.def /machine:x64 /out:${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.lib
DEPENDEES install
)
endif()

View File

@@ -0,0 +1,69 @@
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
set(HARFBUZZ_CONFIGURE_ENV ${CONFIGURE_ENV_MSVC})
set(HARFBUZZ_PKG_ENV FREETYPE_DIR=${LIBDIR}/freetype)
else()
set(HARFBUZZ_CONFIGURE_ENV ${CONFIGURE_ENV})
set(HARFBUZZ_PKG_ENV "PKG_CONFIG_PATH=\
${LIBDIR}/freetype/lib/pkgconfig:\
${LIBDIR}/brotli/lib/pkgconfig:\
${LIBDIR}/lib/python3.10/pkgconfig:\
$PKG_CONFIG_PATH"
)
endif()
set(HARFBUZZ_EXTRA_OPTIONS
-Dtests=disabled
-Dfreetype=enabled
-Dglib=disabled
-Dgobject=disabled
# Only used for command line utilities,
# disable as this would add an addition & unnecessary build-dependency.
-Dcairo=disabled
${MESON_BUILD_TYPE}
)
ExternalProject_Add(external_harfbuzz
URL file://${PACKAGE_DIR}/${HARFBUZZ_FILE}
URL_HASH ${HARFBUZZ_HASH_TYPE}=${HARFBUZZ_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/harfbuzz
CONFIGURE_COMMAND ${HARFBUZZ_CONFIGURE_ENV} &&
${CMAKE_COMMAND} -E env ${HARFBUZZ_PKG_ENV}
${MESON} setup
--prefix ${LIBDIR}/harfbuzz ${HARFBUZZ_EXTRA_OPTIONS}
--default-library static
--libdir lib
${BUILD_DIR}/harfbuzz/src/external_harfbuzz-build
${BUILD_DIR}/harfbuzz/src/external_harfbuzz
BUILD_COMMAND ninja
INSTALL_COMMAND ninja install
INSTALL_DIR ${LIBDIR}/harfbuzz
)
add_dependencies(
external_harfbuzz
external_python
external_freetype
# Needed for `MESON`.
external_python_site_packages
)
if(BUILD_MODE STREQUAL Release AND WIN32)
ExternalProject_Add_Step(external_harfbuzz after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/harfbuzz/include ${HARVEST_TARGET}/harfbuzz/include
# We do not use the subset API currently, so copying only the main library will suffice for now
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/harfbuzz/lib/libharfbuzz.a ${HARVEST_TARGET}/harfbuzz/lib/libharfbuzz.lib
DEPENDEES install
)
endif()
if(BUILD_MODE STREQUAL Debug AND WIN32)
ExternalProject_Add_Step(external_harfbuzz after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/harfbuzz/lib/libharfbuzz.a ${HARVEST_TARGET}/harfbuzz/lib/libharfbuzz_d.lib
DEPENDEES install
)
endif()

View File

@@ -11,187 +11,302 @@ message("HARVEST_TARGET = ${HARVEST_TARGET}")
if(WIN32)
if(BUILD_MODE STREQUAL Release)
add_custom_target(Harvest_Release_Results
COMMAND # jpeg rename libfile + copy include
${CMAKE_COMMAND} -E copy ${LIBDIR}/jpeg/lib/jpeg-static.lib ${HARVEST_TARGET}/jpeg/lib/libjpeg.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/jpeg/include/ ${HARVEST_TARGET}/jpeg/include/ &&
# png
${CMAKE_COMMAND} -E copy ${LIBDIR}/png/lib/libpng16_static.lib ${HARVEST_TARGET}/png/lib/libpng.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/png/include/ ${HARVEST_TARGET}/png/include/ &&
# freeglut-> opengl
${CMAKE_COMMAND} -E copy ${LIBDIR}/freeglut/lib/freeglut_static.lib ${HARVEST_TARGET}/opengl/lib/freeglut_static.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/freeglut/include/ ${HARVEST_TARGET}/opengl/include/ &&
# glew-> opengl
${CMAKE_COMMAND} -E copy ${LIBDIR}/glew/lib/libglew32.lib ${HARVEST_TARGET}/opengl/lib/glew.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/glew/include/ ${HARVEST_TARGET}/opengl/include/ &&
# tiff
${CMAKE_COMMAND} -E copy ${LIBDIR}/tiff/lib/tiff.lib ${HARVEST_TARGET}/tiff/lib/libtiff.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/tiff/include/ ${HARVEST_TARGET}/tiff/include/
DEPENDS
)
endif()
if(BUILD_MODE STREQUAL Release)
add_custom_target(Harvest_Release_Results
COMMAND # JPEG rename lib-file + copy include.
${CMAKE_COMMAND} -E copy ${LIBDIR}/jpeg/lib/jpeg-static.lib ${HARVEST_TARGET}/jpeg/lib/libjpeg.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/jpeg/include/ ${HARVEST_TARGET}/jpeg/include/ &&
# PNG.
${CMAKE_COMMAND} -E copy ${LIBDIR}/png/lib/libpng16_static.lib ${HARVEST_TARGET}/png/lib/libpng.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/png/include/ ${HARVEST_TARGET}/png/include/ &&
# FREEGLUT -> OPENGL.
${CMAKE_COMMAND} -E copy ${LIBDIR}/freeglut/lib/freeglut_static.lib ${HARVEST_TARGET}/opengl/lib/freeglut_static.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/freeglut/include/ ${HARVEST_TARGET}/opengl/include/ &&
else(WIN32)
function(harvest from to)
set(pattern "")
foreach(f ${ARGN})
set(pattern ${f})
endforeach()
if(pattern STREQUAL "")
get_filename_component(dirpath ${to} DIRECTORY)
get_filename_component(filename ${to} NAME)
install(
FILES ${LIBDIR}/${from}
DESTINATION ${HARVEST_TARGET}/${dirpath}
RENAME ${filename})
else()
install(
DIRECTORY ${LIBDIR}/${from}/
DESTINATION ${HARVEST_TARGET}/${to}
USE_SOURCE_PERMISSIONS
FILES_MATCHING PATTERN ${pattern}
PATTERN "pkgconfig" EXCLUDE
PATTERN "cmake" EXCLUDE
PATTERN "__pycache__" EXCLUDE
PATTERN "tests" EXCLUDE)
DEPENDS
)
endif()
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(imath/include imath/include "*.h")
harvest(imath/lib imath/lib "*.a")
harvest(ffmpeg/include ffmpeg/include "*.h")
harvest(ffmpeg/lib ffmpeg/lib "*.a")
harvest(fftw3/include fftw3/include "*.h")
harvest(fftw3/lib fftw3/lib "*.a")
harvest(flac/lib sndfile/lib "libFLAC.a")
harvest(freetype/include freetype/include "*.h")
harvest(freetype/lib/libfreetype2ST.a freetype/lib/libfreetype.a)
harvest(glew/include glew/include "*.h")
harvest(glew/lib glew/lib "*.a")
harvest(gmp/include gmp/include "*.h")
harvest(gmp/lib gmp/lib "*.a")
harvest(jemalloc/include jemalloc/include "*.h")
harvest(jemalloc/lib jemalloc/lib "*.a")
harvest(jpeg/include jpeg/include "*.h")
harvest(jpeg/lib jpeg/lib "libjpeg.a")
harvest(lame/lib ffmpeg/lib "*.a")
if(NOT APPLE)
harvest(level-zero/include/level_zero level-zero/include/level_zero "*.h")
harvest(level-zero/lib level-zero/lib "*.so*")
endif()
harvest(llvm/bin llvm/bin "clang-format")
if(BUILD_CLANG_TOOLS)
harvest(llvm/bin llvm/bin "clang-tidy")
harvest(llvm/share/clang llvm/share "run-clang-tidy.py")
endif()
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")
endif()
if(BLENDER_PLATFORM_ARM)
harvest(sse2neon sse2neon "*.h")
endif()
harvest(ogg/lib ffmpeg/lib "*.a")
harvest(openal/include openal/include "*.h")
if(UNIX AND NOT APPLE)
harvest(openal/lib openal/lib "*.a")
harvest(blosc/include blosc/include "*.h")
harvest(blosc/lib blosc/lib "*.a")
harvest(zlib/include zlib/include "*.h")
harvest(zlib/lib zlib/lib "*.a")
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")
endif()
harvest(opencollada/include/opencollada opencollada/include "*.h")
harvest(opencollada/lib/opencollada opencollada/lib "*.a")
harvest(opencolorio/include opencolorio/include "*.h")
harvest(opencolorio/lib opencolorio/lib "*.a")
harvest(opencolorio/lib/static opencolorio/lib "*.a")
harvest(openexr/include openexr/include "*.h")
harvest(openexr/lib openexr/lib "*.a")
harvest(openimageio/bin openimageio/bin "idiff")
harvest(openimageio/bin openimageio/bin "maketx")
harvest(openimageio/bin openimageio/bin "oiiotool")
harvest(openimageio/include openimageio/include "*")
harvest(openimageio/lib openimageio/lib "*.a")
harvest(openimagedenoise/include openimagedenoise/include "*")
harvest(openimagedenoise/lib openimagedenoise/lib "*.a")
harvest(embree/include embree/include "*.h")
harvest(embree/lib embree/lib "*.a")
harvest(openjpeg/include/openjpeg-${OPENJPEG_SHORT_VERSION} openjpeg/include "*.h")
harvest(openjpeg/lib openjpeg/lib "*.a")
harvest(opensubdiv/include opensubdiv/include "*.h")
harvest(opensubdiv/lib opensubdiv/lib "*.a")
harvest(openvdb/include/openvdb openvdb/include/openvdb "*.h")
harvest(openvdb/include/nanovdb openvdb/include/nanovdb "*.h")
harvest(openvdb/lib openvdb/lib "*.a")
harvest(xr_openxr_sdk/include/openxr xr_openxr_sdk/include/openxr "*.h")
harvest(xr_openxr_sdk/lib xr_openxr_sdk/lib "*.a")
harvest(osl/bin osl/bin "oslc")
harvest(osl/include osl/include "*.h")
harvest(osl/lib osl/lib "*.a")
harvest(osl/share/OSL/shaders osl/share/OSL/shaders "*.h")
harvest(png/include png/include "*.h")
harvest(png/lib png/lib "*.a")
harvest(pugixml/include pugixml/include "*.hpp")
harvest(pugixml/lib pugixml/lib "*.a")
harvest(python/bin python/bin "python${PYTHON_SHORT_VERSION}")
harvest(python/include python/include "*h")
harvest(python/lib python/lib "*")
harvest(sdl/include/SDL2 sdl/include "*.h")
harvest(sdl/lib sdl/lib "libSDL2.a")
harvest(sndfile/include sndfile/include "*.h")
harvest(sndfile/lib sndfile/lib "*.a")
harvest(spnav/include spnav/include "*.h")
harvest(spnav/lib spnav/lib "*.a")
harvest(tbb/include tbb/include "*.h")
harvest(tbb/lib/libtbb_static.a tbb/lib/libtbb.a)
harvest(theora/lib ffmpeg/lib "*.a")
harvest(tiff/include tiff/include "*.h")
harvest(tiff/lib tiff/lib "*.a")
harvest(vorbis/lib ffmpeg/lib "*.a")
harvest(opus/lib ffmpeg/lib "*.a")
harvest(vpx/lib ffmpeg/lib "*.a")
harvest(x264/lib ffmpeg/lib "*.a")
harvest(xvidcore/lib ffmpeg/lib "*.a")
harvest(webp/lib webp/lib "*.a")
harvest(webp/include webp/include "*.h")
harvest(usd/include usd/include "*.h")
harvest(usd/lib/usd usd/lib/usd "*")
harvest(usd/plugin usd/plugin "*")
harvest(potrace/include potrace/include "*.h")
harvest(potrace/lib potrace/lib "*.a")
harvest(haru/include haru/include "*.h")
harvest(haru/lib haru/lib "*.a")
harvest(zstd/include zstd/include "*.h")
harvest(zstd/lib zstd/lib "*.a")
if(UNIX AND NOT APPLE)
harvest(libglu/lib mesa/lib "*.so*")
harvest(mesa/lib64 mesa/lib "*.so*")
endif()
function(harvest from to)
set(pattern "")
foreach(f ${ARGN})
set(pattern ${f})
endforeach()
if(pattern STREQUAL "")
get_filename_component(dirpath ${to} DIRECTORY)
get_filename_component(filename ${to} NAME)
install(
FILES ${LIBDIR}/${from}
DESTINATION ${HARVEST_TARGET}/${dirpath}
RENAME ${filename}
)
else()
install(
DIRECTORY ${LIBDIR}/${from}/
DESTINATION ${HARVEST_TARGET}/${to}
USE_SOURCE_PERMISSIONS
FILES_MATCHING PATTERN ${pattern}
PATTERN "pkgconfig" EXCLUDE
PATTERN "cmake" EXCLUDE
PATTERN "__pycache__" EXCLUDE
PATTERN "tests" EXCLUDE
PATTERN "meson*" EXCLUDE
)
endif()
endfunction()
# Set rpath on shared libraries to $ORIGIN since all will be installed in the same
# lib folder, and remove any absolute paths.
#
# Ideally this would be done as part of the Blender build since it makes assumptions
# about where the files will be installed. However it would add patchelf as a new
# dependency for building.
#
# Also removes versioned symlinks, which give errors with macOS notarization.
if(APPLE)
set(set_rpath_cmd python3 ${CMAKE_CURRENT_SOURCE_DIR}/darwin/set_rpath.py @loader_path)
else()
set(set_rpath_cmd patchelf --set-rpath $ORIGIN)
endif()
function(harvest_rpath_lib from to pattern)
harvest(${from} ${to} ${pattern})
install(CODE "\
cmake_policy(SET CMP0009 NEW)\n
file(GLOB_RECURSE shared_libs ${HARVEST_TARGET}/${to}/${pattern}) \n
foreach(f \${shared_libs}) \n
if(IS_SYMLINK \${f})\n
if(APPLE)\n
file(REMOVE_RECURSE \${f})
endif()\n
else()\n
execute_process(COMMAND ${set_rpath_cmd} \${f}) \n
endif()\n
endforeach()")
endfunction()
# Set rpath on utility binaries assuming they are run from their install location.
function(harvest_rpath_bin from to pattern)
harvest(${from} ${to} ${pattern})
install(CODE "\
file(GLOB_RECURSE shared_libs ${HARVEST_TARGET}/${to}/${pattern}) \n
foreach(f \${shared_libs}) \n
execute_process(COMMAND ${set_rpath_cmd}/../lib; \${f}) \n
endforeach()")
endfunction()
# Set rpath on Python module to point to the shared libraries folder in the Blender
# installation.
function(harvest_rpath_python from to pattern)
harvest(${from} ${to} ${pattern})
install(CODE "\
file(GLOB_RECURSE shared_libs ${HARVEST_TARGET}/${to}/${pattern}\.so*) \n
foreach(f \${shared_libs}) \n
if(IS_SYMLINK \${f})\n
if(APPLE)\n
file(REMOVE_RECURSE \${f})
endif()\n
else()\n
get_filename_component(f_dir \${f} DIRECTORY) \n
file(RELATIVE_PATH relative_dir \${f_dir} ${HARVEST_TARGET}) \n
execute_process(COMMAND ${set_rpath_cmd}/\${relative_dir}../lib \${f}) \n
endif()\n
endforeach()")
endfunction()
harvest(alembic/include alembic/include "*.h")
harvest(alembic/lib/libAlembic.a alembic/lib/libAlembic.a)
harvest_rpath_bin(alembic/bin alembic/bin "*")
harvest(brotli/include brotli/include "*.h")
harvest(brotli/lib brotli/lib "*.a")
harvest(boost/include boost/include "*")
harvest_rpath_lib(boost/lib boost/lib "*${SHAREDLIBEXT}*")
harvest(imath/include imath/include "*.h")
harvest_rpath_lib(imath/lib imath/lib "*${SHAREDLIBEXT}*")
harvest(ffmpeg/include ffmpeg/include "*.h")
harvest(ffmpeg/lib ffmpeg/lib "*.a")
harvest(fftw3/include fftw3/include "*.h")
harvest(fftw3/lib fftw3/lib "*.a")
harvest(flac/lib sndfile/lib "libFLAC.a")
harvest(freetype/include freetype/include "*.h")
harvest(freetype/lib/libfreetype2ST.a freetype/lib/libfreetype.a)
harvest(fribidi/include fribidi/include "*.h")
harvest(fribidi/lib fribidi/lib "*.a")
harvest(epoxy/include epoxy/include "*.h")
harvest(epoxy/lib epoxy/lib "*.a")
harvest(gmp/include gmp/include "*.h")
harvest(gmp/lib gmp/lib "*.a")
harvest(harfbuzz/include harfbuzz/include "*.h")
harvest(harfbuzz/lib harfbuzz/lib "*.a")
harvest(jemalloc/include jemalloc/include "*.h")
harvest(jemalloc/lib jemalloc/lib "*.a")
harvest(jpeg/include jpeg/include "*.h")
harvest(jpeg/lib jpeg/lib "libjpeg.a")
harvest(lame/lib ffmpeg/lib "*.a")
if(NOT APPLE)
harvest(level-zero/include/level_zero level-zero/include/level_zero "*.h")
harvest(level-zero/lib level-zero/lib "*${SHAREDLIBEXT}*")
endif()
harvest(llvm/bin llvm/bin "clang-format")
if(BUILD_CLANG_TOOLS)
harvest(llvm/bin llvm/bin "clang-tidy")
harvest(llvm/share/clang llvm/share "run-clang-tidy.py")
endif()
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 "libomp.dylib")
harvest(openmp/include openmp/include "*.h")
endif()
if(BLENDER_PLATFORM_ARM)
harvest(sse2neon sse2neon "*.h")
endif()
harvest(ogg/lib ffmpeg/lib "*.a")
harvest(openal/include openal/include "*.h")
if(UNIX AND NOT APPLE)
harvest(openal/lib openal/lib "*.a")
harvest(zlib/include zlib/include "*.h")
harvest(zlib/lib zlib/lib "*.a")
harvest(xml2/include xml2/include "*.h")
harvest(xml2/lib xml2/lib "*.a")
harvest(
wayland-protocols/share/wayland-protocols
wayland-protocols/share/wayland-protocols/
"*.xml"
)
harvest(wayland/bin wayland/bin "wayland-scanner")
harvest(wayland/include wayland/include "*.h")
harvest(wayland_libdecor/include wayland_libdecor/include "*.h")
else()
harvest(blosc/lib openvdb/lib "*.a")
harvest(xml2/lib opencollada/lib "*.a")
endif()
harvest(opencollada/include/opencollada opencollada/include "*.h")
harvest(opencollada/lib/opencollada opencollada/lib "*.a")
harvest(opencolorio/include opencolorio/include "*.h")
harvest_rpath_lib(opencolorio/lib opencolorio/lib "*${SHAREDLIBEXT}*")
harvest_rpath_python(
opencolorio/lib/python${PYTHON_SHORT_VERSION}
python/lib/python${PYTHON_SHORT_VERSION}
"*"
)
harvest(openexr/include openexr/include "*.h")
harvest_rpath_lib(openexr/lib openexr/lib "*${SHAREDLIBEXT}*")
harvest_rpath_bin(openimageio/bin openimageio/bin "idiff")
harvest_rpath_bin(openimageio/bin openimageio/bin "maketx")
harvest_rpath_bin(openimageio/bin openimageio/bin "oiiotool")
harvest(openimageio/include openimageio/include "*")
harvest_rpath_lib(openimageio/lib openimageio/lib "*${SHAREDLIBEXT}*")
harvest_rpath_python(
openimageio/lib/python${PYTHON_SHORT_VERSION}
python/lib/python${PYTHON_SHORT_VERSION}
"*"
)
harvest(openimagedenoise/include openimagedenoise/include "*")
harvest(openimagedenoise/lib openimagedenoise/lib "*.a")
harvest(embree/include embree/include "*.h")
harvest(embree/lib embree/lib "*.a")
harvest(embree/lib embree/lib "*${SHAREDLIBEXT}*")
harvest(openpgl/include openpgl/include "*.h")
harvest(openpgl/lib openpgl/lib "*.a")
harvest(openpgl/lib/cmake/openpgl-${OPENPGL_SHORT_VERSION} openpgl/lib/cmake/openpgl "*.cmake")
harvest(openjpeg/include/openjpeg-${OPENJPEG_SHORT_VERSION} openjpeg/include "*.h")
harvest(openjpeg/lib openjpeg/lib "*.a")
harvest(opensubdiv/include opensubdiv/include "*.h")
harvest_rpath_lib(opensubdiv/lib opensubdiv/lib "*${SHAREDLIBEXT}*")
harvest(openvdb/include/openvdb openvdb/include/openvdb "*.h")
harvest(openvdb/include/nanovdb openvdb/include/nanovdb "*.h")
harvest_rpath_lib(openvdb/lib openvdb/lib "*${SHAREDLIBEXT}*")
harvest_rpath_python(
openvdb/lib/python${PYTHON_SHORT_VERSION}
python/lib/python${PYTHON_SHORT_VERSION}
"*pyopenvdb*"
)
harvest(xr_openxr_sdk/include/openxr xr_openxr_sdk/include/openxr "*.h")
harvest(xr_openxr_sdk/lib xr_openxr_sdk/lib "*.a")
harvest_rpath_bin(osl/bin osl/bin "oslc")
harvest(osl/include osl/include "*.h")
harvest(osl/lib osl/lib "*.a")
harvest(osl/share/OSL/shaders osl/share/OSL/shaders "*.h")
harvest(png/include png/include "*.h")
harvest(png/lib png/lib "*.a")
harvest(pugixml/include pugixml/include "*.hpp")
harvest(pugixml/lib pugixml/lib "*.a")
harvest(python/bin python/bin "python${PYTHON_SHORT_VERSION}")
harvest(python/include python/include "*h")
harvest(python/lib python/lib "*")
harvest(sdl/include/SDL2 sdl/include "*.h")
harvest(sdl/lib sdl/lib "libSDL2.a")
harvest(sndfile/include sndfile/include "*.h")
harvest(sndfile/lib sndfile/lib "*.a")
harvest(spnav/include spnav/include "*.h")
harvest(spnav/lib spnav/lib "*.a")
harvest(tbb/include tbb/include "*.h")
harvest_rpath_lib(tbb/lib tbb/lib "libtbb${SHAREDLIBEXT}")
harvest(theora/lib ffmpeg/lib "*.a")
harvest(tiff/include tiff/include "*.h")
harvest(tiff/lib tiff/lib "*.a")
harvest(vorbis/lib ffmpeg/lib "*.a")
harvest(opus/lib ffmpeg/lib "*.a")
harvest(vpx/lib ffmpeg/lib "*.a")
harvest(x264/lib ffmpeg/lib "*.a")
harvest(xvidcore/lib ffmpeg/lib "*.a")
harvest(aom/lib ffmpeg/lib "*.a")
harvest(webp/lib webp/lib "*.a")
harvest(webp/include webp/include "*.h")
harvest(usd/include usd/include "*.h")
harvest_rpath_lib(usd/lib usd/lib "libusd_ms${SHAREDLIBEXT}")
harvest(usd/lib/usd usd/lib/usd "*")
harvest_rpath_python(
usd/lib/python/pxr
python/lib/python${PYTHON_SHORT_VERSION}/site-packages/pxr
"*"
)
harvest(usd/plugin usd/plugin "*")
harvest(materialx/include materialx/include "*.h")
harvest_rpath_lib(materialx/lib materialx/lib "*${SHAREDLIBEXT}*")
harvest(materialx/libraries materialx/libraries "*")
harvest(materialx/lib/cmake/MaterialX materialx/lib/cmake/MaterialX "*.cmake")
harvest_rpath_python(
materialx/python/MaterialX
python/lib/python${PYTHON_SHORT_VERSION}/site-packages/MaterialX
"*"
)
# We do not need anything from the resources folder, but the MaterialX config
# file will complain if the folder does not exist, so just copy the readme.md
# files to ensure the folder will exist.
harvest(materialx/resources materialx/resources "README.md")
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")
harvest(shaderc shaderc "*")
harvest(vulkan_headers vulkan "*")
harvest_rpath_lib(vulkan_loader/lib vulkan/lib "*${SHAREDLIBEXT}*")
if(APPLE)
harvest(vulkan_loader/loader vulkan/loader "*")
endif()
if(UNIX AND NOT APPLE)
harvest(libglu/lib mesa/lib "*${SHAREDLIBEXT}*")
harvest(mesa/lib64 mesa/lib "*${SHAREDLIBEXT}*")
harvest(dpcpp dpcpp "*")
harvest(igc dpcpp/lib/igc "*")
harvest(ocloc dpcpp/lib/ocloc "*")
endif()
endif()

View File

@@ -0,0 +1,124 @@
# SPDX-License-Identifier: GPL-2.0-or-later
unpack_only(igc_vcintrinsics)
unpack_only(igc_spirv_headers)
unpack_only(igc_spirv_tools)
#
# igc_opencl_clang contains patches that need to be applied
# to external_igc_llvm and igc_spirv_translator, we unpack
# igc_opencl_clang first, then have the patch stages of
# external_igc_llvm and igc_spirv_translator apply them.
#
ExternalProject_Add(external_igc_opencl_clang
URL file://${PACKAGE_DIR}/${IGC_OPENCL_CLANG_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${IGC_OPENCL_CLANG_HASH_TYPE}=${IGC_OPENCL_CLANG_HASH}
PREFIX ${BUILD_DIR}/igc_opencl_clang
CONFIGURE_COMMAND echo .
BUILD_COMMAND echo .
INSTALL_COMMAND echo .
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/igc_opencl_clang/src/external_igc_opencl_clang/ < ${PATCH_DIR}/igc_opencl_clang.diff
)
set(IGC_OPENCL_CLANG_PATCH_DIR ${BUILD_DIR}/igc_opencl_clang/src/external_igc_opencl_clang/patches)
set(IGC_LLVM_SOURCE_DIR ${BUILD_DIR}/igc_llvm/src/external_igc_llvm)
set(IGC_SPIRV_TRANSLATOR_SOURCE_DIR ${BUILD_DIR}/igc_spirv_translator/src/external_igc_spirv_translator)
ExternalProject_Add(external_igc_llvm
URL file://${PACKAGE_DIR}/${IGC_LLVM_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${IGC_LLVM_HASH_TYPE}=${IGC_LLVM_HASH}
PREFIX ${BUILD_DIR}/igc_llvm
CONFIGURE_COMMAND echo .
BUILD_COMMAND echo .
INSTALL_COMMAND echo .
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${IGC_LLVM_SOURCE_DIR} < ${IGC_OPENCL_CLANG_PATCH_DIR}/clang/0001-OpenCL-3.0-support.patch &&
${PATCH_CMD} -p 1 -d ${IGC_LLVM_SOURCE_DIR} < ${IGC_OPENCL_CLANG_PATCH_DIR}/clang/0002-Remove-__IMAGE_SUPPORT__-macro-for-SPIR.patch &&
${PATCH_CMD} -p 1 -d ${IGC_LLVM_SOURCE_DIR} < ${IGC_OPENCL_CLANG_PATCH_DIR}/clang/0003-Avoid-calling-ParseCommandLineOptions-in-BackendUtil.patch &&
${PATCH_CMD} -p 1 -d ${IGC_LLVM_SOURCE_DIR} < ${IGC_OPENCL_CLANG_PATCH_DIR}/clang/0004-OpenCL-support-cl_ext_float_atomics.patch &&
${PATCH_CMD} -p 1 -d ${IGC_LLVM_SOURCE_DIR} < ${IGC_OPENCL_CLANG_PATCH_DIR}/clang/0005-OpenCL-Add-cl_khr_integer_dot_product.patch &&
${PATCH_CMD} -p 1 -d ${IGC_LLVM_SOURCE_DIR} < ${IGC_OPENCL_CLANG_PATCH_DIR}/llvm/0001-Memory-leak-fix-for-Managed-Static-Mutex.patch &&
${PATCH_CMD} -p 1 -d ${IGC_LLVM_SOURCE_DIR} < ${IGC_OPENCL_CLANG_PATCH_DIR}/llvm/0002-Remove-repo-name-in-LLVM-IR.patch &&
${PATCH_CMD} -p 1 -d ${IGC_LLVM_SOURCE_DIR} < ${IGC_OPENCL_CLANG_PATCH_DIR}/llvm/0003-Add-missing-include-limit-in-benchmark.patch
)
add_dependencies(
external_igc_llvm
external_igc_opencl_clang
)
ExternalProject_Add(external_igc_spirv_translator
URL file://${PACKAGE_DIR}/${IGC_SPIRV_TRANSLATOR_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${IGC_SPIRV_TRANSLATOR_HASH_TYPE}=${IGC_SPIRV_TRANSLATOR_HASH}
PREFIX ${BUILD_DIR}/igc_spirv_translator
CONFIGURE_COMMAND echo .
BUILD_COMMAND echo .
INSTALL_COMMAND echo .
)
add_dependencies(
external_igc_spirv_translator
external_igc_opencl_clang
)
if(WIN32)
set(IGC_GENERATOR "Ninja")
set(IGC_TARGET Windows64)
else()
set(IGC_GENERATOR "Unix Makefiles")
set(IGC_TARGET Linux64)
endif()
set(IGC_EXTRA_ARGS
-DIGC_OPTION__ARCHITECTURE_TARGET=${IGC_TARGET}
-DIGC_OPTION__ARCHITECTURE_HOST=${IGC_TARGET}
)
if(UNIX AND NOT APPLE)
list(APPEND IGC_EXTRA_ARGS
-DFLEX_EXECUTABLE=${LIBDIR}/flex/bin/flex
-DFLEX_INCLUDE_DIR=${LIBDIR}/flex/include
)
endif()
ExternalProject_Add(external_igc
URL file://${PACKAGE_DIR}/${IGC_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${IGC_HASH_TYPE}=${IGC_HASH}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/igc ${DEFAULT_CMAKE_FLAGS} ${IGC_EXTRA_ARGS}
# IGC is pretty set in its way where sub projects ought to live, for some it offers
# hooks to supply alternatives folders, other are just hardocded with no way to configure
# we symlink everything here, since it's less work than trying to convince the cmake
# scripts to accept alternative locations.
#
PATCH_COMMAND ${CMAKE_COMMAND} -E create_symlink ${BUILD_DIR}/igc_llvm/src/external_igc_llvm/ ${BUILD_DIR}/igc/src/llvm-project &&
${CMAKE_COMMAND} -E create_symlink ${BUILD_DIR}/igc_opencl_clang/src/external_igc_opencl_clang/ ${BUILD_DIR}/igc/src/llvm-project/llvm/projects/opencl-clang &&
${CMAKE_COMMAND} -E create_symlink ${BUILD_DIR}/igc_spirv_translator/src/external_igc_spirv_translator/ ${BUILD_DIR}/igc/src/llvm-project/llvm/projects/llvm-spirv &&
${CMAKE_COMMAND} -E create_symlink ${BUILD_DIR}/igc_spirv_tools/src/external_igc_spirv_tools/ ${BUILD_DIR}/igc/src/SPIRV-Tools &&
${CMAKE_COMMAND} -E create_symlink ${BUILD_DIR}/igc_spirv_headers/src/external_igc_spirv_headers/ ${BUILD_DIR}/igc/src/SPIRV-Headers &&
${CMAKE_COMMAND} -E create_symlink ${BUILD_DIR}/igc_vcintrinsics/src/external_igc_vcintrinsics/ ${BUILD_DIR}/igc/src/vc-intrinsics
PREFIX ${BUILD_DIR}/igc
INSTALL_DIR ${LIBDIR}/igc
INSTALL_COMMAND ${CMAKE_COMMAND} --install . --strip
CMAKE_GENERATOR ${IGC_GENERATOR}
)
add_dependencies(
external_igc
external_igc_vcintrinsics
external_igc_llvm
external_igc_opencl_clang
external_igc_vcintrinsics
external_igc_spirv_headers
external_igc_spirv_tools
external_igc_spirv_translator
)
if(UNIX AND NOT APPLE)
add_dependencies(
external_igc
external_flex
)
endif()

View File

@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(IMATH_EXTRA_ARGS
-DBUILD_SHARED_LIBS=OFF
-DBUILD_SHARED_LIBS=ON
-DBUILD_TESTING=OFF
-DIMATH_LIB_SUFFIX=${OPENEXR_VERSION_BUILD_POSTFIX}
)
@@ -11,6 +11,7 @@ ExternalProject_Add(external_imath
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${IMATH_HASH_TYPE}=${IMATH_HASH}
PREFIX ${BUILD_DIR}/imath
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/imath ${DEFAULT_CMAKE_FLAGS} ${IMATH_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/imath
)
@@ -19,6 +20,7 @@ if(WIN32)
ExternalProject_Add_Step(external_imath after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/imath/lib ${HARVEST_TARGET}/imath/lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/imath/include ${HARVEST_TARGET}/imath/include
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/imath/bin/imath${OPENEXR_VERSION_POSTFIX}.dll ${HARVEST_TARGET}/imath/bin/imath${OPENEXR_VERSION_POSTFIX}.dll
DEPENDEES install
)
endif()

View File

@@ -6,6 +6,7 @@ if(WIN32)
-DBISON_EXECUTABLE=${LIBDIR}/flexbison/win_bison.exe
-DM4_EXECUTABLE=${DOWNLOAD_DIR}/mingw/mingw64/msys/1.0/bin/m4.exe
-DARM_ENABLED=Off
-DPython3_FIND_REGISTRY=NEVER
)
elseif(APPLE)
# Use bison and flex installed via Homebrew.
@@ -27,25 +28,27 @@ elseif(UNIX)
set(ISPC_EXTRA_ARGS_UNIX
-DCMAKE_C_COMPILER=${LIBDIR}/llvm/bin/clang
-DCMAKE_CXX_COMPILER=${LIBDIR}/llvm/bin/clang++
-DARM_ENABLED=Off
-DARM_ENABLED=${BLENDER_PLATFORM_ARM}
-DFLEX_EXECUTABLE=${LIBDIR}/flex/bin/flex
)
endif()
set(ISPC_EXTRA_ARGS
-DISPC_NO_DUMPS=On
-DISPC_INCLUDE_EXAMPLES=Off
-DISPC_INCLUDE_TESTS=Off
-DLLVM_ROOT=${LIBDIR}/llvm/lib/cmake/llvm
-DLLVM_LIBRARY_DIR=${LIBDIR}/llvm/lib
-DCLANG_EXECUTABLE=${LIBDIR}/llvm/bin/clang
-DCLANGPP_EXECUTABLE=${LIBDIR}/llvm/bin/clang++
-DISPC_INCLUDE_TESTS=Off
-DCLANG_LIBRARY_DIR=${LIBDIR}/llvm/lib
-DCLANG_INCLUDE_DIRS=${LIBDIR}/llvm/include
${ISPC_EXTRA_ARGS_WIN}
${ISPC_EXTRA_ARGS_APPLE}
${ISPC_EXTRA_ARGS_UNIX}
-DISPC_NO_DUMPS=On
-DISPC_INCLUDE_EXAMPLES=Off
-DISPC_INCLUDE_TESTS=Off
-DLLVM_ROOT=${LIBDIR}/llvm/lib/cmake/llvm
-DLLVM_LIBRARY_DIR=${LIBDIR}/llvm/lib
-DCLANG_EXECUTABLE=${LIBDIR}/llvm/bin/clang
-DCLANGPP_EXECUTABLE=${LIBDIR}/llvm/bin/clang++
-DISPC_INCLUDE_TESTS=Off
-DCLANG_LIBRARY_DIR=${LIBDIR}/llvm/lib
-DCLANG_INCLUDE_DIRS=${LIBDIR}/llvm/include
-DPython3_ROOT_DIR=${LIBDIR}/python/
-DPython3_EXECUTABLE=${PYTHON_BINARY}
${ISPC_EXTRA_ARGS_WIN}
${ISPC_EXTRA_ARGS_APPLE}
${ISPC_EXTRA_ARGS_UNIX}
)
ExternalProject_Add(external_ispc
@@ -61,6 +64,7 @@ ExternalProject_Add(external_ispc
add_dependencies(
external_ispc
ll
external_python
)
if(WIN32)

View File

@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
# cmake for windows
# CMAKE for MS-Windows.
set(JPEG_EXTRA_ARGS
-DNASM=${NASM_PATH}
-DWITH_JPEG8=ON
@@ -33,8 +33,8 @@ if(WIN32)
)
endif()
else(WIN32)
# cmake for unix
else()
# CMAKE for UNIX.
set(JPEG_EXTRA_ARGS
-DWITH_JPEG8=ON
-DENABLE_STATIC=ON

View File

@@ -9,12 +9,15 @@ endif()
if(APPLE)
set(LLVM_XML2_ARGS
-DLIBXML2_LIBRARY=${LIBDIR}/xml2/lib/libxml2.a
-DLIBXML2_INCLUDE_DIR=${LIBDIR}/xml2/include/libxml2
)
set(LLVM_BUILD_CLANG_TOOLS_EXTRA ^^clang-tools-extra)
set(BUILD_CLANG_TOOLS ON)
else()
# NVIDIA PTX for OSL on Windows and Linux.
set(LLVM_TARGETS ${LLVM_TARGETS}$<SEMICOLON>NVPTX)
endif()
set(LLVM_EXTRA_ARGS
-DLLVM_USE_CRT_RELEASE=MD
-DLLVM_USE_CRT_DEBUG=MDd
@@ -25,15 +28,23 @@ set(LLVM_EXTRA_ARGS
-DLLVM_BUILD_LLVM_C_DYLIB=OFF
-DLLVM_ENABLE_UNWIND_TABLES=OFF
-DLLVM_ENABLE_PROJECTS=clang${LLVM_BUILD_CLANG_TOOLS_EXTRA}
-DPython3_ROOT_DIR=${LIBDIR}/python/
-DPython3_EXECUTABLE=${PYTHON_BINARY}
${LLVM_XML2_ARGS}
)
if(WIN32)
set(LLVM_GENERATOR "Ninja")
list(APPEND LLVM_EXTRA_ARGS -DPython3_FIND_REGISTRY=NEVER)
else()
set(LLVM_GENERATOR "Unix Makefiles")
endif()
# LLVM does not switch over to cpp17 until llvm 16 and building ealier versions with
# MSVC is leading to some crashes in ISPC. Switch back to their default on all platforms
# for now.
string(REPLACE "-DCMAKE_CXX_STANDARD=17" " " LLVM_CMAKE_FLAGS "${DEFAULT_CMAKE_FLAGS}")
# short project name due to long filename issues on windows
ExternalProject_Add(ll
URL file://${PACKAGE_DIR}/${LLVM_FILE}
@@ -44,7 +55,7 @@ ExternalProject_Add(ll
PREFIX ${BUILD_DIR}/ll
SOURCE_SUBDIR llvm
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/ll/src/ll < ${PATCH_DIR}/llvm.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/llvm ${DEFAULT_CMAKE_FLAGS} ${LLVM_EXTRA_ARGS}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/llvm ${LLVM_CMAKE_FLAGS} ${LLVM_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/llvm
)
@@ -74,3 +85,8 @@ if(APPLE)
external_xml2
)
endif()
add_dependencies(
ll
external_python
)

View File

@@ -0,0 +1,18 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# shorthand to only unpack a certain dependency
macro(unpack_only name)
string(TOUPPER ${name} UPPER_NAME)
set(TARGET_FILE ${${UPPER_NAME}_FILE})
set(TARGET_HASH_TYPE ${${UPPER_NAME}_HASH_TYPE})
set(TARGET_HASH ${${UPPER_NAME}_HASH})
ExternalProject_Add(external_${name}
URL file://${PACKAGE_DIR}/${TARGET_FILE}
URL_HASH ${TARGET_HASH_TYPE}=${TARGET_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/${name}
CONFIGURE_COMMAND echo .
BUILD_COMMAND echo .
INSTALL_COMMAND echo .
)
endmacro()

View File

@@ -0,0 +1,57 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(MATERIALX_EXTRA_ARGS
-DMATERIALX_BUILD_PYTHON=ON
-DMATERIALX_BUILD_RENDER=OFF
-DMATERIALX_INSTALL_PYTHON=OFF
-DMATERIALX_PYTHON_EXECUTABLE=${PYTHON_BINARY}
-DMATERIALX_PYTHON_VERSION=${PYTHON_SHORT_VERSION}
-DMATERIALX_BUILD_SHARED_LIBS=ON
-DCMAKE_DEBUG_POSTFIX=_d
-Dpybind11_ROOT=${LIBDIR}/pybind11
-DPython_EXECUTABLE=${PYTHON_BINARY}
)
ExternalProject_Add(external_materialx
URL file://${PACKAGE_DIR}/${MATERIALX_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${MATERIALX_HASH_TYPE}=${MATERIALX_HASH}
PREFIX ${BUILD_DIR}/materialx
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/materialx/src/external_materialx < ${PATCH_DIR}/materialx.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/materialx ${DEFAULT_CMAKE_FLAGS} ${MATERIALX_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/materialx
)
if(WIN32)
set(MATERIALX_PYTHON_TARGET ${HARVEST_TARGET}/materialx/python/${BUILD_MODE})
string(REPLACE "/" "\\" MATERIALX_PYTHON_TARGET_DOS "${MATERIALX_PYTHON_TARGET}")
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_materialx after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/materialx/include ${HARVEST_TARGET}/materialx/include
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/materialx/libraries ${HARVEST_TARGET}/materialx/libraries
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/materialx/lib/ ${HARVEST_TARGET}/materialx/lib/
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/materialx/bin/ ${HARVEST_TARGET}/materialx/bin/
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/materialx/python/ ${MATERIALX_PYTHON_TARGET}
COMMAND del ${MATERIALX_PYTHON_TARGET_DOS}\\MaterialX\\*.lib
DEPENDEES install
)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_materialx after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/materialx/lib/ ${HARVEST_TARGET}/materialx/lib/
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/materialx/bin/ ${HARVEST_TARGET}/materialx/bin/
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/materialx/python/ ${MATERIALX_PYTHON_TARGET}
COMMAND del ${MATERIALX_PYTHON_TARGET_DOS}\\MaterialX\\*.lib
DEPENDEES install
)
endif()
unset(MATERIALX_PYTHON_TARGET)
unset(MATERIALX_PYTHON_TARGET_DOS)
endif()
add_dependencies(
external_materialx
external_python
external_pybind11
)

View File

@@ -15,7 +15,7 @@ llvm-config = '${LIBDIR}/llvm/bin/llvm-config'"
)
set(MESA_EXTRA_FLAGS
-Dbuildtype=release
${MESON_BUILD_TYPE}
-Dc_args=${MESA_CFLAGS}
-Dcpp_args=${MESA_CXXFLAGS}
-Dc_link_args=${MESA_LDFLAGS}
@@ -33,6 +33,8 @@ set(MESA_EXTRA_FLAGS
# At some point we will likely want to support Wayland.
# Disable for now since it's not officially supported.
-Dplatforms=x11
# Needed to find the local expat.
--pkg-config-path=${LIBDIR}/expat/lib/pkgconfig
--native-file ${BUILD_DIR}/mesa/tmp/native-file.ini
)
@@ -43,7 +45,7 @@ ExternalProject_Add(external_mesa
PREFIX ${BUILD_DIR}/mesa
CONFIGURE_COMMAND ${CONFIGURE_ENV} &&
cd ${BUILD_DIR}/mesa/src/external_mesa/ &&
meson ${BUILD_DIR}/mesa/src/external_mesa-build --prefix=${LIBDIR}/mesa ${MESA_EXTRA_FLAGS}
${MESON} ${BUILD_DIR}/mesa/src/external_mesa-build --prefix=${LIBDIR}/mesa ${MESA_EXTRA_FLAGS}
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/mesa/src/external_mesa-build && ninja -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/mesa/src/external_mesa-build && ninja install
INSTALL_DIR ${LIBDIR}/mesa
@@ -52,4 +54,9 @@ ExternalProject_Add(external_mesa
add_dependencies(
external_mesa
ll
external_zlib
# Run-time dependency.
external_expat
# Needed for `MESON`.
external_python_site_packages
)

View File

@@ -0,0 +1,33 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(MINIZIPNG_EXTRA_ARGS
-DMZ_FETCH_LIBS=OFF
-DMZ_LIBCOMP=OFF
-DMZ_PKCRYPT=OFF
-DMZ_WZAES=OFF
-DMZ_OPENSSL=OFF
-DMZ_SIGNING=OFF
-DMZ_LZMA=OFF
-DMZ_ZSTD=OFF
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
-DBZIP2_LIBRARY=${LIBDIR}/bzip2/lib/${LIBPREFIX}bz2${LIBEXT}
-DBZIP2_INCLUDE_DIR=${LIBDIR}/bzip2/include/
# Because OCIO hardcodes a non standard include path
-DCMAKE_INSTALL_INCLUDEDIR=${LIBDIR}/minizipng/include/minizip-ng
)
ExternalProject_Add(external_minizipng
URL file://${PACKAGE_DIR}/${MINIZIPNG_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${MINIZIPNG_HASH_TYPE}=${MINIZIPNG_HASH}
PREFIX ${BUILD_DIR}/minizipng
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/minizipng ${DEFAULT_CMAKE_FLAGS} ${MINIZIPNG_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/minizipng
)
add_dependencies(
external_minizipng
external_zlib
)

View File

@@ -0,0 +1,24 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(OCLOC_EXTRA_ARGS
-DNEO_SKIP_UNIT_TESTS=1
-DNEO_BUILD_WITH_OCL=0
-DBUILD_WITH_L0=0
-DIGC_DIR=${LIBDIR}/igc
-DGMM_DIR=${LIBDIR}/gmmlib
)
ExternalProject_Add(external_ocloc
URL file://${PACKAGE_DIR}/${OCLOC_FILE}
URL_HASH ${OCLOC_HASH_TYPE}=${OCLOC_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/ocloc
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/ocloc ${DEFAULT_CMAKE_FLAGS} ${OCLOC_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/ocloc
)
add_dependencies(
external_ocloc
external_igc
external_gmmlib
)

View File

@@ -4,6 +4,33 @@ if(UNIX)
set(OPENCOLLADA_EXTRA_ARGS
-DLIBXML2_INCLUDE_DIR=${LIBDIR}/xml2/include/libxml2
-DLIBXML2_LIBRARIES=${LIBDIR}/xml2/lib/libxml2.a)
# WARNING: the patch contains mixed UNIX and DOS line endings
# as does the OPENCOLLADA package, if this can be corrected upstream that would be better.
# For now use `sed` to force UNIX line endings so the patch applies.
# Needed as neither ignoring white-space or applying as a binary resolve this problem.
if(APPLE)
set(_dos2unix dos2unix)
else()
set(_dos2unix sed -i "s/\\r//")
endif()
set(PATCH_MAYBE_DOS2UNIX_CMD
${_dos2unix}
${PATCH_DIR}/opencollada.diff
${BUILD_DIR}/opencollada/src/external_opencollada/CMakeLists.txt
${BUILD_DIR}/opencollada/src/external_opencollada/Externals/LibXML/CMakeLists.txt &&
)
else()
set(OPENCOLLADA_EXTRA_ARGS
-DCMAKE_DEBUG_POSTFIX=_d
-DLIBXML2_INCLUDE_DIR=${LIBDIR}/xml2/include/libxml2
)
if(BUILD_MODE STREQUAL Release)
list(APPEND OPENCOLLADA_EXTRA_ARGS -DLIBXML2_LIBRARIES=${LIBDIR}/xml2/lib/libxml2s.lib)
else()
list(APPEND OPENCOLLADA_EXTRA_ARGS -DLIBXML2_LIBRARIES=${LIBDIR}/xml2/lib/libxml2sd.lib)
endif()
set(PATCH_MAYBE_DOS2UNIX_CMD)
endif()
ExternalProject_Add(external_opencollada
@@ -11,17 +38,19 @@ ExternalProject_Add(external_opencollada
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${OPENCOLLADA_HASH_TYPE}=${OPENCOLLADA_HASH}
PREFIX ${BUILD_DIR}/opencollada
PATCH_COMMAND ${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/opencollada/src/external_opencollada < ${PATCH_DIR}/opencollada.diff
PATCH_COMMAND
${PATCH_MAYBE_DOS2UNIX_CMD}
${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/opencollada/src/external_opencollada < ${PATCH_DIR}/opencollada.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/opencollada ${DEFAULT_CMAKE_FLAGS} ${OPENCOLLADA_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/opencollada
)
if(UNIX)
add_dependencies(
external_opencollada
external_xml2
)
endif()
unset(PATCH_MAYBE_DOS2UNIX_CMD)
add_dependencies(
external_opencollada
external_xml2
)
if(WIN32)
if(BUILD_MODE STREQUAL Release)
@@ -32,17 +61,7 @@ if(WIN32)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_opencollada after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencollada/lib/opencollada/buffer.lib ${HARVEST_TARGET}/opencollada/lib/opencollada/buffer_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencollada/lib/opencollada/ftoa.lib ${HARVEST_TARGET}/opencollada/lib/opencollada/ftoa_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencollada/lib/opencollada/GeneratedSaxParser.lib ${HARVEST_TARGET}/opencollada/lib/opencollada/GeneratedSaxParser_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencollada/lib/opencollada/MathMLSolver.lib ${HARVEST_TARGET}/opencollada/lib/opencollada/MathMLSolver_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencollada/lib/opencollada/OpenCOLLADABaseUtils.lib ${HARVEST_TARGET}/opencollada/lib/opencollada/OpenCOLLADABaseUtils_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencollada/lib/opencollada/OpenCOLLADAFramework.lib ${HARVEST_TARGET}/opencollada/lib/opencollada/OpenCOLLADAFramework_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencollada/lib/opencollada/OpenCOLLADASaxFrameworkLoader.lib ${HARVEST_TARGET}/opencollada/lib/opencollada/OpenCOLLADASaxFrameworkLoader_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencollada/lib/opencollada/OpenCOLLADAStreamWriter.lib ${HARVEST_TARGET}/opencollada/lib/opencollada/OpenCOLLADAStreamWriter_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencollada/lib/opencollada/pcre.lib ${HARVEST_TARGET}/opencollada/lib/opencollada/pcre_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencollada/lib/opencollada/UTF.lib ${HARVEST_TARGET}/opencollada/lib/opencollada/UTF_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencollada/lib/opencollada/xml.lib ${HARVEST_TARGET}/opencollada/lib/opencollada/xml_d.lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/opencollada/lib ${HARVEST_TARGET}/opencollada/lib
DEPENDEES install
)
endif()

View File

@@ -2,10 +2,10 @@
set(OPENCOLORIO_EXTRA_ARGS
-DOCIO_BUILD_APPS=OFF
-DOCIO_BUILD_PYTHON=OFF
-DOCIO_BUILD_PYTHON=ON
-DOCIO_BUILD_NUKE=OFF
-DOCIO_BUILD_JAVA=OFF
-DBUILD_SHARED_LIBS=OFF
-DBUILD_SHARED_LIBS=ON
-DOCIO_BUILD_DOCS=OFF
-DOCIO_BUILD_TESTS=OFF
-DOCIO_BUILD_GPU_TESTS=OFF
@@ -15,10 +15,30 @@ set(OPENCOLORIO_EXTRA_ARGS
-Dexpat_ROOT=${LIBDIR}/expat
-Dyaml-cpp_ROOT=${LIBDIR}/yamlcpp
-Dyaml-cpp_VERSION=${YAMLCPP_VERSION}
-Dpystring_ROOT=${LIBDIR}/pystring
-DImath_ROOT=${LIBDIR}/imath
-Dminizip-ng_ROOT=${LIBDIR}/minizipng
-Dminizip-ng_INCLUDE_DIR=${LIBDIR}/minizipng/include
-Dminizip-ng_LIBRARY=${LIBDIR}/minizipng/lib/libminizip${LIBEXT}
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
-DPython_EXECUTABLE=${PYTHON_BINARY}
-Dpybind11_ROOT=${LIBDIR}/pybind11
)
if(APPLE)
set(OPENCOLORIO_EXTRA_ARGS
${OPENCOLORIO_EXTRA_ARGS}
"-DCMAKE_SHARED_LINKER_FLAGS=-liconv ${LIBDIR}/bzip2/lib/${LIBPREFIX}bz2${LIBEXT}"
)
elseif(UNIX)
set(OPENCOLORIO_EXTRA_ARGS
${OPENCOLORIO_EXTRA_ARGS}
"-DCMAKE_SHARED_LINKER_FLAGS=${LIBDIR}/bzip2/lib/${LIBPREFIX}bz2${LIBEXT}"
)
endif()
if(BLENDER_PLATFORM_ARM)
set(OPENCOLORIO_EXTRA_ARGS
${OPENCOLORIO_EXTRA_ARGS}
@@ -27,11 +47,16 @@ if(BLENDER_PLATFORM_ARM)
endif()
if(WIN32)
set(OPENCOLORIO_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DIMATH_DLL")
if(BUILD_MODE STREQUAL Debug)
set(OPENCOLORIO_CXX_FLAGS "${OPENCOLORIO_CXX_FLAGS} -DPy_DEBUG")
endif()
set(OPENCOLORIO_EXTRA_ARGS
${OPENCOLORIO_EXTRA_ARGS}
-Dexpat_LIBRARY=${LIBDIR}/expat/lib/libexpatMD
-Dyaml-cpp_LIBRARY=${LIBDIR}/expat/lib/libyaml-cppmd.lib
-DImath_LIBRARY=${LIBDIR}/imath/lib/imath${OPENEXR_VERSION_POSTFIX}
-DCMAKE_DEBUG_POSTFIX=_d
-Dexpat_LIBRARY=${LIBDIR}/expat/lib/libexpat$<$<STREQUAL:${BUILD_MODE},Debug>:d>MD${LIBEXT}
-DImath_LIBRARY=${LIBDIR}/imath/lib/imath${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DCMAKE_CXX_FLAGS=${OPENCOLORIO_CXX_FLAGS}
)
else()
set(OPENCOLORIO_EXTRA_ARGS
@@ -43,6 +68,7 @@ ExternalProject_Add(external_opencolorio
URL file://${PACKAGE_DIR}/${OPENCOLORIO_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${OPENCOLORIO_HASH_TYPE}=${OPENCOLORIO_HASH}
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
PREFIX ${BUILD_DIR}/opencolorio
PATCH_COMMAND ${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/opencolorio/src/external_opencolorio < ${PATCH_DIR}/opencolorio.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/opencolorio ${DEFAULT_CMAKE_FLAGS} ${OPENCOLORIO_EXTRA_ARGS}
@@ -55,33 +81,34 @@ add_dependencies(
external_expat
external_imath
external_pystring
external_zlib
external_minizipng
external_python
external_pybind11
)
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_opencolorio after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/opencolorio/include ${HARVEST_TARGET}/opencolorio/include
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencolorio/bin/OpenColorIO_2_2.dll ${HARVEST_TARGET}/opencolorio/bin/OpenColorIO_2_2.dll
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/opencolorio/lib ${HARVEST_TARGET}/opencolorio/lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/yamlcpp/lib/libyaml-cppmd.lib ${HARVEST_TARGET}/opencolorio/lib/libyaml-cpp.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/expat/lib/libexpatMD.lib ${HARVEST_TARGET}/opencolorio/lib/libexpatMD.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/pystring/lib/pystring.lib ${HARVEST_TARGET}/opencolorio/lib/pystring.lib
DEPENDEES install
)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_opencolorio after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencolorio/lib/Opencolorio.lib ${HARVEST_TARGET}/opencolorio/lib/OpencolorIO_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/yamlcpp/lib/libyaml-cppmdd.lib ${HARVEST_TARGET}/opencolorio/lib/libyaml-cpp_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/expat/lib/libexpatdMD.lib ${HARVEST_TARGET}/opencolorio/lib/libexpatdMD.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/pystring/lib/pystring.lib ${HARVEST_TARGET}/opencolorio/lib/pystring_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencolorio/bin/OpenColorIO_d_2_2.dll ${HARVEST_TARGET}/opencolorio/bin/OpenColorIO_d_2_2.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencolorio/lib/Opencolorio_d.lib ${HARVEST_TARGET}/opencolorio/lib/OpenColorIO_d.lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/opencolorio/lib/site-packages ${HARVEST_TARGET}/opencolorio/lib/site-packages-debug
DEPENDEES install
)
endif()
else()
ExternalProject_Add_Step(external_opencolorio after_install
COMMAND cp ${LIBDIR}/yamlcpp/lib/libyaml-cpp.a ${LIBDIR}/opencolorio/lib/
COMMAND cp ${LIBDIR}/expat/lib/libexpat.a ${LIBDIR}/opencolorio/lib/
COMMAND cp ${LIBDIR}/pystring/lib/libpystring.a ${LIBDIR}/opencolorio/lib/
DEPENDEES install
)
ExternalProject_Add_Step(external_opencolorio after_install
COMMAND cp ${LIBDIR}/yamlcpp/lib/libyaml-cpp.a ${LIBDIR}/opencolorio/lib/
COMMAND cp ${LIBDIR}/expat/lib/libexpat.a ${LIBDIR}/opencolorio/lib/
COMMAND cp ${LIBDIR}/pystring/lib/libpystring.a ${LIBDIR}/opencolorio/lib/
DEPENDEES install
)
endif()

View File

@@ -16,7 +16,7 @@ set(OPENEXR_EXTRA_ARGS
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
-DBUILD_TESTING=OFF
-DOPENEXR_BUILD_BOTH_STATIC_SHARED=OFF
-DBUILD_SHARED_LIBS=OFF
-DBUILD_SHARED_LIBS=ON
-DOPENEXR_INSTALL_TOOLS=OFF
-DOPENEXR_INSTALL_EXAMPLES=OFF
-DImath_DIR=${LIBDIR}/imath/lib/cmake/Imath
@@ -27,6 +27,7 @@ ExternalProject_Add(external_openexr
URL file://${PACKAGE_DIR}/${OPENEXR_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${OPENEXR_HASH_TYPE}=${OPENEXR_HASH}
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
PREFIX ${BUILD_DIR}/openexr
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openexr ${DEFAULT_CMAKE_FLAGS} ${OPENEXR_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/openexr
@@ -36,6 +37,11 @@ if(WIN32)
ExternalProject_Add_Step(external_openexr after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openexr/lib ${HARVEST_TARGET}/openexr/lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openexr/include ${HARVEST_TARGET}/openexr/include
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openexr/bin/Iex${OPENEXR_VERSION_POSTFIX}.dll ${HARVEST_TARGET}/openexr/bin/Iex${OPENEXR_VERSION_POSTFIX}.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openexr/bin/IlmThread${OPENEXR_VERSION_POSTFIX}.dll ${HARVEST_TARGET}/openexr/bin/IlmThread${OPENEXR_VERSION_POSTFIX}.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openexr/bin/OpenEXRCore${OPENEXR_VERSION_POSTFIX}.dll ${HARVEST_TARGET}/openexr/bin/OpenEXRCore${OPENEXR_VERSION_POSTFIX}.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openexr/bin/OpenEXRUtil${OPENEXR_VERSION_POSTFIX}.dll ${HARVEST_TARGET}/openexr/bin/OpenEXRUtil${OPENEXR_VERSION_POSTFIX}.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openexr/bin/OpenEXR${OPENEXR_VERSION_POSTFIX}.dll ${HARVEST_TARGET}/openexr/bin/OpenEXR${OPENEXR_VERSION_POSTFIX}.dll
DEPENDEES install
)
endif()
@@ -43,4 +49,5 @@ endif()
add_dependencies(
external_openexr
external_zlib
external_imath
)

View File

@@ -9,6 +9,7 @@ set(OIDN_EXTRA_ARGS
-DOIDN_STATIC_RUNTIME=OFF
-DISPC_EXECUTABLE=${LIBDIR}/ispc/bin/ispc
-DOIDN_FILTER_RTLIGHTMAP=OFF
-DPYTHON_EXECUTABLE=${PYTHON_BINARY}
)
if(WIN32)
@@ -38,6 +39,7 @@ add_dependencies(
external_openimagedenoise
external_tbb
external_ispc
external_python
)
if(WIN32)

View File

@@ -15,12 +15,20 @@ else()
endif()
if(WIN32)
set(PNG_LIBNAME libpng16_static${LIBEXT})
set(OIIO_SIMD_FLAGS -DUSE_SIMD=sse2)
set(OPENJPEG_POSTFIX _msvc)
if(BUILD_MODE STREQUAL Debug)
set(TIFF_POSTFIX d)
set(PNG_POSTFIX d)
else()
set(TIFF_POSTFIX)
set(PNG_POSTFIX)
endif()
set(PNG_LIBNAME libpng16_static${PNG_POSTFIX}${LIBEXT})
else()
set(PNG_LIBNAME libpng${LIBEXT})
set(OIIO_SIMD_FLAGS)
set(TIFF_POSTFIX)
endif()
if(MSVC)
@@ -34,7 +42,7 @@ else()
endif()
set(OPENIMAGEIO_EXTRA_ARGS
-DBUILD_SHARED_LIBS=OFF
-DBUILD_SHARED_LIBS=ON
${OPENIMAGEIO_LINKSTATIC}
${DEFAULT_BOOST_FLAGS}
-DUSE_LIBSQUISH=OFF
@@ -48,7 +56,7 @@ set(OPENIMAGEIO_EXTRA_ARGS
-DUSE_OPENGL=OFF
-DUSE_TBB=OFF
-DUSE_QT=OFF
-DUSE_PYTHON=OFF
-DUSE_PYTHON=ON
-DUSE_GIF=OFF
-DUSE_OPENCV=OFF
-DUSE_OPENJPEG=ON
@@ -65,18 +73,19 @@ set(OPENIMAGEIO_EXTRA_ARGS
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include
-DPNG_LIBRARY=${LIBDIR}/png/lib/${PNG_LIBNAME}
-DPNG_PNG_INCLUDE_DIR=${LIBDIR}/png/include
-DTIFF_LIBRARY=${LIBDIR}/tiff/lib/${LIBPREFIX}tiff${LIBEXT}
-DTIFF_LIBRARY=${LIBDIR}/tiff/lib/${LIBPREFIX}tiff${TIFF_POSTFIX}${LIBEXT}
-DTIFF_INCLUDE_DIR=${LIBDIR}/tiff/include
-DJPEG_LIBRARY=${LIBDIR}/jpeg/lib/${JPEG_LIBRARY}
-DJPEG_INCLUDE_DIR=${LIBDIR}/jpeg/include
${OPENJPEG_FLAGS}
-DOPENEXR_ILMTHREAD_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmThread${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_IEX_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}Iex${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_ILMIMF_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_ILMTHREAD_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmThread${OPENEXR_VERSION_POSTFIX}${SHAREDLIBEXT}
-DOPENEXR_IEX_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}Iex${OPENEXR_VERSION_POSTFIX}${SHAREDLIBEXT}
-DOPENEXR_ILMIMF_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf${OPENEXR_VERSION_POSTFIX}${SHAREDLIBEXT}
-DSTOP_ON_WARNING=OFF
-DUSE_EXTERNAL_PUGIXML=ON
-DPUGIXML_LIBRARY=${LIBDIR}/pugixml/lib/${LIBPREFIX}pugixml${LIBEXT}
-DPUGIXML_INCLUDE_DIR=${LIBDIR}/pugixml/include/
-Dpugixml_DIR=${LIBDIR}/pugixml/lib/cmake/pugixml
-DBUILD_MISSING_ROBINMAP=OFF
-DBUILD_MISSING_FMT=OFF
-DFMT_INCLUDE_DIR=${LIBDIR}/fmt/include/
@@ -85,12 +94,15 @@ set(OPENIMAGEIO_EXTRA_ARGS
${OIIO_SIMD_FLAGS}
-DOpenEXR_ROOT=${LIBDIR}/openexr
-DImath_ROOT=${LIBDIR}/imath
-Dpybind11_ROOT=${LIBDIR}/pybind11
-DPython_EXECUTABLE=${PYTHON_BINARY}
)
ExternalProject_Add(external_openimageio
URL file://${PACKAGE_DIR}/${OPENIMAGEIO_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${OPENIMAGEIO_HASH_TYPE}=${OPENIMAGEIO_HASH}
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
PREFIX ${BUILD_DIR}/openimageio
PATCH_COMMAND ${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/openimageio/src/external_openimageio/ < ${PATCH_DIR}/openimageio.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openimageio ${DEFAULT_CMAKE_FLAGS} ${OPENIMAGEIO_EXTRA_ARGS}
@@ -111,6 +123,8 @@ add_dependencies(
external_robinmap
external_openjpeg${OPENJPEG_POSTFIX}
external_webp
external_python
external_pybind11
)
if(WIN32)
@@ -119,7 +133,8 @@ if(WIN32)
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/OpenImageIO/include ${HARVEST_TARGET}/OpenImageIO/include
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/OpenImageIO/lib ${HARVEST_TARGET}/OpenImageIO/lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/OpenImageIO/bin/idiff.exe ${HARVEST_TARGET}/OpenImageIO/bin/idiff.exe
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/OpenImageIO/bin/OpenImageIO.dll ${HARVEST_TARGET}/OpenImageIO/bin/OpenImageIO.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/OpenImageIO/bin/OpenImageIO_Util.dll ${HARVEST_TARGET}/OpenImageIO/bin/OpenImageIO_Util.dll
DEPENDEES install
)
endif()
@@ -127,6 +142,9 @@ if(WIN32)
ExternalProject_Add_Step(external_openimageio after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimageio/lib/OpenImageIO_d.lib ${HARVEST_TARGET}/openimageio/lib/OpenImageIO_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimageio/lib/OpenImageIO_Util_d.lib ${HARVEST_TARGET}/openimageio/lib/OpenImageIO_Util_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/OpenImageIO/bin/OpenImageIO_d.dll ${HARVEST_TARGET}/OpenImageIO/bin/OpenImageIO_d.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/OpenImageIO/bin/OpenImageIO_Util_d.dll ${HARVEST_TARGET}/OpenImageIO/bin/OpenImageIO_Util_d.dll
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/OpenImageIO/lib/python${PYTHON_SHORT_VERSION}/ ${HARVEST_TARGET}/OpenImageIO/lib/python${PYTHON_SHORT_VERSION}_debug/
DEPENDEES install
)
endif()

View File

@@ -39,8 +39,10 @@ if(MSVC)
)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_openjpeg_msvc after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openjpeg_msvc/lib ${HARVEST_TARGET}/openjpeg/lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openjpeg_msvc/include ${HARVEST_TARGET}/openjpeg/include
COMMAND
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openjpeg_msvc/lib ${HARVEST_TARGET}/openjpeg/lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openjpeg_msvc/include ${HARVEST_TARGET}/openjpeg/include
DEPENDEES install
)
endif()

View File

@@ -0,0 +1,47 @@
# 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.
set(OPENPGL_EXTRA_ARGS
-DOPENPGL_BUILD_STATIC=ON
-DOPENPGL_TBB_ROOT=${LIBDIR}/tbb
-DTBB_ROOT=${LIBDIR}/tbb
-DCMAKE_DEBUG_POSTFIX=_d
)
if(TBB_STATIC_LIBRARY)
set(OPENPGL_EXTRA_ARGS
${OPENPGL_EXTRA_ARGS}
-DOPENPGL_TBB_COMPONENT=tbb_static
)
endif()
ExternalProject_Add(external_openpgl
URL file://${PACKAGE_DIR}/${OPENPGL_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${OPENPGL_HASH_TYPE}=${OPENPGL_HASH}
PREFIX ${BUILD_DIR}/openpgl
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openpgl ${DEFAULT_CMAKE_FLAGS} ${OPENPGL_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/openpgl
)
add_dependencies(
external_openpgl
external_tbb
)
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_openpgl after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openpgl ${HARVEST_TARGET}/openpgl
DEPENDEES install
)
else()
ExternalProject_Add_Step(external_openpgl after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openpgl/lib/openpgl_d.lib ${HARVEST_TARGET}/openpgl/lib/openpgl_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openpgl/lib/cmake/openpgl-${OPENPGL_SHORT_VERSION}/openpgl_Exports-debug.cmake ${HARVEST_TARGET}/openpgl/lib/cmake/openpgl-${OPENPGL_SHORT_VERSION}/openpgl_Exports-debug.cmake
DEPENDEES install
)
endif()
endif()

View File

@@ -32,7 +32,7 @@ else()
set(OPENSUBDIV_EXTRA_ARGS
${OPENSUBDIV_EXTRA_ARGS}
-DTBB_INCLUDE_DIR=${LIBDIR}/tbb/include
-DTBB_tbb_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}tbb_static${LIBEXT}
-DTBB_tbb_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}tbb${SHAREDLIBEXT}
)
endif()

View File

@@ -4,23 +4,14 @@ if(BUILD_MODE STREQUAL Debug)
set(BLOSC_POST _d)
endif()
if(WIN32)
set(OPENVDB_SHARED ON)
set(OPENVDB_STATIC OFF)
else()
set(OPENVDB_SHARED OFF)
set(OPENVDB_STATIC ON)
endif()
set(OPENVDB_EXTRA_ARGS
${DEFAULT_BOOST_FLAGS}
-DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING}
-DBoost_USE_MULTITHREADED=ON
-DBoost_USE_STATIC_LIBS=ON
-DBoost_USE_STATIC_RUNTIME=OFF
-DBOOST_ROOT=${LIBDIR}/boost
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_NO_BOOST_CMAKE=ON
-DUSE_STATIC_DEPENDENCIES=OFF # This is the global toggle for static libs
# Once the above switch is off, you can set it
# for each individual library below.
-DBLOSC_USE_STATIC_LIBS=ON
-DTBB_USE_STATIC_LIBS=OFF
-DBoost_USE_STATIC_LIBS=OFF
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
-DBlosc_INCLUDE_DIR=${LIBDIR}/blosc/include/
@@ -28,25 +19,36 @@ set(OPENVDB_EXTRA_ARGS
-DBlosc_LIBRARY_RELEASE=${LIBDIR}/blosc/lib/libblosc${BLOSC_POST}${LIBEXT}
-DBlosc_LIBRARY_DEBUG=${LIBDIR}/blosc/lib/libblosc${BLOSC_POST}${LIBEXT}
-DOPENVDB_BUILD_UNITTESTS=OFF
-DOPENVDB_BUILD_PYTHON_MODULE=OFF
-DOPENVDB_BUILD_NANOVDB=ON
-DNANOVDB_BUILD_TOOLS=OFF
-DBlosc_ROOT=${LIBDIR}/blosc/
-DTBB_ROOT=${LIBDIR}/tbb/
-DOPENVDB_CORE_SHARED=${OPENVDB_SHARED}
-DOPENVDB_CORE_STATIC=${OPENVDB_STATIC}
-DTbb_INCLUDE_DIR=${LIBDIR}/tbb/include
-DTbb_LEGACY_INCLUDE_DIR=${LIBDIR}/tbb/include
-DOPENVDB_CORE_SHARED=ON
-DOPENVDB_CORE_STATIC=OFF
-DOPENVDB_BUILD_BINARIES=OFF
-DCMAKE_DEBUG_POSTFIX=_d
-DBLOSC_USE_STATIC_LIBS=ON
-DUSE_NANOVDB=ON
-DOPENVDB_BUILD_PYTHON_MODULE=ON
-DOPENVDB_PYTHON_WRAP_ALL_GRID_TYPES=ON
-DUSE_NUMPY=ON
-DPython_EXECUTABLE=${PYTHON_BINARY}
# OPENVDB_AX Disabled for now as it adds ~25MB distribution wise
# with no blender code depending on it, seems wasteful.
# -DOPENVDB_BUILD_AX=ON
# -DOPENVDB_AX_SHARED=ON
# -DOPENVDB_AX_STATIC=OFF
# -DLLVM_DIR=${LIBDIR}/llvm/lib/cmake/llvm
)
if(WIN32)
# Namespaces seem to be buggy and cause linker errors due to things not
# being in the correct namespace
# needs to link pthreads due to it being a blosc dependency
set(OPENVDB_EXTRA_ARGS ${OPENVDB_EXTRA_ARGS}
-DCMAKE_CXX_STANDARD_LIBRARIES="${LIBDIR}/pthreads/lib/pthreadVC3.lib"
set(OPENVDB_PATCH ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openvdb/src/openvdb < ${PATCH_DIR}/openvdb.diff)
if(APPLE)
set(OPENVDB_PATCH
${OPENVDB_PATCH} &&
${PATCH_CMD} -p 0 -d ${BUILD_DIR}/openvdb/src/openvdb < ${PATCH_DIR}/openvdb_metal.diff
)
endif()
@@ -54,8 +56,9 @@ ExternalProject_Add(openvdb
URL file://${PACKAGE_DIR}/${OPENVDB_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${OPENVDB_HASH_TYPE}=${OPENVDB_HASH}
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
PREFIX ${BUILD_DIR}/openvdb
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openvdb/src/openvdb < ${PATCH_DIR}/openvdb.diff
PATCH_COMMAND ${OPENVDB_PATCH}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openvdb ${DEFAULT_CMAKE_FLAGS} ${OPENVDB_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/openvdb
)
@@ -66,6 +69,8 @@ add_dependencies(
external_boost
external_zlib
external_blosc
external_python
external_numpy
)
if(WIN32)
@@ -74,6 +79,7 @@ if(WIN32)
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openvdb/include ${HARVEST_TARGET}/openvdb/include
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/lib/openvdb.lib ${HARVEST_TARGET}/openvdb/lib/openvdb.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/bin/openvdb.dll ${HARVEST_TARGET}/openvdb/bin/openvdb.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/lib/python${PYTHON_SHORT_VERSION}/site-packages/pyopenvdb.pyd ${HARVEST_TARGET}openvdb/python/pyopenvdb.pyd
DEPENDEES install
)
endif()
@@ -81,6 +87,7 @@ if(WIN32)
ExternalProject_Add_Step(openvdb after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/lib/openvdb_d.lib ${HARVEST_TARGET}/openvdb/lib/openvdb_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/bin/openvdb_d.dll ${HARVEST_TARGET}/openvdb/bin/openvdb_d.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/lib/python${PYTHON_SHORT_VERSION}/site-packages/pyopenvdb_d.pyd ${HARVEST_TARGET}openvdb/python/pyopenvdb_d.pyd
DEPENDEES install
)
endif()

View File

@@ -3,7 +3,8 @@
if(WIN32)
option(ENABLE_MINGW64 "Enable building of ffmpeg/iconv/libsndfile/fftw3 by installing mingw64" ON)
endif()
option(WITH_BOOST_PYTHON "Enable building of boost with python support" OFF)
option(FORCE_CHECK_HASH "Force a check of all hashses during CMake the configure phase" OFF)
cmake_host_system_information(RESULT NUM_CORES QUERY NUMBER_OF_LOGICAL_CORES)
set(MAKE_THREADS ${NUM_CORES} CACHE STRING "Number of threads to run make with")
@@ -15,13 +16,15 @@ message("BuildMode = ${BUILD_MODE}")
if(BUILD_MODE STREQUAL "Debug")
set(LIBDIR ${CMAKE_CURRENT_BINARY_DIR}/Debug)
else(BUILD_MODE STREQUAL "Debug")
set(MESON_BUILD_TYPE -Dbuildtype=debug)
else()
set(LIBDIR ${CMAKE_CURRENT_BINARY_DIR}/Release)
set(MESON_BUILD_TYPE -Dbuildtype=release)
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")
set(PACKAGE_DIR "${CMAKE_CURRENT_BINARY_DIR}/packages" CACHE PATH "default path for downloaded packages")
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)
@@ -38,32 +41,38 @@ message("BUILD_DIR = ${BUILD_DIR}")
if(WIN32)
set(PATCH_CMD ${DOWNLOAD_DIR}/mingw/mingw64/msys/1.0/bin/patch.exe)
set(LIBEXT ".lib")
set(SHAREDLIBEXT ".lib")
set(LIBPREFIX "")
set(MESON ${LIBDIR}/python/Scripts/meson)
# For OIIO and OSL
set(COMMON_DEFINES /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS)
set(COMMON_DEFINES /DPSAPI_VERSION=2 /DTINYFORMAT_ALLOW_WCHAR_STRINGS)
if(MSVC_VERSION GREATER 1909)
set(COMMON_MSVC_FLAGS "/Wv:18") #some deps with warnings as error aren't quite ready for dealing with the new 2017 warnings.
endif()
string(APPEND COMMON_MSVC_FLAGS " /bigobj")
if(WITH_OPTIMIZED_DEBUG)
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
else()
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /Zi /Ob0 /Od /RTC1 /D_DEBUG /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
endif()
set(BLENDER_CMAKE_C_FLAGS_MINSIZEREL "/MD ${COMMON_MSVC_FLAGS} /O1 /Ob1 /D NDEBUG /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_RELEASE "/MD ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_RELWITHDEBINFO "/MD ${COMMON_MSVC_FLAGS} /Zi /O2 /Ob1 /D NDEBUG /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
# To keep MSVC from oversubscribing the CPU, force it to single threaded mode
# msbuild/ninja will queue as many compile units as there are cores, no need for
# msvc to be internally threading as well.
string(APPEND COMMON_MSVC_FLAGS " /cgthreads1 ")
if(WITH_OPTIMIZED_DEBUG)
set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /D_DEBUG /DPSAPI_VERSION=2 /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
else()
set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /D PLATFORM_WINDOWS /MTd ${COMMON_MSVC_FLAGS} /Zi /Ob0 /Od /RTC1 /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /Zi /Ob0 /Od /RTC1 /D_DEBUG /DPSAPI_VERSION=2 /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
endif()
set(BLENDER_CMAKE_CXX_FLAGS_MINSIZEREL "/MD /${COMMON_MSVC_FLAGS} /O1 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_CXX_FLAGS_RELEASE "/MD ${COMMON_MSVC_FLAGS} /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD ${COMMON_MSVC_FLAGS} /Zi /O2 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_MINSIZEREL "/MD ${COMMON_MSVC_FLAGS} /O1 /Ob1 /D NDEBUG /DPSAPI_VERSION=2 /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_RELEASE "/MD ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=2 /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_RELWITHDEBINFO "/MD ${COMMON_MSVC_FLAGS} /Zi /O2 /Ob1 /D NDEBUG /DPSAPI_VERSION=2 /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
if(WITH_OPTIMIZED_DEBUG)
set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS /O2 /Ob2 /D_DEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=2 /DTINYFORMAT_ALLOW_WCHAR_STRINGS /DBOOST_DEBUG_PYTHON /DBOOST_ALL_NO_LIB")
else()
set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /D PLATFORM_WINDOWS /D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS /MTd ${COMMON_MSVC_FLAGS} /Zi /Ob0 /Od /RTC1 /DPSAPI_VERSION=2 /DTINYFORMAT_ALLOW_WCHAR_STRINGS /DBOOST_DEBUG_PYTHON /DBOOST_ALL_NO_LIB")
endif()
set(BLENDER_CMAKE_CXX_FLAGS_MINSIZEREL "/MD /${COMMON_MSVC_FLAGS} /D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS /O1 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=2 /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_CXX_FLAGS_RELEASE "/MD ${COMMON_MSVC_FLAGS} /D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=2 /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD ${COMMON_MSVC_FLAGS} /D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS /Zi /O2 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=2 /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(PLATFORM_FLAGS)
set(PLATFORM_CXX_FLAGS)
@@ -74,6 +83,18 @@ if(WIN32)
set(PERL_SHELL ${DOWNLOAD_DIR}/perl/portableshell.bat)
set(MINGW_HOST x86_64-w64-mingw32)
# some build systems like meson will respect the *nix like environment vars
# like CFLAGS and LDFlags but will still build with the MSVC compiler, so for
# those we need to empty out the gcc style flags that are normally in there.
set(CONFIGURE_ENV_MSVC
cd ${MINGW_PATH} &&
call ${PERL_SHELL} &&
call ${MINGW_SHELL} &&
set path &&
set CFLAGS= &&
set LDFLAGS=
)
set(CONFIGURE_ENV
cd ${MINGW_PATH} &&
call ${PERL_SHELL} &&
@@ -97,36 +118,20 @@ else()
set(PATCH_CMD patch)
set(LIBEXT ".a")
set(LIBPREFIX "lib")
set(MESON ${LIBDIR}/python/bin/meson)
if(APPLE)
# Let's get the current Xcode dir, to support xcode-select
execute_process(
COMMAND xcode-select --print-path
OUTPUT_VARIABLE XCODE_DEV_PATH OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND xcodebuild -version -sdk macosx SDKVersion
OUTPUT_VARIABLE MACOSX_SDK_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
set(SHAREDLIBEXT ".dylib")
if(NOT CMAKE_OSX_ARCHITECTURES)
execute_process(COMMAND uname -m OUTPUT_VARIABLE ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "Detected native architecture ${ARCHITECTURE}.")
set(CMAKE_OSX_ARCHITECTURES "${ARCHITECTURE}")
endif()
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")
set(OSX_DEPLOYMENT_TARGET 10.13)
else()
set(OSX_DEPLOYMENT_TARGET 11.00)
endif()
set(OSX_SYSROOT ${XCODE_DEV_PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk)
# Use same Xcode detection as Blender itself.
include(../cmake/platform/platform_apple_xcode.cmake)
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}")
set(PLATFORM_CFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -arch ${CMAKE_OSX_ARCHITECTURES}")
set(PLATFORM_CXXFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -std=c++17 -stdlib=libc++ -arch ${CMAKE_OSX_ARCHITECTURES}")
set(PLATFORM_LDFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -arch ${CMAKE_OSX_ARCHITECTURES}")
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")
set(PLATFORM_BUILD_TARGET --build=x86_64-apple-darwin17.0.0) # OS X 10.13
else()
@@ -134,16 +139,18 @@ else()
endif()
set(PLATFORM_CMAKE_FLAGS
-DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES}
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${OSX_DEPLOYMENT_TARGET}
-DCMAKE_OSX_SYSROOT:PATH=${OSX_SYSROOT}
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_OSX_SYSROOT:PATH=${CMAKE_OSX_SYSROOT}
)
else()
set(SHAREDLIBEXT ".so")
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_CXXFLAGS "-std=c++17 -fPIC")
set(PLATFORM_LDFLAGS)
set(PLATFORM_BUILD_TARGET)
set(PLATFORM_CMAKE_FLAGS -DCMAKE_INSTALL_LIBDIR=lib)
@@ -169,8 +176,8 @@ else()
set(BLENDER_CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG ${PLATFORM_CXXFLAGS}")
set(CONFIGURE_ENV
export MACOSX_DEPLOYMENT_TARGET=${OSX_DEPLOYMENT_TARGET} &&
export MACOSX_SDK_VERSION=${OSX_DEPLOYMENT_TARGET} &&
export MACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} &&
export MACOSX_SDK_VERSION=${CMAKE_OSX_DEPLOYMENT_TARGET} &&
export CFLAGS=${PLATFORM_CFLAGS} &&
export CXXFLAGS=${PLATFORM_CXXFLAGS} &&
export LDFLAGS=${PLATFORM_LDFLAGS}
@@ -190,6 +197,7 @@ set(DEFAULT_CMAKE_FLAGS
-DCMAKE_CXX_FLAGS_MINSIZEREL=${BLENDER_CMAKE_CXX_FLAGS_MINSIZEREL}
-DCMAKE_CXX_FLAGS_RELEASE=${BLENDER_CMAKE_CXX_FLAGS_RELEASE}
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=${CMAKE_CXX_FLAGS_RELWITHDEBINFO}
-DCMAKE_CXX_STANDARD=17
${PLATFORM_CMAKE_FLAGS}
)
@@ -208,3 +216,11 @@ if(MSVC)
endif()
set(CMAKE_INSTALL_MESSAGE LAZY)
# On windows we sometimes want to build with ninja, but not all projects quite
# yet, so for select project we pass PLATFORM_ALT_GENERATOR as the generator
if(WIN32)
set(PLATFORM_ALT_GENERATOR "Ninja")
else()
set(PLATFORM_ALT_GENERATOR "Unix Makefiles")
endif()

View File

@@ -9,6 +9,7 @@ ExternalProject_Add(external_opus
--disable-shared
--enable-static
--with-pic
--disable-maintainer-mode
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/opus/src/external_opus/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/opus/src/external_opus/ && make install
INSTALL_DIR ${LIBDIR}/opus

View File

@@ -6,7 +6,7 @@ if(WIN32)
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}/jpeg/lib/${LIBPREFIX}jpeg${LIBEXT};${LIBDIR}/tiff/lib/${LIBPREFIX}tiff${LIBEXT};${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf${OPENEXR_VERSION_POSTFIX}${LIBEXT}")
set(OSL_OPENIMAGEIO_LIBRARY "${LIBDIR}/openimageio/lib/OpenImageIO${SHAREDLIBEXT};${LIBDIR}/png/lib/${LIBPREFIX}png16${LIBEXT};${LIBDIR}/jpeg/lib/${LIBPREFIX}jpeg${LIBEXT};${LIBDIR}/tiff/lib/${LIBPREFIX}tiff${LIBEXT};${LIBDIR}/openexr/lib/IlmImf${OPENEXR_VERSION_POSTFIX}${SHAREDLIBEXT}")
endif()
set(OSL_EXTRA_ARGS
@@ -21,7 +21,7 @@ set(OSL_EXTRA_ARGS
${OSL_FLEX_BISON}
-DCMAKE_CXX_STANDARD_LIBRARIES=${OSL_CMAKE_CXX_STANDARD_LIBRARIES}
-DBUILD_SHARED_LIBS=OFF
-DLINKSTATIC=ON
-DLINKSTATIC=OFF
-DOSL_BUILD_PLUGINS=OFF
-DSTOP_ON_WARNING=OFF
-DUSE_LLVM_BITCODE=OFF
@@ -32,14 +32,17 @@ set(OSL_EXTRA_ARGS
-DUSE_Qt5=OFF
-DINSTALL_DOCS=OFF
-Dpugixml_ROOT=${LIBDIR}/pugixml
-DTIFF_ROOT=${LIBDIR}/tiff
-DJPEG_ROOT=${LIBDIR}/jpeg
-DUSE_PYTHON=OFF
-DCMAKE_CXX_STANDARD=14
-DImath_ROOT=${LIBDIR}/imath
-DUSE_OIIO_STATIC=OFF
)
ExternalProject_Add(external_osl
URL file://${PACKAGE_DIR}/${OSL_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
LIST_SEPARATOR ^^
URL_HASH ${OSL_HASH_TYPE}=${OSL_HASH}
PREFIX ${BUILD_DIR}/osl
@@ -81,6 +84,7 @@ if(WIN32)
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/osl/lib/oslcomp.lib ${HARVEST_TARGET}/osl/lib/oslcomp_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/osl/lib/oslexec.lib ${HARVEST_TARGET}/osl/lib/oslexec_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/osl/lib/oslquery.lib ${HARVEST_TARGET}/osl/lib/oslquery_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/osl/lib/oslnoise.lib ${HARVEST_TARGET}/osl/lib/oslnoise_d.lib
DEPENDEES install
)
endif()

View File

@@ -24,6 +24,14 @@ add_dependencies(
external_zlib
)
if(WIN32 AND BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_png after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/png/include/ ${HARVEST_TARGET}/png/include/
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/png/lib/libpng16_static${LIBEXT} ${HARVEST_TARGET}/png/lib/libpng${LIBEXT}
DEPENDEES install
)
endif()
if(WIN32 AND BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_png after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/png/lib/libpng16_staticd${LIBEXT} ${LIBDIR}/png/lib/libpng16${LIBEXT}

View File

@@ -15,8 +15,8 @@ if((WIN32 AND BUILD_MODE STREQUAL Release) OR UNIX)
)
if(WIN32)
ExternalProject_Add_Step(external_potrace after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/potrace ${HARVEST_TARGET}/potrace
DEPENDEES install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/potrace ${HARVEST_TARGET}/potrace
DEPENDEES install
)
endif()
endif()

View File

@@ -2,37 +2,36 @@
if(WIN32)
if(MSVC14) # vs2015 has timespec
set(PTHREAD_CPPFLAGS "/I. /DHAVE_CONFIG_H /D_TIMESPEC_DEFINED ")
else() # everything before doesn't
set(PTHREAD_CPPFLAGS "/I. /DHAVE_CONFIG_H ")
endif()
if(MSVC14) # vs2015 has timespec
set(PTHREAD_CPPFLAGS "/I. /DHAVE_CONFIG_H /D_TIMESPEC_DEFINED ")
else() # everything before doesn't
set(PTHREAD_CPPFLAGS "/I. /DHAVE_CONFIG_H ")
endif()
set(PTHREADS_BUILD cd ${BUILD_DIR}/pthreads/src/external_pthreads/ && cd && nmake VC-static /e CPPFLAGS=${PTHREAD_CPPFLAGS})
set(PTHREADS_BUILD cd ${BUILD_DIR}/pthreads/src/external_pthreads/ && cd && nmake VC-static /e CPPFLAGS=${PTHREAD_CPPFLAGS})
ExternalProject_Add(external_pthreads
URL file://${PACKAGE_DIR}/${PTHREADS_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${PTHREADS_HASH_TYPE}=${PTHREADS_HASH}
PREFIX ${BUILD_DIR}/pthreads
CONFIGURE_COMMAND echo .
PATCH_COMMAND COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/pthreads/src/external_pthreads < ${PATCH_DIR}/pthreads.diff
BUILD_COMMAND ${PTHREADS_BUILD}
INSTALL_COMMAND COMMAND
${CMAKE_COMMAND} -E copy ${BUILD_DIR}/pthreads/src/external_pthreads/libpthreadVC3${LIBEXT} ${LIBDIR}/pthreads/lib/pthreadVC3${LIBEXT} &&
${CMAKE_COMMAND} -E copy ${BUILD_DIR}/pthreads/src/external_pthreads/pthread.h ${LIBDIR}/pthreads/inc/pthread.h &&
${CMAKE_COMMAND} -E copy ${BUILD_DIR}/pthreads/src/external_pthreads/sched.h ${LIBDIR}/pthreads/inc/sched.h &&
${CMAKE_COMMAND} -E copy ${BUILD_DIR}/pthreads/src/external_pthreads/semaphore.h ${LIBDIR}/pthreads/inc/semaphore.h &&
${CMAKE_COMMAND} -E copy ${BUILD_DIR}/pthreads/src/external_pthreads/_ptw32.h ${LIBDIR}/pthreads/inc/_ptw32.h
INSTALL_DIR ${LIBDIR}/pthreads
ExternalProject_Add(external_pthreads
URL file://${PACKAGE_DIR}/${PTHREADS_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${PTHREADS_HASH_TYPE}=${PTHREADS_HASH}
PREFIX ${BUILD_DIR}/pthreads
CONFIGURE_COMMAND echo .
PATCH_COMMAND COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/pthreads/src/external_pthreads < ${PATCH_DIR}/pthreads.diff
BUILD_COMMAND ${PTHREADS_BUILD}
INSTALL_COMMAND COMMAND
${CMAKE_COMMAND} -E copy ${BUILD_DIR}/pthreads/src/external_pthreads/libpthreadVC3${LIBEXT} ${LIBDIR}/pthreads/lib/pthreadVC3${LIBEXT} &&
${CMAKE_COMMAND} -E copy ${BUILD_DIR}/pthreads/src/external_pthreads/pthread.h ${LIBDIR}/pthreads/inc/pthread.h &&
${CMAKE_COMMAND} -E copy ${BUILD_DIR}/pthreads/src/external_pthreads/sched.h ${LIBDIR}/pthreads/inc/sched.h &&
${CMAKE_COMMAND} -E copy ${BUILD_DIR}/pthreads/src/external_pthreads/semaphore.h ${LIBDIR}/pthreads/inc/semaphore.h &&
${CMAKE_COMMAND} -E copy ${BUILD_DIR}/pthreads/src/external_pthreads/_ptw32.h ${LIBDIR}/pthreads/inc/_ptw32.h
INSTALL_DIR ${LIBDIR}/pthreads
)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_pthreads after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/pthreads/inc/ ${HARVEST_TARGET}/pthreads/include/
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/pthreads/lib/ ${HARVEST_TARGET}/pthreads/lib
DEPENDEES install
)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_pthreads after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/pthreads/inc/ ${HARVEST_TARGET}/pthreads/include/
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/pthreads/lib/ ${HARVEST_TARGET}/pthreads/lib
DEPENDEES install
)
endif()
endif()
endif()

View File

@@ -0,0 +1,21 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(PYBIND11_EXTRA_ARGS
-DPYBIND11_TEST=OFF
-DPYTHON_EXECUTABLE=${PYTHON_BINARY}
)
ExternalProject_Add(external_pybind11
URL file://${PACKAGE_DIR}/${PYBIND11_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${PYBIND11_HASH_TYPE}=${PYBIND11_HASH}
PREFIX ${BUILD_DIR}/pybind11
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/pybind11 ${DEFAULT_CMAKE_FLAGS} ${PYBIND11_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/pybind11
)
add_dependencies(
external_pybind11
external_python
)

View File

@@ -15,9 +15,13 @@ if(WIN32)
endmacro()
set(PYTHON_EXTERNALS_FOLDER ${BUILD_DIR}/python/src/external_python/externals)
set(ZLIB_SOURCE_FOLDER ${BUILD_DIR}/zlib/src/external_zlib)
set(SSL_SOURCE_FOLDER ${BUILD_DIR}/ssl/src/external_ssl)
set(DOWNLOADS_EXTERNALS_FOLDER ${DOWNLOAD_DIR}/externals)
cmake_to_dos_path(${PYTHON_EXTERNALS_FOLDER} PYTHON_EXTERNALS_FOLDER_DOS)
cmake_to_dos_path(${ZLIB_SOURCE_FOLDER} ZLIB_SOURCE_FOLDER_DOS)
cmake_to_dos_path(${SSL_SOURCE_FOLDER} SSL_SOURCE_FOLDER_DOS)
cmake_to_dos_path(${DOWNLOADS_EXTERNALS_FOLDER} DOWNLOADS_EXTERNALS_FOLDER_DOS)
ExternalProject_Add(external_python
@@ -25,11 +29,23 @@ if(WIN32)
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${PYTHON_HASH_TYPE}=${PYTHON_HASH}
PREFIX ${BUILD_DIR}/python
CONFIGURE_COMMAND ""
BUILD_COMMAND cd ${BUILD_DIR}/python/src/external_python/pcbuild/ && set IncludeTkinter=false && call build.bat -e -p x64 -c ${BUILD_MODE}
# Python will download its own deps and there's very little we can do about
# that beyond placing some code in their externals dir before it tries.
# the foldernames *HAVE* to match the ones inside pythons get_externals.cmd.
# regardless of the version actually in there.
PATCH_COMMAND mkdir ${PYTHON_EXTERNALS_FOLDER_DOS} &&
mklink /J ${PYTHON_EXTERNALS_FOLDER_DOS}\\zlib-1.2.13 ${ZLIB_SOURCE_FOLDER_DOS} &&
mklink /J ${PYTHON_EXTERNALS_FOLDER_DOS}\\openssl-1.1.1q ${SSL_SOURCE_FOLDER_DOS} &&
${CMAKE_COMMAND} -E copy ${ZLIB_SOURCE_FOLDER}/../external_zlib-build/zconf.h ${PYTHON_EXTERNALS_FOLDER}/zlib-1.2.13/zconf.h &&
${PATCH_CMD} --verbose -p1 -d ${BUILD_DIR}/python/src/external_python < ${PATCH_DIR}/python_windows.diff
CONFIGURE_COMMAND echo "."
BUILD_COMMAND ${CONFIGURE_ENV_MSVC} && cd ${BUILD_DIR}/python/src/external_python/pcbuild/ && set IncludeTkinter=false && set LDFLAGS=/DEBUG && call prepare_ssl.bat && call build.bat -e -p x64 -c ${BUILD_MODE}
INSTALL_COMMAND ${PYTHON_BINARY_INTERNAL} ${PYTHON_SRC}/PC/layout/main.py -b ${PYTHON_SRC}/PCbuild/amd64 -s ${PYTHON_SRC} -t ${PYTHON_SRC}/tmp/ --include-stable --include-pip --include-dev --include-launchers --include-venv --include-symbols ${PYTHON_EXTRA_INSTLAL_FLAGS} --copy ${LIBDIR}/python
)
add_dependencies(
external_python
external_zlib
)
else()
if(APPLE)
# Disable functions that can be in 10.13 sdk but aren't available on 10.9 target.
@@ -57,11 +73,10 @@ else()
set(PYTHON_FUNC_CONFIGS ${PYTHON_FUNC_CONFIGS} && export PYTHON_DECIMAL_WITH_MACHINE=ansi64)
endif()
set(PYTHON_CONFIGURE_ENV ${CONFIGURE_ENV} && ${PYTHON_FUNC_CONFIGS})
set(PYTHON_BINARY ${BUILD_DIR}/python/src/external_python/python.exe)
else()
set(PYTHON_CONFIGURE_ENV ${CONFIGURE_ENV})
set(PYTHON_BINARY ${BUILD_DIR}/python/src/external_python/python)
endif()
set(PYTHON_BINARY ${LIBDIR}/python/bin/python${PYTHON_SHORT_VERSION})
# Link against zlib statically (Unix). Avoid rpath issues (macOS).
set(PYTHON_PATCH ${PATCH_CMD} --verbose -p1 -d ${BUILD_DIR}/python/src/external_python < ${PATCH_DIR}/python_unix.diff)
set(PYTHON_CONFIGURE_EXTRA_ARGS "--with-openssl=${LIBDIR}/ssl")
@@ -73,6 +88,19 @@ else()
export LDFLAGS=${PYTHON_LDFLAGS} &&
export PKG_CONFIG_PATH=${LIBDIR}/ffi/lib/pkgconfig)
# NOTE: untested on APPLE so far.
if(NOT APPLE)
set(PYTHON_CONFIGURE_EXTRA_ARGS
${PYTHON_CONFIGURE_EXTRA_ARGS}
# Used on most release Linux builds (Fedora for e.g.),
# increases build times noticeably with the benefit of a modest speedup at runtime.
--enable-optimizations
# While LTO is OK when building on the same system, it's incompatible across GCC versions,
# making it impractical for developers to build against, so keep it disabled.
# `--with-lto`
)
endif()
ExternalProject_Add(external_python
URL file://${PACKAGE_DIR}/${PYTHON_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
@@ -85,14 +113,31 @@ else()
INSTALL_DIR ${LIBDIR}/python)
endif()
add_dependencies(
external_python
external_ssl
external_zlib
)
if(UNIX)
add_dependencies(
external_python
external_bzip2
external_ffi
external_lzma
external_ssl
external_sqlite
external_zlib
)
endif()
if(WIN32)
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_python after_install
# Boost can't keep it self from linking release python
# in a debug configuration even if all options are set
# correctly to instruct it to use the debug version
# of python. So just copy the debug imports file over
# and call it a day...
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/python/libs/python${PYTHON_SHORT_VERSION_NO_DOTS}${PYTHON_POSTFIX}.lib ${LIBDIR}/python/libs/python${PYTHON_SHORT_VERSION_NO_DOTS}.lib
DEPENDEES install
)
endif()
endif()

View File

@@ -5,7 +5,11 @@ if(WIN32 AND BUILD_MODE STREQUAL 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)
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()
@@ -15,17 +19,24 @@ ExternalProject_Add(external_python_site_packages
CONFIGURE_COMMAND ${PIP_CONFIGURE_COMMAND}
BUILD_COMMAND ""
PREFIX ${BUILD_DIR}/site_packages
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} autopep8==${AUTOPEP8_VERSION} pycodestyle==${PYCODESTYLE_VERSION} toml==${TOML_VERSION} --no-binary :all:
)
if(USE_PIP_NUMPY)
# Use only wheel (and not build from source) to stop NumPy from linking against buggy
# Accelerate framework backend on macOS. Official wheels are built with OpenBLAS.
ExternalProject_Add_Step(external_python_site_packages after_install
COMMAND ${PYTHON_BINARY} -m pip install --no-cache-dir numpy==${NUMPY_VERSION} --only-binary :all:
DEPENDEES install
)
endif()
# setuptools is downgraded to 63.2.0 (same as python 3.10.8) since numpy 1.23.x seemingly has
# issues building on windows with the newer versions that ships with python 3.10.9+
INSTALL_COMMAND ${PYTHON_BINARY} -m pip install --no-cache-dir ${SITE_PACKAGES_EXTRA}
setuptools==63.2.0
cython==${CYTHON_VERSION}
idna==${IDNA_VERSION}
charset-normalizer==${CHARSET_NORMALIZER_VERSION}
urllib3==${URLLIB3_VERSION}
certifi==${CERTIFI_VERSION}
requests==${REQUESTS_VERSION}
zstandard==${ZSTANDARD_VERSION}
autopep8==${AUTOPEP8_VERSION}
pycodestyle==${PYCODESTYLE_VERSION}
toml==${TOML_VERSION}
meson==${MESON_VERSION}
--no-binary :all:
)
add_dependencies(
external_python_site_packages

View File

@@ -1,10 +1,10 @@
# SPDX-License-Identifier: GPL-2.0-or-later
####################################################################################################################
##################################################################################################
# Mingw64 Builds
####################################################################################################################
##################################################################################################
# This installs mingw64+msys to compile ffmpeg/iconv/libsndfile/fftw3
####################################################################################################################
##################################################################################################
message("LIBDIR = ${LIBDIR}")
macro(cmake_to_msys_path MsysPath ResultingPath)

View File

@@ -0,0 +1,47 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(SHADERC_EXTRA_ARGS
-DSHADERC_SKIP_TESTS=On
-DSHADERC_SPIRV_TOOLS_DIR=${BUILD_DIR}/shaderc_spirv_tools/src/external_shaderc_spirv_tools
-DSHADERC_SPIRV_HEADERS_DIR=${BUILD_DIR}/shaderc_spirv_headers/src/external_shaderc_spirv_headers
-DSHADERC_GLSLANG_DIR=${BUILD_DIR}/shaderc_glslang/src/external_shaderc_glslang
-DCMAKE_DEBUG_POSTFIX=_d
-DPYTHON_EXECUTABLE=${PYTHON_BINARY}
)
ExternalProject_Add(external_shaderc
URL file://${PACKAGE_DIR}/${SHADERC_FILE}
URL_HASH ${SHADERC_HASH_TYPE}=${SHADERC_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/shaderc
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/shaderc ${DEFAULT_CMAKE_FLAGS} ${SHADERC_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/shaderc
)
add_dependencies(
external_shaderc
external_shaderc_spirv_tools
external_shaderc_spirv_headers
external_shaderc_glslang
external_python
)
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_shaderc after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/shaderc/include ${HARVEST_TARGET}/shaderc/include
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/shaderc/bin/shaderc_shared.dll ${HARVEST_TARGET}/shaderc/bin/shaderc_shared.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/shaderc/lib/shaderc_shared.lib ${HARVEST_TARGET}/shaderc/lib/shaderc_shared.lib
DEPENDEES install
)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_shaderc after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/shaderc/bin/shaderc_shared_d.dll ${HARVEST_TARGET}/shaderc/bin/shaderc_shared_d.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/shaderc/lib/shaderc_shared_d.lib ${HARVEST_TARGET}/shaderc/lib/shaderc_shared_d.lib
DEPENDEES install
)
endif()
endif()

View File

@@ -0,0 +1,34 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# These are build time requirements for shaderc. We only have to unpack these
# shaderc will build them.
ExternalProject_Add(external_shaderc_glslang
URL file://${PACKAGE_DIR}/${SHADERC_GLSLANG_FILE}
URL_HASH ${SHADERC_GLSLANG_HASH_TYPE}=${SHADERC_GLSLANG_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/shaderc_glslang
CONFIGURE_COMMAND echo .
BUILD_COMMAND echo .
INSTALL_COMMAND echo .
)
ExternalProject_Add(external_shaderc_spirv_headers
URL file://${PACKAGE_DIR}/${SHADERC_SPIRV_HEADERS_FILE}
URL_HASH ${SHADERC_SPIRV_HEADERS_HASH_TYPE}=${SHADERC_SPIRV_HEADERS_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/shaderc_spirv_headers
CONFIGURE_COMMAND echo .
BUILD_COMMAND echo .
INSTALL_COMMAND echo .
)
ExternalProject_Add(external_shaderc_spirv_tools
URL file://${PACKAGE_DIR}/${SHADERC_SPIRV_TOOLS_FILE}
URL_HASH ${SHADERC_SPIRV_TOOLS_HASH_TYPE}=${SHADERC_SPIRV_TOOLS_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/shaderc_spirv_tools
CONFIGURE_COMMAND echo .
BUILD_COMMAND echo .
INSTALL_COMMAND echo .
)

View File

@@ -1,9 +1,15 @@
# 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})
set(SNDFILE_ENV)
if(WIN32)
set(SNDFILE_ENV "PKG_CONFIG_PATH=\
${mingw_LIBDIR}/ogg/lib/pkgconfig:\
${mingw_LIBDIR}/vorbis/lib/pkgconfig:\
${mingw_LIBDIR}/flac/lib/pkgconfig:\
${mingw_LIBDIR}/opus/lib/pkgconfig"
)
set(SNDFILE_ENV set ${SNDFILE_ENV} &&)
# Shared for windows because static libs will drag in a libgcc dependency.
set(SNDFILE_OPTIONS --disable-static --enable-shared )
@@ -11,18 +17,11 @@ else()
set(SNDFILE_OPTIONS --enable-static --disable-shared )
endif()
if(UNIX)
set(SNDFILE_PATCH_CMD ${PATCH_CMD} --verbose -p 0 -d ${BUILD_DIR}/sndfile/src/external_sndfile < ${PATCH_DIR}/sndfile.diff)
else()
set(SNDFILE_PATCH_CMD)
endif()
ExternalProject_Add(external_sndfile
URL file://${PACKAGE_DIR}/${SNDFILE_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${SNDFILE_HASH_TYPE}=${SNDFILE_HASH}
PREFIX ${BUILD_DIR}/sndfile
PATCH_COMMAND ${SNDFILE_PATCH_CMD}
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/sndfile/src/external_sndfile/ && ${SNDFILE_ENV} ${CONFIGURE_COMMAND} ${SNDFILE_OPTIONS} --prefix=${mingw_LIBDIR}/sndfile
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/sndfile/src/external_sndfile/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/sndfile/src/external_sndfile/ && make install
@@ -37,6 +36,7 @@ add_dependencies(
external_sndfile
external_ogg
external_vorbis
external_opus
)
if(UNIX)
add_dependencies(
@@ -47,10 +47,10 @@ endif()
if(BUILD_MODE STREQUAL Release AND WIN32)
ExternalProject_Add_Step(external_sndfile after_install
COMMAND lib /def:${BUILD_DIR}/sndfile/src/external_sndfile/src/libsndfile-1.def /machine:x64 /out:${BUILD_DIR}/sndfile/src/external_sndfile/src/libsndfile-1.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/sndfile/bin/libsndfile-1.dll ${HARVEST_TARGET}/sndfile/lib/libsndfile-1.dll
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/sndfile/src/external_sndfile/src/libsndfile-1.lib ${HARVEST_TARGET}/sndfile/lib/libsndfile-1.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/sndfile/include/sndfile.h ${HARVEST_TARGET}/sndfile/include/sndfile.h
COMMAND lib /def:${BUILD_DIR}/sndfile/src/external_sndfile/src/libsndfile-1.def /machine:x64 /out:${BUILD_DIR}/sndfile/src/external_sndfile/src/libsndfile-1.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/sndfile/bin/libsndfile-1.dll ${HARVEST_TARGET}/sndfile/lib/libsndfile-1.dll
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/sndfile/src/external_sndfile/src/libsndfile-1.lib ${HARVEST_TARGET}/sndfile/lib/libsndfile-1.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/sndfile/include/sndfile.h ${HARVEST_TARGET}/sndfile/include/sndfile.h
DEPENDEES install
)

View File

@@ -5,7 +5,20 @@ ExternalProject_Add(external_spnav
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${SPNAV_HASH_TYPE}=${SPNAV_HASH}
PREFIX ${BUILD_DIR}/spnav
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/spnav/src/external_spnav/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/spnav --disable-shared --enable-static --with-pic
CONFIGURE_COMMAND
${CONFIGURE_ENV} &&
cd ${BUILD_DIR}/spnav/src/external_spnav/ &&
${CONFIGURE_COMMAND}
--prefix=${LIBDIR}/spnav
# X11 is not needed as Blender polls the device as part of the GHOST event loop.
# This is used to support `3dxserv`, however this is no longer supported by 3DCONNEXION.
# Disable so building without X11 is supported (WAYLAND only).
--disable-x11
--disable-shared
--enable-static
--with-pic
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/spnav/src/external_spnav/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/spnav/src/external_spnav/ && make install
INSTALL_DIR ${LIBDIR}/spnav

View File

@@ -48,7 +48,6 @@ ExternalProject_Add(external_sqlite
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${SQLITE_HASH_TYPE}=${SQLITE_HASH}
PREFIX ${BUILD_DIR}/sqlite
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/sqlite/src/external_sqlite < ${PATCH_DIR}/sqlite.diff
CONFIGURE_COMMAND ${SQLITE_CONFIGURE_ENV} && cd ${BUILD_DIR}/sqlite/src/external_sqlite/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/sqlite ${SQLITE_CONFIGURATION_ARGS}
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/sqlite/src/external_sqlite/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/sqlite/src/external_sqlite/ && make install

View File

@@ -1,9 +1,9 @@
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_sse2neon
GIT_REPOSITORY ${SSE2NEON_GIT}
GIT_TAG ${SSE2NEON_GIT_HASH}
URL file://${PACKAGE_DIR}/${SSE2NEON_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${SSE2NEON_HASH_TYPE}=${SSE2NEON_HASH}
PREFIX ${BUILD_DIR}/sse2neon
CONFIGURE_COMMAND echo sse2neon - Nothing to configure
BUILD_COMMAND echo sse2neon - nothing to build

View File

@@ -3,32 +3,47 @@
set(SSL_CONFIGURE_COMMAND ./Configure)
set(SSL_PATCH_CMD echo .)
if(APPLE)
set(SSL_OS_COMPILER "blender-darwin-${CMAKE_OSX_ARCHITECTURES}")
if(WIN32)
# Python will build this with its preferred build options and patches. We only need to unpack openssl
ExternalProject_Add(external_ssl
URL file://${PACKAGE_DIR}/${SSL_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${SSL_HASH_TYPE}=${SSL_HASH}
PREFIX ${BUILD_DIR}/ssl
CONFIGURE_COMMAND echo "."
BUILD_COMMAND echo "."
INSTALL_COMMAND echo "."
INSTALL_DIR ${LIBDIR}/ssl
)
else()
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")
if(APPLE)
set(SSL_OS_COMPILER "blender-darwin-${CMAKE_OSX_ARCHITECTURES}")
set(SSL_PATCH_CMD ${PATCH_CMD} --verbose -p 0 -d ${BUILD_DIR}/ssl/src/external_ssl < ${PATCH_DIR}/ssl.diff)
else()
set(SSL_OS_COMPILER "blender-linux-x86")
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()
set(SSL_OS_COMPILER "blender-linux-x86")
endif()
endif()
endif()
ExternalProject_Add(external_ssl
URL file://${PACKAGE_DIR}/${SSL_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${SSL_HASH_TYPE}=${SSL_HASH}
PREFIX ${BUILD_DIR}/ssl
PATCH_COMMAND ${SSL_PATCH_CMD}
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ssl/src/external_ssl/ && ${SSL_CONFIGURE_COMMAND} --prefix=${LIBDIR}/ssl
--openssldir=${LIBDIR}/ssl
no-shared
no-idea no-mdc2 no-rc5 no-zlib no-ssl3 enable-unit-test no-ssl3-method enable-rfc3779 enable-cms
--config=${CMAKE_CURRENT_SOURCE_DIR}/cmake/ssl.conf
${SSL_OS_COMPILER}
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ssl/src/external_ssl/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ssl/src/external_ssl/ && make install
INSTALL_DIR ${LIBDIR}/ssl
)
ExternalProject_Add(external_ssl
URL file://${PACKAGE_DIR}/${SSL_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${SSL_HASH_TYPE}=${SSL_HASH}
PREFIX ${BUILD_DIR}/ssl
PATCH_COMMAND ${SSL_PATCH_CMD}
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ssl/src/external_ssl/ && ${SSL_CONFIGURE_COMMAND} --prefix=${LIBDIR}/ssl
--openssldir=${LIBDIR}/ssl
no-shared
no-idea no-mdc2 no-rc5 no-zlib no-ssl3 enable-unit-test no-ssl3-method enable-rfc3779 enable-cms
--config=${CMAKE_CURRENT_SOURCE_DIR}/cmake/ssl.conf
${SSL_OS_COMPILER}
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ssl/src/external_ssl/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ssl/src/external_ssl/ && make install
INSTALL_DIR ${LIBDIR}/ssl
)
endif()

View File

@@ -1,26 +1,14 @@
# 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)
else()
set(TBB_EXTRA_ARGS
-DTBB_BUILD_SHARED=Off
-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)
endif()
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)
# CMake script for TBB from https://github.com/wjakob/tbb/blob/master/CMakeLists.txt
ExternalProject_Add(external_tbb

View File

@@ -3,6 +3,8 @@
set(TIFF_EXTRA_ARGS
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include
-DJPEG_LIBRARY=${LIBDIR}/jpeg/lib/${JPEG_LIBRARY}
-DJPEG_INCLUDE_DIR=${LIBDIR}/jpeg/include
-DPNG_STATIC=ON
-DBUILD_SHARED_LIBS=OFF
-Dlzma=OFF
@@ -23,11 +25,14 @@ ExternalProject_Add(external_tiff
add_dependencies(
external_tiff
external_zlib
external_jpeg
)
if(WIN32 AND BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_tiff after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tiff/lib/tiffd${LIBEXT} ${LIBDIR}/tiff/lib/tiff${LIBEXT}
DEPENDEES install
)
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_tiff after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tiff/lib/tiff.lib ${HARVEST_TARGET}/tiff/lib/libtiff.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/tiff/include/ ${HARVEST_TARGET}/tiff/include/
DEPENDEES install
)
endif()
endif()

View File

@@ -7,32 +7,57 @@ if(WIN32)
# USD does not look for debug libs, nor does it link them
# when building static, so this is just to keep find_package happy
# if we ever link dynamically on windows util will need to be linked as well.
set(USD_OIIO_CMAKE_DEFINES "-DOIIO_LIBRARIES=${LIBDIR}/openimageio/lib/OpenImageIO_d${LIBEXT}")
set(USD_OIIO_CMAKE_DEFINES "-DOIIO_LIBRARIES=${LIBDIR}/openimageio/lib/OpenImageIO_d${LIBEXT}^^${LIBDIR}/openimageio/lib/OpenImageIO_util_d${LIBEXT}")
endif()
set(USD_PLATFORM_FLAGS
${USD_OIIO_CMAKE_DEFINES}
-DCMAKE_CXX_FLAGS=${USD_CXX_FLAGS}
-D_PXR_CXX_DEFINITIONS=/DBOOST_ALL_NO_LIB
-DCMAKE_SHARED_LINKER_FLAGS_INIT=/LIBPATH:${LIBDIR}/tbb/lib
-DPython_FIND_REGISTRY=NEVER
-DPYTHON_INCLUDE_DIRS=${LIBDIR}/python/include
-DPYTHON_LIBRARY=${LIBDIR}/python/libs/python${PYTHON_SHORT_VERSION_NO_DOTS}${PYTHON_POSTFIX}${LIBEXT}
)
if(BUILD_MODE STREQUAL Debug)
list(APPEND USD_PLATFORM_FLAGS -DPXR_USE_DEBUG_PYTHON=ON)
list(APPEND USD_PLATFORM_FLAGS -DOPENVDB_LIBRARY=${LIBDIR}/openvdb/lib/openvdb_d.lib)
endif()
elseif(UNIX)
# Workaround USD not linking correctly with static Python library, where it would embed
# part of the interpret in the USD library. Allow undefined Python symbols and replace
# Python library with TBB so it doesn't complain about missing library.
set(USD_PLATFORM_FLAGS
-DPYTHON_INCLUDE_DIR=${LIBDIR}/python/include/python${PYTHON_SHORT_VERSION}/
-DPYTHON_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${SHAREDLIBEXT}
)
if(APPLE)
set(USD_SHARED_LINKER_FLAGS "-Xlinker -undefined -Xlinker dynamic_lookup")
list(APPEND USD_PLATFORM_FLAGS
-DCMAKE_SHARED_LINKER_FLAGS=${USD_SHARED_LINKER_FLAGS}
)
endif()
endif()
set(USD_EXTRA_ARGS
${DEFAULT_BOOST_FLAGS}
${USD_PLATFORM_FLAGS}
# This is a preventative measure that avoids possible conflicts when add-ons
# try to load another USD library into the same process space.
-DPXR_SET_INTERNAL_NAMESPACE=usdBlender
-DOPENSUBDIV_ROOT_DIR=${LIBDIR}/opensubdiv
-DOpenImageIO_ROOT=${LIBDIR}/openimageio
-DOPENEXR_LIBRARIES=${LIBDIR}/imath/lib/imath${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_LIBRARIES=${LIBDIR}/imath/lib/${LIBPREFIX}Imath${OPENEXR_VERSION_POSTFIX}${SHAREDLIBEXT}
-DOPENEXR_INCLUDE_DIR=${LIBDIR}/imath/include
-DPXR_ENABLE_PYTHON_SUPPORT=OFF
-DImath_DIR=${LIBDIR}/imath
-DOPENVDB_LOCATION=${LIBDIR}/openvdb
-DPXR_ENABLE_PYTHON_SUPPORT=ON
-DPXR_USE_PYTHON_3=ON
-DPXR_BUILD_IMAGING=ON
-DPXR_BUILD_TESTS=OFF
-DPXR_BUILD_EXAMPLES=OFF
-DPXR_BUILD_TUTORIALS=OFF
-DPXR_BUILD_USDVIEW=OFF
-DPXR_ENABLE_HDF5_SUPPORT=OFF
-DPXR_ENABLE_MATERIALX_SUPPORT=OFF
-DPXR_ENABLE_OPENVDB_SUPPORT=OFF
-DPXR_ENABLE_OPENVDB_SUPPORT=ON
-DPYTHON_EXECUTABLE=${PYTHON_BINARY}
-DPXR_BUILD_MONOLITHIC=ON
# OSL is an optional dependency of the Imaging module. However, since that
@@ -40,40 +65,36 @@ set(USD_EXTRA_ARGS
# cube, etc.) to geometry, it's not necessary. Disabling it will make it
# simpler to build Blender; currently only Cycles uses OSL.
-DPXR_ENABLE_OSL_SUPPORT=OFF
# GL support on Linux also links to X11 libraries. Enabling it would break
# headless or Wayland-only builds. OpenGL support would be useful if someone
# wants to work on a Hydra viewport in Blender; when that's actually being
# worked on, we could patch in a new PXR_ENABLE_X11_SUPPORT option (to
# separate OpenGL from X11) and contribute it upstream.
-DPXR_ENABLE_GL_SUPPORT=OFF
# Disable Metal since USD fails to build this when OpenGL is disabled.
-DPXR_ENABLE_METAL_SUPPORT=OFF
# OIIO is used for loading image textures in Hydra Storm / Embree renderers,
# which we don't use.
-DPXR_BUILD_OPENIMAGEIO_PLUGIN=OFF
# Enable OpenGL for Hydra support. Note that this indirectly also adds an X11
# dependency on Linux. This would be good to eliminate for headless and Wayland
# only builds, however is not worse than what Blender already links to for
# official releases currently.
-DPXR_ENABLE_GL_SUPPORT=ON
# OIIO is used for loading image textures in Hydra Storm / Embree renderers.
-DPXR_BUILD_OPENIMAGEIO_PLUGIN=ON
# USD 22.03 does not support OCIO 2.x
# Tracking ticket https://github.com/PixarAnimationStudios/USD/issues/1386
-DPXR_BUILD_OPENCOLORIO_PLUGIN=OFF
-DPXR_ENABLE_PTEX_SUPPORT=OFF
-DPXR_BUILD_USD_TOOLS=OFF
-DCMAKE_DEBUG_POSTFIX=_d
-DBUILD_SHARED_LIBS=Off
# USD is hellbound on making a shared lib, unless you point this variable to a valid cmake file
# doesn't have to make sense, but as long as it points somewhere valid it will skip the shared lib.
-DPXR_MONOLITHIC_IMPORT=${BUILD_DIR}/usd/src/external_usd/cmake/defaults/Version.cmake
-DBUILD_SHARED_LIBS=ON
-DTBB_INCLUDE_DIRS=${LIBDIR}/tbb/include
-DTBB_LIBRARIES=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}
-DTbb_TBB_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}
-DTBB_LIBRARIES=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${SHAREDLIBEXT}
-DTbb_TBB_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${SHAREDLIBEXT}
-DTBB_tbb_LIBRARY_RELEASE=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${SHAREDLIBEXT}
# USD wants the tbb debug lib set even when you are doing a release build
# Otherwise it will error out during the cmake configure phase.
-DTBB_LIBRARIES_DEBUG=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}
-DTBB_LIBRARIES_DEBUG=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${SHAREDLIBEXT}
)
ExternalProject_Add(external_usd
URL file://${PACKAGE_DIR}/${USD_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${USD_HASH_TYPE}=${USD_HASH}
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
PREFIX ${BUILD_DIR}/usd
LIST_SEPARATOR ^^
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/usd/src/external_usd < ${PATCH_DIR}/usd.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/usd -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${USD_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/usd
@@ -84,12 +105,15 @@ add_dependencies(
external_tbb
external_boost
external_opensubdiv
external_python
external_openimageio
openvdb
)
# 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(NOT WIN32)
if (USD_VERSION VERSION_LESS 21.11)
if(USD_VERSION VERSION_LESS 21.11)
set(PXR_LIB_PREFIX "")
else()
set(PXR_LIB_PREFIX "usd_")
@@ -99,27 +123,16 @@ endif()
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_usd_m.lib ${HARVEST_TARGET}/usd/lib/usd_usd_m.lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/usd ${HARVEST_TARGET}/usd
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_usd_m_d.lib ${HARVEST_TARGET}/usd/lib/usd_usd_m_d.lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/usd/lib/python ${HARVEST_TARGET}/usd/lib/debug/python
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/usd/lib/usd_ms_d.dll ${HARVEST_TARGET}/usd/lib/usd_ms_d.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/usd/lib/usd_ms_d.lib ${HARVEST_TARGET}/usd/lib/usd_ms_d.lib
DEPENDEES install
)
endif()
else()
# USD has two build options. The default build creates lots of small libraries,
# whereas the 'monolithic' build produces only a single library. The latter
# makes linking simpler, so that's what we use in Blender. However, running
# 'make install' in the USD sources doesn't install the static library in that
# 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/lib${PXR_LIB_PREFIX}usd_m.a ${HARVEST_TARGET}/usd/lib/lib${PXR_LIB_PREFIX}usd_m.a
DEPENDEES install
)
endif()

View File

@@ -1,10 +1,19 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(ZLIB_VERSION 1.2.12)
# CPE's are used to identify dependencies, for more information on what they
# are please see https://nvd.nist.gov/products/cpe
#
# We use them in combination with cve-bin-tool to scan for known security issues.
#
# Not all of our dependencies are currently in the nvd database so not all
# dependencies have one assigned.
set(ZLIB_VERSION 1.2.13)
set(ZLIB_URI https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz)
set(ZLIB_HASH 5fc414a9726be31427b440b434d05f78)
set(ZLIB_HASH 9b8aa094c4e5765dabf4da391f00d15c)
set(ZLIB_HASH_TYPE MD5)
set(ZLIB_FILE zlib-${ZLIB_VERSION}.tar.gz)
set(ZLIB_CPE "cpe:2.3:a:zlib:zlib:${ZLIB_VERSION}:*:*:*:*:*:*:*")
set(OPENAL_VERSION 1.21.1)
set(OPENAL_URI http://openal-soft.org/openal-releases/openal-soft-${OPENAL_VERSION}.tar.bz2)
@@ -17,27 +26,31 @@ set(PNG_URI http://prdownloads.sourceforge.net/libpng/libpng-${PNG_VERSION}.tar.
set(PNG_HASH 505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca)
set(PNG_HASH_TYPE SHA256)
set(PNG_FILE libpng-${PNG_VERSION}.tar.xz)
set(PNG_CPE "cpe:2.3:a:libpng:libpng:${PNG_VERSION}:*:*:*:*:*:*:*")
set(JPEG_VERSION 2.1.3)
set(JPEG_URI https://github.com/libjpeg-turbo/libjpeg-turbo/archive/${JPEG_VERSION}.tar.gz)
set(JPEG_HASH 627b980fad0573e08e4c3b80b290fc91)
set(JPEG_HASH_TYPE MD5)
set(JPEG_FILE libjpeg-turbo-${JPEG_VERSION}.tar.gz)
set(JPEG_CPE "cpe:2.3:a:d.r.commander:libjpeg-turbo:${JPEG_VERSION}:*:*:*:*:*:*:*")
set(BOOST_VERSION 1.78.0)
set(BOOST_VERSION_SHORT 1.78)
set(BOOST_VERSION_NODOTS 1_78_0)
set(BOOST_VERSION_NODOTS_SHORT 1_78)
set(BOOST_VERSION 1.80.0)
set(BOOST_VERSION_SHORT 1.80)
set(BOOST_VERSION_NODOTS 1_80_0)
set(BOOST_VERSION_NODOTS_SHORT 1_80)
set(BOOST_URI https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION_NODOTS}.tar.gz)
set(BOOST_HASH c2f6428ac52b0e5a3c9b2e1d8cc832b5)
set(BOOST_HASH 077f074743ea7b0cb49c6ed43953ae95)
set(BOOST_HASH_TYPE MD5)
set(BOOST_FILE boost_${BOOST_VERSION_NODOTS}.tar.gz)
set(BOOST_CPE "cpe:2.3:a:boost:boost:${BOOST_VERSION}:*:*:*:*:*:*:*")
set(BLOSC_VERSION 1.21.1)
set(BLOSC_URI https://github.com/Blosc/c-blosc/archive/v${BLOSC_VERSION}.tar.gz)
set(BLOSC_HASH 134b55813b1dca57019d2a2dc1f7a923)
set(BLOSC_HASH_TYPE MD5)
set(BLOSC_FILE blosc-${BLOSC_VERSION}.tar.gz)
set(BLOSC_CPE "cpe:2.3:a:c-blosc2_project:c-blosc2:${BLOSC_VERSION}:*:*:*:*:*:*:*")
set(PTHREADS_VERSION 3.0.0)
set(PTHREADS_URI http://prdownloads.sourceforge.net/pthreads4w/pthreads4w-code-v${PTHREADS_VERSION}.zip)
@@ -45,15 +58,16 @@ set(PTHREADS_HASH f3bf81bb395840b3446197bcf4ecd653)
set(PTHREADS_HASH_TYPE MD5)
set(PTHREADS_FILE pthreads4w-code-${PTHREADS_VERSION}.zip)
set(OPENEXR_VERSION 3.1.4)
set(OPENEXR_VERSION 3.1.5)
set(OPENEXR_URI https://github.com/AcademySoftwareFoundation/openexr/archive/v${OPENEXR_VERSION}.tar.gz)
set(OPENEXR_HASH e990be1ff765797bc2d93a8060e1c1f2)
set(OPENEXR_HASH a92f38eedd43e56c0af56d4852506886)
set(OPENEXR_HASH_TYPE MD5)
set(OPENEXR_FILE openexr-${OPENEXR_VERSION}.tar.gz)
set(OPENEXR_CPE "cpe:2.3:a:openexr:openexr:${OPENEXR_VERSION}:*:*:*:*:*:*:*")
set(IMATH_VERSION 3.1.4)
set(IMATH_VERSION 3.1.5)
set(IMATH_URI https://github.com/AcademySoftwareFoundation/Imath/archive/v${OPENEXR_VERSION}.tar.gz)
set(IMATH_HASH fddf14ec73e12c34e74c3c175e311a3f)
set(IMATH_HASH dd375574276c54872b7b3d54053baff0)
set(IMATH_HASH_TYPE MD5)
set(IMATH_FILE imath-${IMATH_VERSION}.tar.gz)
@@ -63,28 +77,29 @@ if(WIN32)
# we need to tell the build the postfix is _s while
# telling all other deps the postfix is _s_d
if(BUILD_MODE STREQUAL Release)
set(OPENEXR_VERSION_POSTFIX _s)
set(OPENEXR_VERSION_BUILD_POSTFIX _s)
set(OPENEXR_VERSION_POSTFIX )
set(OPENEXR_VERSION_BUILD_POSTFIX )
else()
set(OPENEXR_VERSION_POSTFIX _s_d)
set(OPENEXR_VERSION_BUILD_POSTFIX _s)
set(OPENEXR_VERSION_POSTFIX _d)
set(OPENEXR_VERSION_BUILD_POSTFIX )
endif()
else()
set(OPENEXR_VERSION_BUILD_POSTFIX)
set(OPENEXR_VERSION_POSTFIX)
endif()
set(FREETYPE_VERSION 2.11.1)
set(FREETYPE_VERSION 2.12.1)
set(FREETYPE_URI http://prdownloads.sourceforge.net/freetype/freetype-${FREETYPE_VERSION}.tar.gz)
set(FREETYPE_HASH bd4e3b007474319909a6b79d50908e85)
set(FREETYPE_HASH 8bc5c9c9df7ac12c504f8918552a7cf2)
set(FREETYPE_HASH_TYPE MD5)
set(FREETYPE_FILE freetype-${FREETYPE_VERSION}.tar.gz)
SET(FREETYPE_CPE "cpe:2.3:a:freetype:freetype:${FREETYPE_VERSION}:*:*:*:*:*:*:*")
set(GLEW_VERSION 1.13.0)
set(GLEW_URI http://prdownloads.sourceforge.net/glew/glew/${GLEW_VERSION}/glew-${GLEW_VERSION}.tgz)
set(GLEW_HASH 7cbada3166d2aadfc4169c4283701066)
set(GLEW_HASH_TYPE MD5)
set(GLEW_FILE glew-${GLEW_VERSION}.tgz)
set(EPOXY_VERSION 1.5.10)
set(EPOXY_URI https://github.com/anholt/libepoxy/archive/refs/tags/${EPOXY_VERSION}.tar.gz)
set(EPOXY_HASH f0730aad115c952e77591fcc805b1dc1)
set(EPOXY_HASH_TYPE MD5)
set(EPOXY_FILE libepoxy-${EPOXY_VERSION}.tar.gz)
set(FREEGLUT_VERSION 3.0.0)
set(FREEGLUT_URI http://prdownloads.sourceforge.net/freeglut/freeglut/${FREEGLUT_VERSION}/freeglut-${FREEGLUT_VERSION}.tar.gz)
@@ -97,10 +112,11 @@ set(ALEMBIC_URI https://github.com/alembic/alembic/archive/${ALEMBIC_VERSION}.ta
set(ALEMBIC_HASH 2cd8d6e5a3ac4a014e24a4b04f4fadf9)
set(ALEMBIC_HASH_TYPE MD5)
set(ALEMBIC_FILE alembic-${ALEMBIC_VERSION}.tar.gz)
SET(FREETYPE_CPE "cpe:2.3:a:freetype:freetype:${FREETYPE_VERSION}:*:*:*:*:*:*:*")
set(OPENSUBDIV_VERSION v3_4_4)
set(OPENSUBDIV_VERSION v3_5_0)
set(OPENSUBDIV_URI https://github.com/PixarAnimationStudios/OpenSubdiv/archive/${OPENSUBDIV_VERSION}.tar.gz)
set(OPENSUBDIV_HASH 39ecc5caf0abebc943d1ce131855e76e)
set(OPENSUBDIV_HASH 230f5cd2911d6240e58a3773b9c6e5e4)
set(OPENSUBDIV_HASH_TYPE MD5)
set(OPENSUBDIV_FILE opensubdiv-${OPENSUBDIV_VERSION}.tar.gz)
@@ -109,6 +125,7 @@ set(SDL_URI https://www.libsdl.org/release/SDL2-${SDL_VERSION}.tar.gz)
set(SDL_HASH a53acc02e1cca98c4123229069b67c9e)
set(SDL_HASH_TYPE MD5)
set(SDL_FILE SDL2-${SDL_VERSION}.tar.gz)
set(SDL_CPE "cpe:2.3:a:libsdl:sdl:${SDL_VERSION}:*:*:*:*:*:*:*")
set(OPENCOLLADA_VERSION v1.6.68)
set(OPENCOLLADA_URI https://github.com/KhronosGroup/OpenCOLLADA/archive/${OPENCOLLADA_VERSION}.tar.gz)
@@ -116,17 +133,24 @@ set(OPENCOLLADA_HASH ee7dae874019fea7be11613d07567493)
set(OPENCOLLADA_HASH_TYPE MD5)
set(OPENCOLLADA_FILE opencollada-${OPENCOLLADA_VERSION}.tar.gz)
set(OPENCOLORIO_VERSION 2.1.1)
set(OPENCOLORIO_VERSION 2.2.0)
set(OPENCOLORIO_URI https://github.com/AcademySoftwareFoundation/OpenColorIO/archive/v${OPENCOLORIO_VERSION}.tar.gz)
set(OPENCOLORIO_HASH 604f562e073f23d88ce89ed4f7f709ba)
set(OPENCOLORIO_HASH d58a5980adba2d89a363100a09daa5f3)
set(OPENCOLORIO_HASH_TYPE MD5)
set(OPENCOLORIO_FILE OpenColorIO-${OPENCOLORIO_VERSION}.tar.gz)
set(MINIZIPNG_VERSION 3.0.7)
set(MINIZIPNG_URI https://github.com/zlib-ng/minizip-ng/archive/${MINIZIPNG_VERSION}.tar.gz)
set(MINIZIPNG_HASH 09dcc8a9def348e1be9659e384c2cd55)
set(MINIZIPNG_HASH_TYPE MD5)
set(MINIZIPNG_FILE minizip-ng-${MINIZIPNG_VERSION}.tar.gz)
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)
set(LLVM_CPE "cpe:2.3:a:llvm:compiler:${LLVM_VERSION}:*:*:*:*:*:*:*")
if(APPLE)
# Cloth physics test is crashing due to this bug:
@@ -141,21 +165,22 @@ set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${
set(OPENMP_HASH_TYPE MD5)
set(OPENMP_FILE openmp-${OPENMP_VERSION}.src.tar.xz)
set(OPENIMAGEIO_VERSION v2.3.13.0)
set(OPENIMAGEIO_VERSION v2.4.9.0)
set(OPENIMAGEIO_URI https://github.com/OpenImageIO/oiio/archive/refs/tags/${OPENIMAGEIO_VERSION}.tar.gz)
set(OPENIMAGEIO_HASH de45fb38501c4581062b522b53b6141c)
set(OPENIMAGEIO_HASH 7da92a7d6029921a8599a977ff1efa2a)
set(OPENIMAGEIO_HASH_TYPE MD5)
set(OPENIMAGEIO_FILE OpenImageIO-${OPENIMAGEIO_VERSION}.tar.gz)
# 8.0.0 is currently oiio's preferred vesion although never versions may be available.
# 8.0.0 is currently oiio's preferred version although never versions may be available.
# the preferred version can be found in oiio's externalpackages.cmake
set(FMT_VERSION 8.0.0)
set(FMT_URI https://github.com/fmtlib/fmt/archive/refs/tags/${FMT_VERSION}.tar.gz)
set(FMT_HASH 7bce0e9e022e586b178b150002e7c2339994e3c2bbe44027e9abb0d60f9cce83)
set(FMT_HASH_TYPE SHA256)
set(FMT_FILE fmt-${FMT_VERSION}.tar.gz)
set(FMT_CPE "cpe:2.3:a:fmt:fmt:${FMT_VERSION}:*:*:*:*:*:*:*")
# 0.6.2 is currently oiio's preferred vesion although never versions may be available.
# 0.6.2 is currently oiio's preferred version although never versions may be available.
# the preferred version can be found in oiio's externalpackages.cmake
set(ROBINMAP_VERSION v0.6.2)
set(ROBINMAP_URI https://github.com/Tessil/robin-map/archive/refs/tags/${ROBINMAP_VERSION}.tar.gz)
@@ -163,63 +188,94 @@ set(ROBINMAP_HASH c08ec4b1bf1c85eb0d6432244a6a89862229da1cb834f3f90fba8dc35d8c8e
set(ROBINMAP_HASH_TYPE SHA256)
set(ROBINMAP_FILE robinmap-${ROBINMAP_VERSION}.tar.gz)
set(TIFF_VERSION 4.3.0)
set(TIFF_VERSION 4.4.0)
set(TIFF_URI http://download.osgeo.org/libtiff/tiff-${TIFF_VERSION}.tar.gz)
set(TIFF_HASH 0a2e4744d1426a8fc8211c0cdbc3a1b3)
set(TIFF_HASH 376f17f189e9d02280dfe709b2b2bbea)
set(TIFF_HASH_TYPE MD5)
set(TIFF_FILE tiff-${TIFF_VERSION}.tar.gz)
set(TIFF_CPE "cpe:2.3:a:libtiff:libtiff:${TIFF_VERSION}:*:*:*:*:*:*:*")
set(OSL_VERSION 1.11.17.0)
set(OSL_URI https://github.com/imageworks/OpenShadingLanguage/archive/Release-${OSL_VERSION}.tar.gz)
set(OSL_HASH 63265472ce14548839ace2e21e401544)
# Recent commit from 1.13.0.2 under development, which includes string table
# changes that make the Cycles OptiX implementation work. Official 1.12 OSL
# releases should also build but without OptiX support.
set(OSL_VERSION 1a7670600c8b08c2443a78d03c8c27e9a1149140)
set(OSL_URI https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/archive/${OSL_VERSION}.tar.gz)
set(OSL_HASH 7b6d6716b05d1addb92a8f47280bf77f)
set(OSL_HASH_TYPE MD5)
set(OSL_FILE OpenShadingLanguage-${OSL_VERSION}.tar.gz)
set(PYTHON_VERSION 3.10.2)
# NOTE: When updating the python version, it's required to check the versions of
# it wants to use in PCbuild/get_externals.bat for the following dependencies:
# BZIP2, FFI, SQLITE and change the versions in this file as well. For compliance
# reasons there can be no exceptions to this.
set(PYTHON_VERSION 3.10.9)
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 14e8c22458ed7779a1957b26cde01db9)
set(PYTHON_HASH dc8c0f274b28ee9e95923d20cfc364c9)
set(PYTHON_HASH_TYPE MD5)
set(PYTHON_FILE Python-${PYTHON_VERSION}.tar.xz)
set(PYTHON_CPE "cpe:2.3:a:python:python:${PYTHON_VERSION}:-:*:*:*:*:*:*")
set(TBB_VERSION 2020_U3)
set(TBB_YEAR 2020)
set(TBB_VERSION ${TBB_YEAR}_U3)
set(TBB_URI https://github.com/oneapi-src/oneTBB/archive/${TBB_VERSION}.tar.gz)
set(TBB_HASH 55ec8df6eae5ed6364a47f0e671e460c)
set(TBB_HASH_TYPE MD5)
set(TBB_FILE oneTBB-${TBB_VERSION}.tar.gz)
set(TBB_CPE "cpe:2.3:a:intel:threading_building_blocks:${TBB_YEAR}:*:*:*:*:*:*:*")
set(OPENVDB_VERSION 9.0.0)
set(OPENVDB_VERSION 10.0.0)
set(OPENVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz)
set(OPENVDB_HASH 684ce40c2f74f3a0c9cac530e1c7b07e)
set(OPENVDB_HASH 64301c737e16b26c8f3085a31e6397e9)
set(OPENVDB_HASH_TYPE MD5)
set(OPENVDB_FILE openvdb-${OPENVDB_VERSION}.tar.gz)
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(AUTOPEP8_VERSION 1.6.0)
set(PYCODESTYLE_VERSION 2.8.0)
set(TOML_VERSION 0.10.2)
# ------------------------------------------------------------------------------
# Python Modules
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 252de134862a27bd66705d29622edbfe)
# Needed by: `requests` module (so the version doesn't change on rebuild).
set(IDNA_VERSION 3.3)
# Needed by: `requests` module (so the version doesn't change on rebuild).
set(CHARSET_NORMALIZER_VERSION 2.0.10)
# Needed by: `requests` module (so the version doesn't change on rebuild).
set(URLLIB3_VERSION 1.26.8)
set(URLLIB3_CPE "cpe:2.3:a:urllib3:urllib3:${URLLIB3_VERSION}:*:*:*:*:*:*:*")
# Needed by: Python's `requests` module (so add-ons can authenticate against trusted certificates).
set(CERTIFI_VERSION 2021.10.8)
# Needed by: Some of Blender's add-ons (to support convenient interaction with online services).
set(REQUESTS_VERSION 2.27.1)
# Needed by: Python's `numpy` module (used by some add-ons).
set(CYTHON_VERSION 0.29.30)
# Needed by: Python scripts that read `.blend` files, as files may use Z-standard compression.
# 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)
# Auto-format Python source (developer tool, not used by Blender at run-time).
set(AUTOPEP8_VERSION 1.6.0)
# Needed by: `autopep8` (so the version doesn't change on rebuild).
set(PYCODESTYLE_VERSION 2.8.0)
# Needed by: `autopep8` (so the version doesn't change on rebuild).
set(TOML_VERSION 0.10.2)
# Build system for other packages (not used by Blender at run-time).
set(MESON_VERSION 0.63.0)
set(NUMPY_VERSION 1.23.5)
set(NUMPY_SHORT_VERSION 1.23)
set(NUMPY_URI https://github.com/numpy/numpy/releases/download/v${NUMPY_VERSION}/numpy-${NUMPY_VERSION}.tar.gz)
set(NUMPY_HASH 8b2692a511a3795f3af8af2cd7566a15)
set(NUMPY_HASH_TYPE MD5)
set(NUMPY_FILE numpy-${NUMPY_VERSION}.zip)
set(NUMPY_FILE numpy-${NUMPY_VERSION}.tar.gz)
set(NUMPY_CPE "cpe:2.3:a:numpy:numpy:${NUMPY_VERSION}:*:*:*:*:*:*:*")
set(LAME_VERSION 3.100)
set(LAME_URI http://downloads.sourceforge.net/project/lame/lame/3.100/lame-${LAME_VERSION}.tar.gz)
set(LAME_HASH 83e260acbe4389b54fe08e0bdbf7cddb)
set(LAME_HASH_TYPE MD5)
set(LAME_FILE lame-${LAME_VERSION}.tar.gz)
set(LAME_CPE "cpe:2.3:a:lame_project:lame:${LAME_VERSION}:*:*:*:*:*:*:*")
set(OGG_VERSION 1.3.5)
set(OGG_URI http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz)
@@ -232,6 +288,7 @@ set(VORBIS_URI http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERS
set(VORBIS_HASH 0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab)
set(VORBIS_HASH_TYPE SHA256)
set(VORBIS_FILE libvorbis-${VORBIS_VERSION}.tar.gz)
set(VORBIS_CPE "cpe:2.3:a:xiph.org:libvorbis:${VORBIS_VERSION}:*:*:*:*:*:*:*")
set(THEORA_VERSION 1.1.1)
set(THEORA_URI http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.bz2)
@@ -244,12 +301,14 @@ set(FLAC_URI http://downloads.xiph.org/releases/flac/flac-${FLAC_VERSION}.tar.xz
set(FLAC_HASH 8ff0607e75a322dd7cd6ec48f4f225471404ae2730d0ea945127b1355155e737 )
set(FLAC_HASH_TYPE SHA256)
set(FLAC_FILE flac-${FLAC_VERSION}.tar.xz)
set(FLAC_CPE "cpe:2.3:a:flac_project:flac:${FLAC_VERSION}:*:*:*:*:*:*:*")
set(VPX_VERSION 1.11.0)
set(VPX_URI https://github.com/webmproject/libvpx/archive/v${VPX_VERSION}/libvpx-v${VPX_VERSION}.tar.gz)
set(VPX_HASH 965e51c91ad9851e2337aebcc0f517440c637c506f3a03948062e3d5ea129a83)
set(VPX_HASH_TYPE SHA256)
set(VPX_FILE libvpx-v${VPX_VERSION}.tar.gz)
set(VPX_CPE "cpe:2.3:a:webmproject:libvpx:${VPX_VERSION}:*:*:*:*:*:*:*")
set(OPUS_VERSION 1.3.1)
set(OPUS_URI https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz)
@@ -269,18 +328,20 @@ set(XVIDCORE_HASH abbdcbd39555691dd1c9b4d08f0a031376a3b211652c0d8b3b8aa9be1303ce
set(XVIDCORE_HASH_TYPE SHA256)
set(XVIDCORE_FILE xvidcore-${XVIDCORE_VERSION}.tar.gz)
set(OPENJPEG_VERSION 2.4.0)
set(OPENJPEG_SHORT_VERSION 2.4)
set(OPENJPEG_VERSION 2.5.0)
set(OPENJPEG_SHORT_VERSION 2.5)
set(OPENJPEG_URI https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz)
set(OPENJPEG_HASH 8702ba68b442657f11aaeb2b338443ca8d5fb95b0d845757968a7be31ef7f16d)
set(OPENJPEG_HASH 0333806d6adecc6f7a91243b2b839ff4d2053823634d4f6ed7a59bc87409122a)
set(OPENJPEG_HASH_TYPE SHA256)
set(OPENJPEG_FILE openjpeg-v${OPENJPEG_VERSION}.tar.gz)
set(OPENJPEG_CPE "cpe:2.3:a:uclouvain:openjpeg:${OPENJPEG_VERSION}:*:*:*:*:*:*:*")
set(FFMPEG_VERSION 5.0)
set(FFMPEG_VERSION 5.1.2)
set(FFMPEG_URI http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2)
set(FFMPEG_HASH c0130b8db2c763430fd1c6905288d61bc44ee0548ad5fcd2dfd650b88432bed9)
set(FFMPEG_HASH 39a0bcc8d98549f16c570624678246a6ac736c066cebdb409f9502e915b22f2b)
set(FFMPEG_HASH_TYPE SHA256)
set(FFMPEG_FILE ffmpeg-${FFMPEG_VERSION}.tar.bz2)
set(FFMPEG_CPE "cpe:2.3:a:ffmpeg:ffmpeg:${FFMPEG_VERSION}:*:*:*:*:*:*:*")
set(FFTW_VERSION 3.3.10)
set(FFTW_URI http://www.fftw.org/fftw-${FFTW_VERSION}.tar.gz)
@@ -294,21 +355,23 @@ set(ICONV_HASH 7d2a800b952942bb2880efb00cfd524c)
set(ICONV_HASH_TYPE MD5)
set(ICONV_FILE libiconv-${ICONV_VERSION}.tar.gz)
set(SNDFILE_VERSION 1.0.28)
set(SNDFILE_URI http://www.mega-nerd.com/libsndfile/files/libsndfile-${SNDFILE_VERSION}.tar.gz)
set(SNDFILE_HASH 646b5f98ce89ac60cdb060fcd398247c)
set(SNDFILE_VERSION 1.1.0)
set(SNDFILE_URI https://github.com/libsndfile/libsndfile/releases/download/1.1.0/libsndfile-${SNDFILE_VERSION}.tar.xz)
set(SNDFILE_HASH e63dead2b4f0aaf323687619d007ee6a)
set(SNDFILE_HASH_TYPE MD5)
set(SNDFILE_FILE libsndfile-${SNDFILE_VERSION}.tar.gz)
set(SNDFILE_FILE libsndfile-${SNDFILE_VERSION}.tar.xz)
set(SNDFILE_CPE "cpe:2.3:a:libsndfile_project:libsndfile:${SNDFILE_VERSION}:*:*:*:*:*:*:*")
set(WEBP_VERSION 1.2.2)
set(WEBP_URI https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz)
set(WEBP_HASH b5e2e414a8adee4c25fe56b18dd9c549)
set(WEBP_HASH_TYPE MD5)
set(WEBP_FILE libwebp-${WEBP_VERSION}.tar.gz)
set(WEBP_CPE "cpe:2.3:a:webmproject:libwebp:${WEBP_VERSION}:*:*:*:*:*:*:*")
set(SPNAV_VERSION 0.2.3)
set(SPNAV_URI http://downloads.sourceforge.net/project/spacenav/spacenav%20library%20%28SDK%29/libspnav%20${SPNAV_VERSION}/libspnav-${SPNAV_VERSION}.tar.gz)
set(SPNAV_HASH 44d840540d53326d4a119c0f1aa7bf0a)
set(SPNAV_VERSION 1.1)
set(SPNAV_URI https://github.com/FreeSpacenav/libspnav/releases/download/v${SPNAV_VERSION}/libspnav-${SPNAV_VERSION}.tar.gz)
set(SPNAV_HASH 7c0032034672dfba3c4bb9b49a440e70)
set(SPNAV_HASH_TYPE MD5)
set(SPNAV_FILE libspnav-${SPNAV_VERSION}.tar.gz)
@@ -318,24 +381,19 @@ set(JEMALLOC_HASH 3d41fbf006e6ebffd489bdb304d009ae)
set(JEMALLOC_HASH_TYPE MD5)
set(JEMALLOC_FILE jemalloc-${JEMALLOC_VERSION}.tar.bz2)
set(XML2_VERSION 2.9.10)
set(XML2_URI http://xmlsoft.org/sources/libxml2-${XML2_VERSION}.tar.gz)
set(XML2_HASH 10942a1dc23137a8aa07f0639cbfece5)
set(XML2_VERSION 2.10.3)
set(XML2_URI https://download.gnome.org/sources/libxml2/2.10/libxml2-${XML2_VERSION}.tar.xz)
set(XML2_HASH f9edac7fac232b3657a003fd9a5bbe42)
set(XML2_HASH_TYPE MD5)
set(XML2_FILE libxml2-${XML2_VERSION}.tar.gz)
set(XML2_FILE libxml2-${XML2_VERSION}.tar.xz)
set(XML2_CPE "cpe:2.3:a:xmlsoft:libxml2:${XML2_VERSION}:*:*:*:*:*:*:*")
set(TINYXML_VERSION 2_6_2)
set(TINYXML_VERSION_DOTS 2.6.2)
set(TINYXML_URI https://nchc.dl.sourceforge.net/project/tinyxml/tinyxml/${TINYXML_VERSION_DOTS}/tinyxml_${TINYXML_VERSION}.tar.gz)
set(TINYXML_HASH c1b864c96804a10526540c664ade67f0)
set(TINYXML_HASH_TYPE MD5)
set(TINYXML_FILE tinyxml_${TINYXML_VERSION}.tar.gz)
set(YAMLCPP_VERSION 0.6.3)
set(YAMLCPP_VERSION 0.7.0)
set(YAMLCPP_URI https://codeload.github.com/jbeder/yaml-cpp/tar.gz/yaml-cpp-${YAMLCPP_VERSION})
set(YAMLCPP_HASH b45bf1089a382e81f6b661062c10d0c2)
set(YAMLCPP_HASH 74d646a3cc1b5d519829441db96744f0)
set(YAMLCPP_HASH_TYPE MD5)
set(YAMLCPP_FILE yaml-cpp-${YAMLCPP_VERSION}.tar.gz)
set(YAMLCPP "cpe:2.3:a:yaml-cpp_project:yaml-cpp:${YAMLCPP_VERSION}:*:*:*:*:*:*:*")
set(PYSTRING_VERSION v1.1.3)
set(PYSTRING_URI https://codeload.github.com/imageworks/pystring/tar.gz/refs/tags/${PYSTRING_VERSION})
@@ -343,17 +401,20 @@ set(PYSTRING_HASH f2c68786b359f5e4e62bed53bc4fb86d)
set(PYSTRING_HASH_TYPE MD5)
set(PYSTRING_FILE pystring-${PYSTRING_VERSION}.tar.gz)
set(EXPAT_VERSION 2_4_4)
set(EXPAT_VERSION 2_5_0)
set(EXPAT_VERSION_DOTS 2.5.0)
set(EXPAT_URI https://github.com/libexpat/libexpat/archive/R_${EXPAT_VERSION}.tar.gz)
set(EXPAT_HASH 2d3e81dee94b452369dc6394ff0f8f98)
set(EXPAT_HASH d375fa3571c0abb945873f5061a8f2e2)
set(EXPAT_HASH_TYPE MD5)
set(EXPAT_FILE libexpat-${EXPAT_VERSION}.tar.gz)
set(EXPAT_CPE "cpe:2.3:a:libexpat_project:libexpat:${EXPAT_VERSION_DOTS}:*:*:*:*:*:*:*")
set(PUGIXML_VERSION 1.10)
set(PUGIXML_URI https://github.com/zeux/pugixml/archive/v${PUGIXML_VERSION}.tar.gz)
set(PUGIXML_HASH 0c208b0664c7fb822bf1b49ad035e8fd)
set(PUGIXML_HASH_TYPE MD5)
set(PUGIXML_FILE pugixml-${PUGIXML_VERSION}.tar.gz)
set(PUGIXML_CPE "cpe:2.3:a:pugixml_project:pugixml:${PUGIXML_VERSION}:*:*:*:*:*:*:*")
set(FLEXBISON_VERSION 2.5.24)
set(FLEXBISON_URI http://prdownloads.sourceforge.net/winflexbison/win_flex_bison-${FLEXBISON_VERSION}.zip)
@@ -371,17 +432,26 @@ set(FLEX_FILE flex-${FLEX_VERSION}.tar.gz)
# NOTE: bzip.org domain does no longer belong to BZip 2 project, so we download
# sources from Debian packaging.
#
# NOTE 2: This will *HAVE* to match the version python ships on windows which
# is hardcoded in pythons PCbuild/get_externals.bat. For compliance reasons there
# can be no exceptions to this.
set(BZIP2_VERSION 1.0.8)
set(BZIP2_URI http://http.debian.net/debian/pool/main/b/bzip2/bzip2_${BZIP2_VERSION}.orig.tar.gz)
set(BZIP2_HASH ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269)
set(BZIP2_HASH_TYPE SHA256)
set(BZIP2_FILE bzip2_${BZIP2_VERSION}.orig.tar.gz)
set(BZIP2_CPE "cpe:2.3:a:bzip:bzip2:${BZIP2_VERSION}:*:*:*:*:*:*:*")
# NOTE: This will *HAVE* to match the version python ships on windows which
# is hardcoded in pythons PCbuild/get_externals.bat. For compliance reasons there
# can be no exceptions to this.
set(FFI_VERSION 3.3)
set(FFI_URI https://sourceware.org/pub/libffi/libffi-${FFI_VERSION}.tar.gz)
set(FFI_HASH 72fba7922703ddfa7a028d513ac15a85c8d54c8d67f55fa5a4802885dc652056)
set(FFI_HASH_TYPE SHA256)
set(FFI_FILE libffi-${FFI_VERSION}.tar.gz)
set(FFI_CPE "cpe:2.3:a:libffi_project:libffi:${FFI_VERSION}:*:*:*:*:*:*:*")
set(LZMA_VERSION 5.2.5)
set(LZMA_URI https://tukaani.org/xz/xz-${LZMA_VERSION}.tar.bz2)
@@ -389,39 +459,43 @@ set(LZMA_HASH 5117f930900b341493827d63aa910ff5e011e0b994197c3b71c08a20228a42df)
set(LZMA_HASH_TYPE SHA256)
set(LZMA_FILE xz-${LZMA_VERSION}.tar.bz2)
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()
# NOTE: Python's build has been modified to use our ssl version.
set(SSL_VERSION 1.1.1q)
set(SSL_URI https://www.openssl.org/source/openssl-${SSL_VERSION}.tar.gz)
set(SSL_HASH d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca)
set(SSL_HASH_TYPE SHA256)
set(SSL_FILE openssl-${SSL_VERSION}.tar.gz)
set(SSL_CPE "cpe:2.3:a:openssl:openssl:${SSL_VERSION}:*:*:*:*:*:*:*")
set(SQLITE_VERSION 3.31.1)
set(SQLITE_URI https://www.sqlite.org/2018/sqlite-src-3240000.zip)
set(SQLITE_HASH fb558c49ee21a837713c4f1e7e413309aabdd9c7)
# Note: This will *HAVE* to match the version python ships on windows which
# is hardcoded in pythons PCbuild/get_externals.bat for compliance reasons there
# can be no exceptions to this.
set(SQLITE_VERSION 3.39.4)
set(SQLLITE_LONG_VERSION 3390400)
set(SQLITE_URI https://www.sqlite.org/2022/sqlite-autoconf-${SQLLITE_LONG_VERSION}.tar.gz)
set(SQLITE_HASH c4c5c39269d1b9bb1487cff580c1f583608229b2)
set(SQLITE_HASH_TYPE SHA1)
set(SQLITE_FILE sqlite-src-3240000.zip)
set(SQLITE_FILE sqlite-autoconf-${SQLLITE_LONG_VERSION}.tar.gz)
set(SQLITE_CPE "cpe:2.3:a:sqlite:sqlite:${SQLITE_VERSION}:*:*:*:*:*:*:*")
set(EMBREE_VERSION 3.13.3)
set(EMBREE_VERSION 4.0.1)
set(EMBREE_URI https://github.com/embree/embree/archive/v${EMBREE_VERSION}.zip)
set(EMBREE_HASH f62766ba54e48a2f327c3a22596e7133)
set(EMBREE_HASH dd26617719a587e126b341d1b32f7fd0)
set(EMBREE_HASH_TYPE MD5)
set(EMBREE_FILE embree-v${EMBREE_VERSION}.zip)
set(USD_VERSION 22.03)
set(USD_VERSION 22.11)
set(USD_URI https://github.com/PixarAnimationStudios/USD/archive/v${USD_VERSION}.tar.gz)
set(USD_HASH e0e441a05057692a83124a1195b09eed)
set(USD_HASH 8c89459e48a2ef0e7ae9e7e490377507)
set(USD_HASH_TYPE MD5)
set(USD_FILE usd-v${USD_VERSION}.tar.gz)
set(MATERIALX_VERSION 1.38.6)
set(MATERIALX_URI https://github.com/AcademySoftwareFoundation/MaterialX/archive/refs/tags/v${MATERIALX_VERSION}.tar.gz)
set(MATERIALX_HASH d49c9fdef34b5702fc60058d3e1864f2)
set(MATERIALX_HASH_TYPE MD5)
set(MATERIALX_FILE materialx-v${MATERIALX_VERSION}.tar.gz)
set(OIDN_VERSION 1.4.3)
set(OIDN_URI https://github.com/OpenImageDenoise/oidn/releases/download/v${OIDN_VERSION}/oidn-${OIDN_VERSION}.src.tar.gz)
set(OIDN_HASH 027093eaf5e8b4e45835b991137b38e6)
@@ -439,12 +513,14 @@ set(MESA_URI ftp://ftp.freedesktop.org/pub/mesa/mesa-${MESA_VERSION}.tar.xz)
set(MESA_HASH 022c7293074aeeced2278c872db4fa693147c70f8595b076cf3f1ef81520766d)
set(MESA_HASH_TYPE SHA256)
set(MESA_FILE mesa-${MESA_VERSION}.tar.xz)
set(MESA_CPE "cpe:2.3:a:mesa3d:mesa:${MESA_VERSION}:*:*:*:*:*:*:*")
set(NASM_VERSION 2.15.02)
set(NASM_URI https://github.com/netwide-assembler/nasm/archive/nasm-${NASM_VERSION}.tar.gz)
set(NASM_HASH aded8b796c996a486a56e0515c83e414116decc3b184d88043480b32eb0a8589)
set(NASM_HASH_TYPE SHA256)
set(NASM_FILE nasm-${NASM_VERSION}.tar.gz)
set(NASM_PCE "cpe:2.3:a:nasm:nasm:${NASM_VERSION}:*:*:*:*:*:*:*")
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)
@@ -452,12 +528,24 @@ 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)
set(WL_PROTOCOLS_VERSION 1.21)
set(WL_PROTOCOLS_VERSION 1.31)
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 a28ff59a56e2ebb746048b6ef8d931d6)
set(WL_PROTOCOLS_HASH_TYPE MD5)
set(WAYLAND_VERSION 1.22.0)
set(WAYLAND_FILE wayland-${WAYLAND_VERSION}.tar.xz)
set(WAYLAND_URI https://gitlab.freedesktop.org/wayland/wayland/-/releases/${WAYLAND_VERSION}/downloads/wayland-${WAYLAND_VERSION}.tar.xz)
set(WAYLAND_HASH 7410ab549e3928fce9381455b17b0803)
set(WAYLAND_HASH_TYPE MD5)
set(WAYLAND_LIBDECOR_VERSION 0.1.0)
set(WAYLAND_LIBDECOR_FILE libdecor-${WAYLAND_LIBDECOR_VERSION}.tar.xz)
set(WAYLAND_LIBDECOR_URI https://gitlab.gnome.org/jadahl/libdecor/uploads/81adf91d27620e20bcc5f6b9b312d768/libdecor-${WAYLAND_LIBDECOR_VERSION}.tar.xz )
set(WAYLAND_LIBDECOR_HASH 47b59eba76faa3787f0878bf8700e912)
set(WAYLAND_LIBDECOR_HASH_TYPE MD5)
set(ISPC_VERSION v1.17.0)
set(ISPC_URI https://github.com/ispc/ispc/archive/${ISPC_VERSION}.tar.gz)
set(ISPC_HASH 4f476a3109332a77fe839a9014c60ca9)
@@ -469,12 +557,14 @@ set(GMP_URI https://gmplib.org/download/gmp/gmp-${GMP_VERSION}.tar.xz)
set(GMP_HASH 0b82665c4a92fd2ade7440c13fcaa42b)
set(GMP_HASH_TYPE MD5)
set(GMP_FILE gmp-${GMP_VERSION}.tar.xz)
set(GMP_CPE "cpe:2.3:a:gmplib:gmp:${GMP_VERSION}:*:*:*:*:*:*:*")
set(POTRACE_VERSION 1.16)
set(POTRACE_URI http://potrace.sourceforge.net/download/${POTRACE_VERSION}/potrace-${POTRACE_VERSION}.tar.gz)
set(POTRACE_HASH 5f0bd87ddd9a620b0c4e65652ef93d69)
set(POTRACE_HASH_TYPE MD5)
set(POTRACE_FILE potrace-${POTRACE_VERSION}.tar.gz)
set(POTRACE_CPE "cpe:2.3:a:icoasoft:potrace:${POTRACE_VERSION}:*:*:*:*:*:*:*")
set(HARU_VERSION 2_3_0)
set(HARU_URI https://github.com/libharu/libharu/archive/RELEASE_${HARU_VERSION}.tar.gz)
@@ -487,18 +577,224 @@ set(ZSTD_URI https://github.com/facebook/zstd/releases/download/v${ZSTD_VERSION}
set(ZSTD_HASH 5194fbfa781fcf45b98c5e849651aa7b3b0a008c6b72d4a0db760f3002291e94)
set(ZSTD_HASH_TYPE SHA256)
set(ZSTD_FILE zstd-${ZSTD_VERSION}.tar.gz)
set(ZSTD_CPE "cpe:2.3:a:facebook:zstandard:${ZSTD_VERSION}:*:*:*:*:*:*:*")
set(SSE2NEON_GIT https://github.com/DLTcollab/sse2neon.git)
set(SSE2NEON_GIT_HASH fe5ff00bb8d19b327714a3c290f3e2ce81ba3525)
set(SSE2NEON_VERSION fe5ff00bb8d19b327714a3c290f3e2ce81ba3525)
set(SSE2NEON_URI https://github.com/DLTcollab/sse2neon/archive/${SSE2NEON_VERSION}.tar.gz)
set(SSE2NEON_HASH 0780253525d299c31775ef95853698d03db9c7739942af8570000f4a25a5d605)
set(SSE2NEON_HASH_TYPE SHA256)
set(SSE2NEON_FILE sse2neon-${SSE2NEON_VERSION}.tar.gz)
set(BROTLI_VERSION v1.0.9)
set(BROTLI_URI https://github.com/google/brotli/archive/refs/tags/${BROTLI_VERSION}.tar.gz)
set(BROTLI_VERSION 1.0.9)
set(BROTLI_URI https://github.com/google/brotli/archive/refs/tags/v${BROTLI_VERSION}.tar.gz)
set(BROTLI_HASH f9e8d81d0405ba66d181529af42a3354f838c939095ff99930da6aa9cdf6fe46)
set(BROTLI_HASH_TYPE SHA256)
set(BROTLI_FILE brotli-${BROTLI_VERSION}.tar.gz)
set(BROTLI_FILE brotli-v${BROTLI_VERSION}.tar.gz)
set(BROTLI_CPE "cpe:2.3:a:google:brotli:${BROTLI_VERSION}:*:*:*:*:*:*:*")
set(LEVEL_ZERO_VERSION v1.7.15)
set(OPENPGL_VERSION v0.4.1-beta)
set(OPENPGL_SHORT_VERSION 0.4.1)
set(OPENPGL_URI https://github.com/OpenPathGuidingLibrary/openpgl/archive/refs/tags/${OPENPGL_VERSION}.tar.gz)
set(OPENPGL_HASH db63f5dac5cfa8c110ede241f0c413f00db0c4748697381c4fa23e0f9e82a754)
set(OPENPGL_HASH_TYPE SHA256)
set(OPENPGL_FILE openpgl-${OPENPGL_VERSION}.tar.gz)
set(LEVEL_ZERO_VERSION v1.8.5)
set(LEVEL_ZERO_URI https://github.com/oneapi-src/level-zero/archive/refs/tags/${LEVEL_ZERO_VERSION}.tar.gz)
set(LEVEL_ZERO_HASH c39bb05a8e5898aa6c444e1704105b93d3f1888b9c333f8e7e73825ffbfb2617)
set(LEVEL_ZERO_HASH b6e9663bbcc53c148d32376998298bec6f7c434ef2218c61fa708963e3a09394)
set(LEVEL_ZERO_HASH_TYPE SHA256)
set(LEVEL_ZERO_FILE level-zero-${LEVEL_ZERO_VERSION}.tar.gz)
set(DPCPP_VERSION 20221019)
set(DPCPP_URI https://github.com/intel/llvm/archive/refs/tags/sycl-nightly/${DPCPP_VERSION}.tar.gz)
set(DPCPP_HASH 2f533946e91ce3829431758ea17b0b834b960c1a796e9e4563c86e03eb9603a2)
set(DPCPP_HASH_TYPE SHA256)
set(DPCPP_FILE DPCPP-${DPCPP_VERSION}.tar.gz)
########################
### DPCPP DEPS BEGIN ###
########################
# The following deps are build time requirements for dpcpp, when possible
# the source in the dpcpp source tree for the version chosen is documented
# by each dep, these will only have to be downloaded and unpacked, dpcpp
# will take care of building them, unpack is being done in dpcpp_deps.cmake
# Source llvm/lib/SYCLLowerIR/CMakeLists.txt
set(VCINTRINSICS_VERSION abce9184b7a3a7fe1b02289b9285610d9dc45465)
set(VCINTRINSICS_URI https://github.com/intel/vc-intrinsics/archive/${VCINTRINSICS_VERSION}.tar.gz)
set(VCINTRINSICS_HASH 3e9fd471246b87633b26f7e15e17ab7733d357458c53d5c5881c03929d6c551f)
set(VCINTRINSICS_HASH_TYPE SHA256)
set(VCINTRINSICS_FILE vc-intrinsics-${VCINTRINSICS_VERSION}.tar.gz)
# Source opencl/CMakeLists.txt
set(OPENCLHEADERS_VERSION dcd5bede6859d26833cd85f0d6bbcee7382dc9b3)
set(OPENCLHEADERS_URI https://github.com/KhronosGroup/OpenCL-Headers/archive/${OPENCLHEADERS_VERSION}.tar.gz)
set(OPENCLHEADERS_HASH ca8090359654e94f2c41e946b7e9d826253d795ae809ce7c83a7d3c859624693)
set(OPENCLHEADERS_HASH_TYPE SHA256)
set(OPENCLHEADERS_FILE opencl_headers-${OPENCLHEADERS_VERSION}.tar.gz)
# Source opencl/CMakeLists.txt
set(ICDLOADER_VERSION 792682ad3d877ab38573b997808bab3b43902b70)
set(ICDLOADER_URI https://github.com/KhronosGroup/OpenCL-ICD-Loader/archive/${ICDLOADER_VERSION}.tar.gz)
set(ICDLOADER_HASH b33a0320d94bf300efa1da97931ded506d27813bd1148da6858fe79d412d1ea2)
set(ICDLOADER_HASH_TYPE SHA256)
set(ICDLOADER_FILE icdloader-${ICDLOADER_VERSION}.tar.gz)
# Source sycl/cmake/modules/AddBoostMp11Headers.cmake
# Using external MP11 here, getting AddBoostMp11Headers.cmake to recognize
# our copy in boost directly was more trouble than it was worth.
set(MP11_VERSION 7bc4e1ae9b36ec8ee635c3629b59ec525bbe82b9)
set(MP11_URI https://github.com/boostorg/mp11/archive/${MP11_VERSION}.tar.gz)
set(MP11_HASH 071ee2bd3952ec89882edb3af25dd1816f6b61723f66e42eea32f4d02ceef426)
set(MP11_HASH_TYPE SHA256)
set(MP11_FILE mp11-${MP11_VERSION}.tar.gz)
# Source llvm-spirv/CMakeLists.txt (repo)
# Source llvm-spirv/spirv-headers-tag.conf (hash)
set(SPIRV_HEADERS_VERSION 5a121866927a16ab9d49bed4788b532c7fcea766)
set(SPIRV_HEADERS_URI https://github.com/KhronosGroup/SPIRV-Headers/archive/${SPIRV_HEADERS_VERSION}.tar.gz)
set(SPIRV_HEADERS_HASH ec8ecb471a62672697846c436501638ab25447ae9d4a6761e0bfe8a9a839502a)
set(SPIRV_HEADERS_HASH_TYPE SHA256)
set(SPIRV_HEADERS_FILE SPIR-V-Headers-${SPIRV_HEADERS_VERSION}.tar.gz)
######################
### DPCPP DEPS END ###
######################
##########################################
### Intel Graphics Compiler DEPS BEGIN ###
##########################################
# The following deps are build time requirements for the intel graphics
# compiler, the versions used are taken from the following location
# https://github.com/intel/intel-graphics-compiler/releases
set(IGC_VERSION 1.0.13064.7)
set(IGC_URI https://github.com/intel/intel-graphics-compiler/archive/refs/tags/igc-${IGC_VERSION}.tar.gz)
set(IGC_HASH a929abd4cca2b293961ec0437ee4b3b2147bd3b2c8a3c423af78c0c359b2e5ae)
set(IGC_HASH_TYPE SHA256)
set(IGC_FILE igc-${IGC_VERSION}.tar.gz)
set(IGC_LLVM_VERSION llvmorg-11.1.0)
set(IGC_LLVM_URI https://github.com/llvm/llvm-project/archive/refs/tags/${IGC_LLVM_VERSION}.tar.gz)
set(IGC_LLVM_HASH 53a0719f3f4b0388013cfffd7b10c7d5682eece1929a9553c722348d1f866e79)
set(IGC_LLVM_HASH_TYPE SHA256)
set(IGC_LLVM_FILE ${IGC_LLVM_VERSION}.tar.gz)
# WARNING WARNING WARNING
#
# IGC_OPENCL_CLANG contains patches for some of its dependencies.
#
# Whenever IGC_OPENCL_CLANG_VERSION changes, one *MUST* inspect
# IGC_OPENCL_CLANG's patches folder and update igc.cmake to account for
# any added or removed patches.
#
# WARNING WARNING WARNING
set(IGC_OPENCL_CLANG_VERSION ee31812ea8b89d08c2918f045d11a19bd33525c5)
set(IGC_OPENCL_CLANG_URI https://github.com/intel/opencl-clang/archive/${IGC_OPENCL_CLANG_VERSION}.tar.gz)
set(IGC_OPENCL_CLANG_HASH 1db6735bbcfaa31e8a9ba39f121d6bafa806ea8919e9f56782d6aaa67771ddda)
set(IGC_OPENCL_CLANG_HASH_TYPE SHA256)
set(IGC_OPENCL_CLANG_FILE opencl-clang-${IGC_OPENCL_CLANG_VERSION}.tar.gz)
set(IGC_VCINTRINSICS_VERSION v0.11.0)
set(IGC_VCINTRINSICS_URI https://github.com/intel/vc-intrinsics/archive/refs/tags/${IGC_VCINTRINSICS_VERSION}.tar.gz)
set(IGC_VCINTRINSICS_HASH e5acd5626ce7fa6d41ce154c50ac805eda734ee66af94ef28e680ac2ad81bb9f)
set(IGC_VCINTRINSICS_HASH_TYPE SHA256)
set(IGC_VCINTRINSICS_FILE vc-intrinsics-${IGC_VCINTRINSICS_VERSION}.tar.gz)
set(IGC_SPIRV_HEADERS_VERSION sdk-1.3.204.1)
set(IGC_SPIRV_HEADERS_URI https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/${IGC_SPIRV_HEADERS_VERSION}.tar.gz)
set(IGC_SPIRV_HEADERS_HASH 262864053968c217d45b24b89044a7736a32361894743dd6cfe788df258c746c)
set(IGC_SPIRV_HEADERS_HASH_TYPE SHA256)
set(IGC_SPIRV_HEADERS_FILE SPIR-V-Headers-${IGC_SPIRV_HEADERS_VERSION}.tar.gz)
set(IGC_SPIRV_TOOLS_VERSION sdk-1.3.204.1)
set(IGC_SPIRV_TOOLS_URI https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/${IGC_SPIRV_TOOLS_VERSION}.tar.gz)
set(IGC_SPIRV_TOOLS_HASH 6e19900e948944243024aedd0a201baf3854b377b9cc7a386553bc103b087335)
set(IGC_SPIRV_TOOLS_HASH_TYPE SHA256)
set(IGC_SPIRV_TOOLS_FILE SPIR-V-Tools-${IGC_SPIRV_TOOLS_VERSION}.tar.gz)
set(IGC_SPIRV_TRANSLATOR_VERSION d739c01d65ec00dee64dedd40deed805216a7193)
set(IGC_SPIRV_TRANSLATOR_URI https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/${IGC_SPIRV_TRANSLATOR_VERSION}.tar.gz)
set(IGC_SPIRV_TRANSLATOR_HASH ddc0cc9ccbe59dadeaf291012d59de142b2e9f2b124dbb634644d39daddaa13e)
set(IGC_SPIRV_TRANSLATOR_HASH_TYPE SHA256)
set(IGC_SPIRV_TRANSLATOR_FILE SPIR-V-Translator-${IGC_SPIRV_TRANSLATOR_VERSION}.tar.gz)
########################################
### Intel Graphics Compiler DEPS END ###
########################################
set(GMMLIB_VERSION intel-gmmlib-22.3.0)
set(GMMLIB_URI https://github.com/intel/gmmlib/archive/refs/tags/${GMMLIB_VERSION}.tar.gz)
set(GMMLIB_HASH c1f33e1519edfc527127baeb0436b783430dfd256c643130169a3a71dc86aff9)
set(GMMLIB_HASH_TYPE SHA256)
set(GMMLIB_FILE ${GMMLIB_VERSION}.tar.gz)
set(OCLOC_VERSION 22.49.25018.21)
set(OCLOC_URI https://github.com/intel/compute-runtime/archive/refs/tags/${OCLOC_VERSION}.tar.gz)
set(OCLOC_HASH 92362dae08b503a34e5d3820ed284198c452bcd5e7504d90eb69887b20492c06)
set(OCLOC_HASH_TYPE SHA256)
set(OCLOC_FILE ocloc-${OCLOC_VERSION}.tar.gz)
set(AOM_VERSION 3.4.0)
set(AOM_URI https://storage.googleapis.com/aom-releases/libaom-${AOM_VERSION}.tar.gz)
set(AOM_HASH bd754b58c3fa69f3ffd29da77de591bd9c26970e3b18537951336d6c0252e354)
set(AOM_HASH_TYPE SHA256)
set(AOM_FILE libaom-${AOM_VERSION}.tar.gz)
set(FRIBIDI_VERSION v1.0.12)
set(FRIBIDI_URI https://github.com/fribidi/fribidi/archive/refs/tags/${FRIBIDI_VERSION}.tar.gz)
set(FRIBIDI_HASH 2e9e859876571f03567ac91e5ed3b5308791f31cda083408c2b60fa1fe00a39d)
set(FRIBIDI_HASH_TYPE SHA256)
set(FRIBIDI_FILE fribidi-${FRIBIDI_VERSION}.tar.gz)
set(HARFBUZZ_VERSION 5.1.0)
set(HARFBUZZ_URI https://github.com/harfbuzz/harfbuzz/archive/refs/tags/${HARFBUZZ_VERSION}.tar.gz)
set(HARFBUZZ_HASH 5352ff2eec538ea9a63a485cf01ad8332a3f63aa79921c5a2e301cef185caea1)
set(HARFBUZZ_HASH_TYPE SHA256)
set(HARFBUZZ_FILE harfbuzz-${HARFBUZZ_VERSION}.tar.gz)
set(SHADERC_VERSION v2022.3)
set(SHADERC_URI https://github.com/google/shaderc/archive/${SHADERC_VERSION}.tar.gz)
set(SHADERC_HASH 5cb762af57637caf997d5f46baa4e8a4)
set(SHADERC_HASH_TYPE MD5)
set(SHADERC_FILE shaderc-${SHADERC_VERSION}.tar.gz)
# The versions of shaderc's dependencies can be found in the root of shaderc's
# source in a file called DEPS.
set(SHADERC_SPIRV_TOOLS_VERSION eb0a36633d2acf4de82588504f951ad0f2cecacb)
set(SHADERC_SPIRV_TOOLS_URI https://github.com/KhronosGroup/SPIRV-Tools/archive/${SHADERC_SPIRV_TOOLS_VERSION}.tar.gz)
set(SHADERC_SPIRV_TOOLS_HASH a4bdb8161f0e959c75d0d82d367c24f2)
set(SHADERC_SPIRV_TOOLS_HASH_TYPE MD5)
set(SHADERC_SPIRV_TOOLS_FILE SPIRV-Tools-${SHADERC_SPIRV_TOOLS_VERSION}.tar.gz)
set(SHADERC_SPIRV_HEADERS_VERSION 85a1ed200d50660786c1a88d9166e871123cce39)
set(SHADERC_SPIRV_HEADERS_URI https://github.com/KhronosGroup/SPIRV-Headers/archive/${SHADERC_SPIRV_HEADERS_VERSION}.tar.gz)
set(SHADERC_SPIRV_HEADERS_HASH 10d5e8160f39344a641523810b075568)
set(SHADERC_SPIRV_HEADERS_HASH_TYPE MD5)
set(SHADERC_SPIRV_HEADERS_FILE SPIRV-Headers-${SHADERC_SPIRV_HEADERS_VERSION}.tar.gz)
set(SHADERC_GLSLANG_VERSION 89db4e1caa273a057ea46deba709c6e50001b314)
set(SHADERC_GLSLANG_URI https://github.com/KhronosGroup/glslang/archive/${SHADERC_GLSLANG_VERSION}.tar.gz)
set(SHADERC_GLSLANG_HASH 3b3c79ad8e9132ffcb8b63cc29c532e2)
set(SHADERC_GLSLANG_HASH_TYPE MD5)
set(SHADERC_GLSLANG_FILE glslang-${SHADERC_GLSLANG_VERSION}.tar.gz)
set(VULKAN_VERSION v1.2.198)
set(VULKAN_HEADERS_URI https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/${VULKAN_VERSION}.tar.gz)
set(VULKAN_HEADERS_HASH 64fe73e887c963ad546bfc7f9505fa1d)
set(VULKAN_HEADERS_HASH_TYPE MD5)
set(VULKAN_HEADERS_FILE Vulkan-Headers-${VULKAN_VERSION}.tar.gz)
set(VULKAN_LOADER_URI https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/${VULKAN_VERSION}.tar.gz)
set(VULKAN_LOADER_HASH 015170a74f648fd2b41e209b6bf1ebc4)
set(VULKAN_LOADER_HASH_TYPE MD5)
set(VULKAN_LOADER_FILE Vulkan-Loader-${VULKAN_VERSION}.tar.gz)
set(PYBIND11_VERSION 2.10.1)
set(PYBIND11_URI https://github.com/pybind/pybind11/archive/refs/tags/v${PYBIND11_VERSION}.tar.gz)
set(PYBIND11_HASH ce07bfd5089245da7807b3faf6cbc878)
set(PYBIND11_HASH_TYPE MD5)
set(PYBIND11_FILE pybind-v${PYBIND11_VERSION}.tar.gz)

View File

@@ -1,11 +1,13 @@
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(VPX_EXTRA_FLAGS --target=x86_64-win64-gcc --disable-multithread)
else()
set(VPX_EXTRA_FLAGS --target=x86-win32-gcc --disable-multithread)
endif()
# VPX is determined to use pthreads which it will tell ffmpeg to dynamically
# link, which is not something we're super into distribution wise. However
# if it cannot find pthread.h it'll happily provide a pthread emulation
# layer using win32 threads. So all this patch does is make it not find
# pthead.h
set(VPX_PATCH ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/vpx/src/external_vpx < ${PATCH_DIR}/vpx_windows.diff)
set(VPX_EXTRA_FLAGS --target=x86_64-win64-gcc )
else()
if(APPLE)
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
@@ -18,6 +20,16 @@ else()
endif()
endif()
if(NOT BLENDER_PLATFORM_ARM)
list(APPEND VPX_EXTRA_FLAGS
--enable-sse4_1
--enable-sse3
--enable-ssse3
--enable-avx
--enable-avx2
)
endif()
ExternalProject_Add(external_vpx
URL file://${PACKAGE_DIR}/${VPX_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
@@ -30,11 +42,6 @@ ExternalProject_Add(external_vpx
--enable-static
--disable-install-bins
--disable-install-srcs
--disable-sse4_1
--disable-sse3
--disable-ssse3
--disable-avx
--disable-avx2
--disable-unit-tests
--disable-examples
--enable-vp8
@@ -42,6 +49,7 @@ ExternalProject_Add(external_vpx
${VPX_EXTRA_FLAGS}
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/vpx/src/external_vpx/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/vpx/src/external_vpx/ && make install
PATCH_COMMAND ${VPX_PATCH}
INSTALL_DIR ${LIBDIR}/vpx
)

View File

@@ -0,0 +1,54 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(VULKAN_HEADERS_EXTRA_ARGS)
ExternalProject_Add(external_vulkan_headers
URL file://${PACKAGE_DIR}/${VULKAN_HEADERS_FILE}
URL_HASH ${VULKAN_HEADERS_HASH_TYPE}=${VULKAN_HEADERS_HASH}
PREFIX ${BUILD_DIR}/vulkan_headers
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/vulkan_headers -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${VULKAN_HEADERS_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/vulkan_headers
)
set(VULKAN_LOADER_EXTRA_ARGS
-DVULKAN_HEADERS_INSTALL_DIR=${LIBDIR}/vulkan_headers
)
if(UNIX AND NOT APPLE)
# These are used in `cmake/FindWayland.cmake` from `external_vulkan_loader`.
# NOTE: When upgrading to CMAKE 3.22 we it would be cleaner to use: `PKG_CONFIG_ARGN`,
# so `pkgconfig` would find wayland.
set(VULKAN_LOADER_EXTRA_ARGS
${VULKAN_LOADER_EXTRA_ARGS}
-DPKG_WAYLAND_INCLUDE_DIRS=${LIBDIR}/wayland/include
-DPKG_WAYLAND_LIBRARY_DIRS=${LIBDIR}/wayland/lib64
)
endif()
ExternalProject_Add(external_vulkan_loader
URL file://${PACKAGE_DIR}/${VULKAN_LOADER_FILE}
URL_HASH ${VULKAN_LOADER_HASH_TYPE}=${VULKAN_LOADER_HASH}
PREFIX ${BUILD_DIR}/vulkan_loader
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/vulkan_loader -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${VULKAN_LOADER_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/vulkan_loader
)
add_dependencies(
external_vulkan_loader
external_vulkan_headers
)
if(UNIX AND NOT APPLE)
add_dependencies(
external_vulkan_loader
external_wayland
)
elseif(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_vulkan_loader after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/vulkan_loader/ ${HARVEST_TARGET}/vulkan
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/vulkan_headers/ ${HARVEST_TARGET}/vulkan
DEPENDEES install
)
endif()
endif()

View File

@@ -0,0 +1,29 @@
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_wayland
URL file://${PACKAGE_DIR}/${WAYLAND_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${WAYLAND_HASH_TYPE}=${WAYLAND_HASH}
PREFIX ${BUILD_DIR}/wayland
# Use `-E` so the `PKG_CONFIG_PATH` can be defined to link against our own LIBEXPAT & LIBXML2.
#
# NOTE: passing link args "ffi/lib" should not be needed, but
# `pkgconfig` would incorrectly look in "ffi/lib/../lib64" otherwise.
#
# NOTE: `-lm` is needed for `libxml2` which is a static library that uses `libm.so`,
# without this, math symbols such as `floor` aren't found.
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env PKG_CONFIG_PATH=${LIBDIR}/expat/lib/pkgconfig:${LIBDIR}/xml2/lib/pkgconfig:${LIBDIR}/ffi/lib/pkgconfig:$PKG_CONFIG_PATH
${MESON} --prefix ${LIBDIR}/wayland ${MESON_BUILD_TYPE} -Ddocumentation=false -Dtests=false -D "c_link_args=-L${LIBDIR}/ffi/lib -lm" . ../external_wayland
BUILD_COMMAND ninja
INSTALL_COMMAND ninja install
)
add_dependencies(
external_wayland
external_expat
external_xml2
external_ffi
# Needed for `MESON`.
external_python_site_packages
)

View File

@@ -0,0 +1,15 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# NOTE: currently only the header file is extracted, no compilation is needed
# as the library is dynamically loaded when found on the system.
ExternalProject_Add(external_wayland_libdecor
URL file://${PACKAGE_DIR}/${WAYLAND_LIBDECOR_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${WAYLAND_LIBDECOR_HASH_TYPE}=${WAYLAND_LIBDECOR_HASH}
PREFIX ${BUILD_DIR}/wayland_libdecor
BUILD_COMMAND echo .
CONFIGURE_COMMAND echo .
INSTALL_COMMAND cp ../external_wayland_libdecor/src/libdecor.h ${LIBDIR}/wayland_libdecor/include/libdecor-0/libdecor.h
INSTALL_DIR ${LIBDIR}/wayland_libdecor/include/libdecor-0
)

View File

@@ -5,7 +5,16 @@ ExternalProject_Add(external_wayland_protocols
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
# Use `-E` so the `PKG_CONFIG_PATH` can be defined to link against our own WAYLAND.
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env PKG_CONFIG_PATH=${LIBDIR}/wayland/lib64/pkgconfig:$PKG_CONFIG_PATH
${MESON} --prefix ${LIBDIR}/wayland-protocols ${MESON_BUILD_TYPE} . ../external_wayland_protocols -Dtests=false
BUILD_COMMAND ninja
INSTALL_COMMAND ninja install
)
add_dependencies(
external_wayland_protocols
external_wayland
# Needed for `MESON`.
external_python_site_packages
)

View File

@@ -1,20 +1,48 @@
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_xml2
URL file://${PACKAGE_DIR}/${XML2_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${XML2_HASH_TYPE}=${XML2_HASH}
PREFIX ${BUILD_DIR}/xml2
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/xml2/src/external_xml2/ && ${CONFIGURE_COMMAND}
--prefix=${LIBDIR}/xml2
--disable-shared
--enable-static
--with-pic
--with-python=no
--with-lzma=no
--with-zlib=no
--with-iconv=no
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/xml2/src/external_xml2/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/xml2/src/external_xml2/ && make install
INSTALL_DIR ${LIBDIR}/xml2
)
if(WIN32)
set(XML2_EXTRA_ARGS
-DLIBXML2_WITH_ZLIB=OFF
-DLIBXML2_WITH_LZMA=OFF
-DLIBXML2_WITH_PYTHON=OFF
-DLIBXML2_WITH_ICONV=OFF
-DLIBXML2_WITH_TESTS=OFF
-DLIBXML2_WITH_PROGRAMS=OFF
-DBUILD_SHARED_LIBS=OFF
)
ExternalProject_Add(external_xml2
URL file://${PACKAGE_DIR}/${XML2_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${XML2_HASH_TYPE}=${XML2_HASH}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/xml2 ${DEFAULT_CMAKE_FLAGS} ${XML2_EXTRA_ARGS}
PREFIX ${BUILD_DIR}/xml2
INSTALL_DIR ${LIBDIR}/xml2
)
else()
ExternalProject_Add(external_xml2
URL file://${PACKAGE_DIR}/${XML2_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${XML2_HASH_TYPE}=${XML2_HASH}
PREFIX ${BUILD_DIR}/xml2
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/xml2/src/external_xml2/ && ${CONFIGURE_COMMAND}
--prefix=${LIBDIR}/xml2
--disable-shared
--enable-static
--with-pic
--with-python=no
--with-lzma=no
--with-zlib=no
--with-iconv=no
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/xml2/src/external_xml2/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/xml2/src/external_xml2/ && make install
INSTALL_DIR ${LIBDIR}/xml2
)
endif()
if(WIN32 AND BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_xml2 after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/xml2/include ${HARVEST_TARGET}/xml2/include
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/xml2/lib/libxml2s.lib ${HARVEST_TARGET}/xml2/lib/libxml2s.lib
DEPENDEES install
)
endif()

View File

@@ -17,11 +17,13 @@ ExternalProject_Add(external_xvidcore
INSTALL_DIR ${LIBDIR}/xvidcore
)
ExternalProject_Add_Step(external_xvidcore after_install
COMMAND ${CMAKE_COMMAND} -E rename ${LIBDIR}/xvidcore/lib/xvidcore.a ${LIBDIR}/xvidcore/lib/libxvidcore.a || true
COMMAND ${CMAKE_COMMAND} -E remove ${LIBDIR}/xvidcore/lib/xvidcore.dll.a
DEPENDEES install
)
if(WIN32)
ExternalProject_Add_Step(external_xvidcore after_install
COMMAND ${CMAKE_COMMAND} -E rename ${LIBDIR}/xvidcore/lib/xvidcore.a ${LIBDIR}/xvidcore/lib/libxvidcore.a || true
COMMAND ${CMAKE_COMMAND} -E remove ${LIBDIR}/xvidcore/lib/xvidcore.dll.a
DEPENDEES install
)
endif()
if(MSVC)
set_target_properties(external_xvidcore PROPERTIES FOLDER Mingw)

View File

@@ -10,7 +10,8 @@ if(WIN32)
set(YAMLCPP_EXTRA_ARGS
${YAMLCPP_EXTRA_ARGS}
-DBUILD_GMOCK=OFF
-DYAML_MSVC_SHARED_RT=ON)
-DYAML_MSVC_SHARED_RT=ON
)
endif()
ExternalProject_Add(external_yamlcpp
@@ -18,6 +19,7 @@ ExternalProject_Add(external_yamlcpp
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${YAMLCPP_HASH_TYPE}=${YAMLCPP_HASH}
PREFIX ${BUILD_DIR}/yamlcpp
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/yamlcpp ${DEFAULT_CMAKE_FLAGS} ${YAMLCPP_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/yamlcpp
)

View File

@@ -0,0 +1,48 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
# macOS utility to remove all `rpaths` and add a new one.
import os
import re
import subprocess
import sys
# Strip version numbers from dependenciesm macOS notarizatiom fails
# with version symlinks.
def strip_lib_version(name):
name = re.sub(r'(\.[0-9]+)+.dylib', '.dylib', name)
name = re.sub(r'(\.[0-9]+)+.so', '.so', name)
name = re.sub(r'(\.[0-9]+)+.cpython', '.cpython', name)
return name
rpath = sys.argv[1]
file = sys.argv[2]
# Find existing rpaths and delete them one by one.
p = subprocess.run(['otool', '-l', file], capture_output=True)
tokens = p.stdout.split()
for i, token in enumerate(tokens):
if token == b'LC_RPATH':
old_rpath = tokens[i + 4]
subprocess.run(['install_name_tool', '-delete_rpath', old_rpath, file])
subprocess.run(['install_name_tool', '-add_rpath', rpath, file])
# Strip version from dependencies.
p = subprocess.run(['otool', '-L', file], capture_output=True)
tokens = p.stdout.split()
for i, token in enumerate(tokens):
token = token.decode("utf-8")
if token.startswith("@rpath"):
new_token = strip_lib_version(token)
subprocess.run(['install_name_tool', '-change', token, new_token, file])
# Strip version from library itself.
new_file = strip_lib_version(file)
new_id = '@rpath/' + os.path.basename(new_file)
os.rename(file, new_file)
subprocess.run(['install_name_tool', '-id', new_id, new_file])

View File

@@ -1,96 +1,114 @@
strict graph {
graph[autosize = false, size = "25.7,8.3!", resolution = 300, overlap = false, splines = false, outputorder=edgesfirst ];
node [style=filled fillcolor=white];
external_alembic -- external_boost;
external_alembic -- external_zlib;
graph[autosize = false, size = "25.7,8.3!", resolution = 300];
external_alembic -- external_openexr;
external_alembic -- external_imath;
external_blosc -- external_zlib;
external_blosc -- external_pthreads;
external_boost -- Make_Python_Environment;
external_clang -- ll;
external_boost -- external_python;
external_boost -- external_numpy;
external_dpcpp -- external_python;
external_dpcpp -- external_python_site_packages;
external_dpcpp -- external_vcintrinsics;
external_dpcpp -- external_openclheaders;
external_dpcpp -- external_icdloader;
external_dpcpp -- external_mp11;
external_dpcpp -- external_level_zero;
external_dpcpp -- external_spirvheaders;
external_embree -- external_tbb;
external_ffmpeg -- external_zlib;
external_ffmpeg -- external_faad;
external_ffmpeg -- external_openjpeg;
external_ffmpeg -- external_xvidcore;
external_ffmpeg -- external_x264;
external_ffmpeg -- external_opus;
external_ffmpeg -- external_vpx;
external_ffmpeg -- external_theora;
external_ffmpeg -- external_vorbis;
external_ffmpeg -- external_ogg;
external_ffmpeg -- external_lame;
external_ffmpeg -- external_aom;
external_ffmpeg -- external_zlib_mingw;
external_numpy -- Make_Python_Environment;
external_ffmpeg -- external_nasm;
external_freetype -- external_brotli;
external_freetype -- external_zlib;
external_gmpxx -- external_gmp;
external_igc_llvm -- external_igc_opencl_clang;
external_igc_spirv_translator -- external_igc_opencl_clang;
external_igc -- external_igc_vcintrinsics;
external_igc -- external_igc_llvm;
external_igc -- external_igc_opencl_clang;
external_igc -- external_igc_vcintrinsics;
external_igc -- external_igc_spirv_headers;
external_igc -- external_igc_spirv_tools;
external_igc -- external_igc_spirv_translator;
external_igc -- external_flex;
external_ispc -- ll;
external_ispc -- external_python;
external_ispc -- external_flexbison;
external_ispc -- external_flex;
ll -- external_xml2;
ll -- external_python;
external_mesa -- ll;
external_numpy -- external_python;
external_numpy -- external_python_site_packages;
external_ocloc -- external_igc;
external_ocloc -- external_gmmlib;
external_opencollada -- external_xml2;
external_opencolorio -- external_boost;
external_opencolorio -- external_tinyxml;
external_opencolorio -- external_yamlcpp;
external_opencolorio -- external_expat;
external_opencolorio -- external_imath;
external_opencolorio -- external_pystring;
external_openexr -- external_zlib;
external_openimagedenoise -- external_tbb;
external_openimagedenoise -- external_ispc;
external_openimagedenoise -- external_python;
external_openimageio -- external_png;
external_openimageio -- external_zlib;
external_openimageio -- external_openexr;
external_openimageio -- external_openexr;
external_openimageio -- external_imath;
external_openimageio -- external_jpeg;
external_openimageio -- external_boost;
external_openimageio -- external_tiff;
external_openimageio -- external_opencolorio;
external_openimageio -- external_pugixml;
external_openimageio -- external_fmt;
external_openimageio -- external_robinmap;
external_openimageio -- external_openjpeg;
external_openimageio -- external_webp;
external_openimageio -- external_opencolorio_extra;
external_openmp -- external_clang;
external_openmp -- ll;
external_openpgl -- external_tbb;
external_opensubdiv -- external_tbb;
openvdb -- external_tbb;
openvdb -- external_boost;
openvdb -- external_openexr;
openvdb -- external_openexr;
openvdb -- external_zlib;
openvdb -- external_blosc;
external_osl -- external_boost;
external_osl -- ll;
external_osl -- external_clang;
external_osl -- external_openexr;
external_osl -- external_openexr;
external_osl -- external_zlib;
external_osl -- external_flexbison;
external_osl -- external_openimageio;
external_osl -- external_pugixml;
external_osl -- external_flexbison;
external_osl -- external_flex;
external_png -- external_zlib;
external_python_site_packages -- Make_Python_Environment;
external_python -- external_bzip2;
external_python -- external_ffi;
external_python -- external_lzma;
external_python -- external_ssl;
external_python -- external_sqlite;
external_python -- external_zlib;
external_python_site_packages -- external_python;
external_sndfile -- external_ogg;
external_sndfile -- external_vorbis;
external_sndfile -- external_flac;
external_theora -- external_vorbis;
external_theora -- external_ogg;
external_tiff -- external_zlib;
external_usd -- external_tbb;
external_usd -- external_boost;
external_usd -- external_opensubdiv;
external_vorbis -- external_ogg;
blender-- external_ffmpeg;
blender-- external_alembic;
blender-- external_openjpeg;
blender-- external_opencolorio;
blender-- external_openexr;
blender-- external_opensubdiv;
blender-- openvdb;
blender-- external_osl;
blender-- external_boost;
blender-- external_jpeg;
blender-- external_png;
blender-- external_python;
blender-- external_sndfile;
blender-- external_iconv;
blender-- external_fftw3;
external_python-- external_python_site_packages;
external_python_site_packages-- requests;
external_python_site_packages-- idna;
external_python_site_packages-- chardet;
external_python_site_packages-- urllib3;
external_python_site_packages-- certifi;
external_python-- external_numpy;
external_usd-- external_boost;
external_usd-- external_tbb;
blender-- external_opencollada;
blender-- external_sdl;
blender-- external_freetype;
blender-- external_pthreads;
blender-- external_zlib;
blender-- external_openal;
blender-- external_usd;
external_wayland -- external_expat;
external_wayland -- external_xml2;
external_wayland -- external_ffi;
external_wayland_protocols -- external_wayland;
external_x264 -- external_nasm;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,130 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-2.0-or-later
# This script is part of the official build environment, see wiki page for details.
# https://wiki.blender.org/wiki/Building_Blender/Other/Rocky8ReleaseEnvironment
set -e
if [ `id -u` -ne 0 ]; then
echo "This script must be run as root"
exit 1
fi
# Required by: config manager command below to enable powertools.
dnf install 'dnf-command(config-manager)'
# Packages `ninja-build` and `meson` are not available unless CBR or PowerTools repositories are enabled.
# See: https://wiki.rockylinux.org/rocky/repo/#notes-on-unlisted-repositories
dnf config-manager --set-enabled powertools
# Required by: epel-release has the patchelf and rubygem-asciidoctor packages
dnf install epel-release
# `yum-config-manager` does not come in the default minimal install,
# so make sure it is installed and available.
yum -y update
yum -y install yum-utils
# Install all the packages needed for a new tool-chain.
#
# NOTE: Keep this separate from the packages install, since otherwise
# older tool-chain will be installed.
yum -y update
yum -y install scl-utils
yum -y install scl-utils-build
# Currently this is defined by the VFX platform (CY2023), see: https://vfxplatform.com
yum -y install gcc-toolset-11
# Install packages needed for Blender's dependencies.
PACKAGES_FOR_LIBS=(
# Used to checkout Blender's code.
git
# Used to checkout Blender's `../lib/` directory.
subversion
# Used to extract packages.
bzip2
# Used to extract packages.
tar
# Blender and some dependencies use `cmake`.
cmake3
# Apply patches from Blender's: `./build_files/build_environment/patches`
patch
# Use by `cmake` and `autoconf`.
make
# Required by: `external_nasm` which uses an `autoconf` build-system.
autoconf
automake
libtool
# Used to set rpath on shared libraries
patchelf
# Builds generated by meson use Ninja for the actual build.
ninja-build
# Required by Blender build option: `WITH_GHOST_WAYLAND`.
mesa-libEGL-devel
# Required by: Blender & `external_opensubdiv` (probably others).
mesa-libGL-devel
mesa-libGLU-devel
# Required by: `external_ispc`.
zlib-devel
# TODO: dependencies build without this, consider removal.
rubygem-asciidoctor
# TODO: dependencies build without this, consider removal.
wget
# Required by: `external_sqlite` as a build-time dependency (needed for the `tclsh` command).
tcl
# Required by: `external_aom`.
# TODO: Blender is already building `external_nasm` which is listed as an alternative to `yasm`.
# Why are both needed?
yasm
# NOTE(@campbellbarton): while `python39` is available, the default Python version is 3.6.
# This is used for the `python3-mako` package for e.g.
# So use the "default" system Python since it means it's most compatible with other packages.
python3
# Required by: `external_mesa`.
python3-mako
# Required by: `external_mesa`.
expat-devel
# Required by: `external_igc` & `external_osl` as a build-time dependency.
bison
# Required by: `external_osl` as a build-time dependency.
flex
# Required by: `external_ispc`.
ncurses-devel
# Required by: `external_ispc` (when building with CLANG).
libstdc++-static
)
# Additional packages needed for building Blender.
PACKAGES_FOR_BLENDER=(
# Required by Blender build option: `WITH_GHOST_WAYLAND`.
libxkbcommon-devel
# Required by Blender build option: `WITH_GHOST_X11`.
libX11-devel
libXcursor-devel
libXi-devel
libXinerama-devel
libXrandr-devel
libXt-devel
libXxf86vm-devel
)
yum -y install -y ${PACKAGES_FOR_LIBS[@]} ${PACKAGES_FOR_BLENDER[@]}
# Dependencies for pip (needed for `buildbot-worker`), uses Python3.6.
yum -y install python3 python3-pip python3-devel
# Dependencies for asound.
yum -y install -y \
alsa-lib-devel pulseaudio-libs-devel

View File

@@ -0,0 +1,74 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-2.0-or-later
# This script ensures:
# - One dependency is built at a time.
# - That dependency uses all available cores.
#
# Without this, simply calling `make -j$(nproc)` from the `${CMAKE_BUILD_DIR}/deps/`
# directory will build many projects at once.
#
# This is undesirable for the following reasons:
#
# - The output from projects is mixed together,
# making it difficult to track down the cause of a build failure.
#
# - Larger dependencies such as LLVM can bottleneck the build process,
# making it necessary to cancel the build and manually run build commands in each directory.
#
# - Building many projects at once means canceling (Control-C) can lead to the build being in an undefined state.
# It's possible canceling happens as a patch is being applied or files are being copied.
# (steps that aren't part of the compilation process where it's typically safe to cancel).
if [[ -z "$MY_MAKE_CALL_LEVEL" ]]; then
export MY_MAKE_CALL_LEVEL=0
export MY_MAKEFLAGS=$MAKEFLAGS
# Extract the jobs argument (`-jN`, `-j N`, `--jobs=N`).
add_next=0
for i in "$@"; do
case $i in
-j*)
export MY_JOBS_ARG=$i
if [ "$MY_JOBS_ARG" = "-j" ]; then
add_next=1
fi
;;
--jobs=*)
shift # past argument=value
MY_JOBS_ARG=$i
;;
*)
if (( add_next == 1 )); then
MY_JOBS_ARG="$MY_JOBS_ARG $i"
add_next=0
fi
;;
esac
done
unset i add_next
if [[ -z "$MY_JOBS_ARG" ]]; then
MY_JOBS_ARG="-j$(nproc)"
fi
export MY_JOBS_ARG
# Support user defined `MAKEFLAGS`.
export MAKEFLAGS="$MY_MAKEFLAGS -j1"
else
export MY_MAKE_CALL_LEVEL=$(( MY_MAKE_CALL_LEVEL + 1 ))
if (( MY_MAKE_CALL_LEVEL == 1 )); then
# Important to set jobs to 1, otherwise user defined jobs argument is used.
export MAKEFLAGS="$MY_MAKEFLAGS -j1"
elif (( MY_MAKE_CALL_LEVEL == 2 )); then
# This is the level used by each sub-project.
export MAKEFLAGS="$MY_MAKEFLAGS $MY_JOBS_ARG"
fi
# Else leave `MY_MAKEFLAGS` flags as-is, avoids setting a high number of jobs on recursive
# calls (which may easily run out of memory). Let the job-server handle the rest.
fi
# Useful for troubleshooting the wrapper.
# echo "Call level: $MY_MAKE_CALL_LEVEL, args=$@".
# Call actual make but ensure recursive calls run via this script.
exec make MAKE="$0" "$@"

View File

@@ -0,0 +1,18 @@
diff -Naur libaom-3.4.0/build/cmake/aom_configure.cmake external_aom/build/cmake/aom_configure.cmake
--- libaom-3.4.0/build/cmake/aom_configure.cmake 2022-06-17 11:46:18 -0600
+++ external_aom/build/cmake/aom_configure.cmake 2022-10-16 15:35:54 -0600
@@ -15,8 +15,12 @@
include(FindGit)
include(FindPerl)
-include(FindThreads)
-
+# Blender: This will drag in a dep on libwinpthreads which we prefer
+# not to have, aom will fallback on a native win32 thread wrapper
+# if pthreads are not found.
+if(NOT WIN32)
+ include(FindThreads)
+endif()
include("${AOM_ROOT}/build/cmake/aom_config_defaults.cmake")
include("${AOM_ROOT}/build/cmake/aom_experiment_deps.cmake")
include("${AOM_ROOT}/build/cmake/aom_optimization.cmake")

View File

@@ -0,0 +1,12 @@
--- a/boost/python//detail/wrap_python.hpp 2022-12-09 19:16:17
+++ b/boost/python//detail/wrap_python.hpp 2022-12-09 19:18:08
@@ -206,7 +206,8 @@
#ifdef DEBUG_UNDEFINED_FROM_WRAP_PYTHON_H
# undef DEBUG_UNDEFINED_FROM_WRAP_PYTHON_H
-# define _DEBUG
+// BLENDER: TBB excepts this to have a value.
+# define _DEBUG 1
# ifdef _CRT_NOFORCE_MANIFEST_DEFINED_FROM_WRAP_PYTHON_H
# undef _CRT_NOFORCE_MANIFEST_DEFINED_FROM_WRAP_PYTHON_H
# undef _CRT_NOFORCE_MANIFEST

View File

@@ -1,4 +1,4 @@
using python : @PYTHON_SHORT_VERSION@ : @PYTHON_BINARY@
: @LIBDIR@/python/include @LIBDIR@/python/include/python@PYTHON_SHORT_VERSION@m/
: @LIBDIR@/python/include @LIBDIR@/python/include/python@PYTHON_SHORT_VERSION@/
: @LIBDIR@/python/libs
;

View File

@@ -177,7 +177,8 @@ if(ILMBASE_INCLUDE_DIR)
"\\1" XYZ ${ILMBASE_BUILD_SPECIFICATION})
set("ILMBASE_VERSION" ${XYZ} CACHE STRING "Version of ILMBase lib")
else()
# Old versions (before 2.0?) do not have any version string, just assuming 2.0 should be fine though.
# Old versions (before 2.0?) do not have any version string,
# just assuming 2.0 should be fine though.
message(WARNING "Could not determine ILMBase library version, assuming 2.0.")
set("ILMBASE_VERSION" "2.0" CACHE STRING "Version of ILMBase lib")
endif()
@@ -195,8 +196,13 @@ else()
# elseif(${ILMBASE_VERSION} VERSION_LESS "2.1")
set(IlmBase_Libraries Half Iex Imath IlmThread)
# else()
# string(REGEX REPLACE "([0-9]+)[.]([0-9]+).*" "\\1_\\2" _ilmbase_libs_ver ${ILMBASE_VERSION})
# set(IlmBase_Libraries Half Iex-${_ilmbase_libs_ver} Imath-${_ilmbase_libs_ver} IlmThread-${_ilmbase_libs_ver})
# string(REGEX REPLACE "([0-9]+)[.]([0-9]+).*" "\\1_\\2" _ilmbase_libs_ver ${ILMBASE_VERSION})
# set(IlmBase_Libraries
# Half
# Iex-${_ilmbase_libs_ver}
# Imath-${_ilmbase_libs_ver}
# IlmThread-${_ilmbase_libs_ver}
# )
endif()

View File

@@ -175,7 +175,8 @@ if(OPENEXR_INCLUDE_DIR)
"\\1" XYZ ${OPENEXR_BUILD_SPECIFICATION})
set("OPENEXR_VERSION" ${XYZ} CACHE STRING "Version of OpenEXR lib")
else()
# Old versions (before 2.0?) do not have any version string, just assuming 2.0 should be fine though.
# Old versions (before 2.0?) do not have any version string,
# just assuming 2.0 should be fine though.
message(WARNING "Could not determine ILMBase library version, assuming 2.0.")
set("OPENEXR_VERSION" "2.0" CACHE STRING "Version of OpenEXR lib")
endif()

View File

@@ -1,2 +0,0 @@
cmake_minimum_required (VERSION 2.4)
add_subdirectory(build/cmake)

View File

@@ -0,0 +1,36 @@
diff -Naur llvm-sycl-nightly-20220501.orig\opencl/CMakeLists.txt llvm-sycl-nightly-20220501\opencl/CMakeLists.txt
--- llvm-sycl-nightly-20220501.orig/opencl/CMakeLists.txt 2022-04-29 13:47:11 -0600
+++ llvm-sycl-nightly-20220501/opencl/CMakeLists.txt 2022-05-21 15:25:06 -0600
@@ -11,6 +11,11 @@
)
endif()
+# Blender code below is determined to use FetchContent_Declare
+# temporarily allow it (but feed it our downloaded tarball
+# in the OpenCL_HEADERS variable
+set(FETCHCONTENT_FULLY_DISCONNECTED OFF)
+
# Repo URLs
set(OCL_HEADERS_REPO
@@ -77,5 +82,6 @@
FetchContent_MakeAvailable(ocl-icd)
add_library(OpenCL-ICD ALIAS OpenCL)
+set(FETCHCONTENT_FULLY_DISCONNECTED ON)
add_subdirectory(opencl-aot)
diff -Naur llvm-sycl-nightly-20220208.orig/libdevice/cmake/modules/SYCLLibdevice.cmake llvm-sycl-nightly-20220208/libdevice/cmake/modules/SYCLLibdevice.cmake
--- llvm-sycl-nightly-20220208.orig/libdevice/cmake/modules/SYCLLibdevice.cmake 2022-02-08 09:17:24 -0700
+++ llvm-sycl-nightly-20220208/libdevice/cmake/modules/SYCLLibdevice.cmake 2022-05-24 11:35:51 -0600
@@ -36,7 +36,9 @@
add_custom_target(libsycldevice-obj)
add_custom_target(libsycldevice-spv)
-add_custom_target(libsycldevice DEPENDS
+# Blender: add ALL here otherwise this target will not build
+# and cause an error due to missing files during the install phase.
+add_custom_target(libsycldevice ALL DEPENDS
libsycldevice-obj
libsycldevice-spv)

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