Commit Graph

108571 Commits

Author SHA1 Message Date
Iliya Katueshenock
2cb3677557 Geometry Nodes: Rewrite Scale Elements node
Rewrite of Scale Elements. Main changes related with removing unnecessary
abstractions (like structures of fields). Next, by using grouping approach,
all data is represented as spans. This provide ability to unify code for
different domains. Using of general utils like IndexMask, Group processing
and array utils provides much more parallelism and better memory usage.
In result, this refactoring result in 4-10 average speed improvement in
attached benchmark file with different probability and scale of elements.

See the PR for more before/after timing information and a benchmark file.

Pull Request: https://projects.blender.org/blender/blender/pulls/115142
2024-04-15 21:55:37 +02:00
Harley Acheson
ddec0740d6 BLF: Better Specification of CJK Font Unicode Coverage
For our built-in fonts (in our stack) we specify the Unicode page
coverage that they support, to avoid loading fonts unnecessarily to see
if they have a particular character.  This way we skip over fonts to
get to symbols, etc. With our CJK (Chinese, Japanese, Korean) font
though we are using the supplied coverage bit values, which includes
more than we want. We only want to load this font for CJK-related pages
to ensure that we use more tailored fonts for other specific languages
and uses later in the font stack.

Pull Request: https://projects.blender.org/blender/blender/pulls/120676
2024-04-15 21:37:40 +02:00
Hans Goudey
75804f2dd0 Fix #120575: GPU subdivision ignores split normals from sharp edges
Fall back to CPU subdivision when there are split edges and the mesh
normals domain is face corners. This is required because splitting the
normals on faces adjacent to sharp edges doesn't work well with the
performance requirements of GPU subdivision.

This is related to 1111903416

Pull Request: https://projects.blender.org/blender/blender/pulls/120674
2024-04-15 21:19:54 +02:00
Harley Acheson
a6b79d7763 BLF: Ignore Combining Characters for Mouse Selection
When we iterate through glyph bounding boxes, we should ignore
combining characters, those without an advance. These types of
characters are placed over top of others, like for diacritical marks.
We never have a need to consider these, only for the parent glyph.
Otherwise mouse insertion of text cursor can occur at the wrong
location, at the edge of a diacritical mark.

Pull Request: https://projects.blender.org/blender/blender/pulls/120675
2024-04-15 21:19:04 +02:00
Harley Acheson
b38f27ae10 Refactor: BLF Offset from Cursor Position Early Exits
BLF function blf_str_offset_from_cursor_position returns the character
offset in a string given a horizontal cursor position. It currently has
no early exits, but can do so for no string or empty string. For negative
position values (so left of the string), do not exit out with zero but
instead act as if it were zero to ensure we test against the first glyph,
which might not be part of the character.

Pull Request: https://projects.blender.org/blender/blender/pulls/120673
2024-04-15 20:50:23 +02:00
Jacques Lucke
c4f1c4d882 Fix #120650: crash when using viewer node in curves sculpt mode
The issue was that `OVERLAY_sculpt_curves_cache_populate` assumes
that the object is a curves object, which was not always the case. Now this
is checked a bit more explicitly.

The solution is still not ideal, because now the cage overlay is not shown
at all when the viewer node is used and the result is something else than
curves, but that needs to be solved separately.
2024-04-15 20:06:59 +02:00
Damien Picard
abc0bf814f UI: Fix and improve a few messages
- "Log Encoding with Chroma inset and rotation": add "of primaries" in
  the description of the AgX Log color space to better explain the
  operation, based on wording in !106355.
- Remove a few double spaces.
- Make Line Art title case everywhere, to convey it's the system /
  brand / product name and not the generic concept.
- "Copy Absolute coordinates or Normal vector" -> "of Normal Vector":
typo.
- "Makes a link between selected output in input sockets" ->
  "Make...", "output and input": typo.
- "Purge Unused Data From This File" -> "from this": title case as per
  HIGs.
- GPencil -> Grease Pencil: no reason to use an abbreviation here.
- "Around Current Frame" -> "Around Frame": actual name of the
  onion-skinning method.
- "... (layer height for layer tool, i.e.)" -> "(i.e. the layer height
  for the layer tool)": put "i.e." at the start of the sentence.
- Expand description of toe-in stereo camera option.
- "Children collections their parent-collection-specific settings" ->
  "Children collections with their...": typo.
- "Generate vertex weights base on..." -> "based on" : typo, lower
  case.
- Expand description of GP modifier properties, based on their mesh
  counterparts.
- "AEnvelope" -> "Envelope": typo.
- "Falloff type the feather" -> "of the feather": typo.
- "usually make transition as long as effect strip": rephrase.
- "When disabled a users extensions directory is created" -> "a
  user's": typo.
- "successfull" -> "successful": typo.
- "Remove all attributes... a single wildcard (*).": remove trailing
  ".".
- "..., use "Save Preferences."": remove trailing ".".

Some issues reported by Marina Veselkova and Tamar Mebonia.

Pull Request: https://projects.blender.org/blender/blender/pulls/120649
2024-04-15 20:02:38 +02:00
Bastien Montagne
0a7510ebaa Fix #116818: Unlinking an Object in the Scene Collection unlinks all linked objects
Code was assuming that if an object had a Scene parent ID (in Outliner
context), Outliner was in Scene view and object had to be removed from
whole scene.

However, in ViewLayer view, in case an object is in a Scene's main
collection, its parent item is the scene.
2024-04-15 18:42:45 +02:00
Bartosz Kosiorek
dc35737b69 Fix: Move CFL Number parameter for Fluid into Adaptive Time Steps
The CFL Number is only used when Adaptive Time Steps is enabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/120666
2024-04-15 18:39:36 +02:00
Harley Acheson
aae8b956dd Refactor: BLF Extract Function BLF_str_offset_to_cursor
Move into own BLF function, code that returns a text cursor (caret)
position given a string offset. This code is currently just in
interface_widgets.cc but should be a separate BLF function.

Pull Request: https://projects.blender.org/blender/blender/pulls/120622
2024-04-15 18:29:25 +02:00
Jacques Lucke
188123c9ad Fix #111394: crash when deleting node group with active viewer nested inside
The case when the tree-path of a node editor is out of date is handled more
gracefully now. Generally, one should also look into eagerly updating the
tree-path in this case, but that can be done separately.
2024-04-15 18:09:32 +02:00
Jacques Lucke
bd72562ff9 Geometry Nodes: handle matrix to rotation conversion more gracefully
Previously, this conversion would often result in invalid quaternions or
hit an assert in `normalized_to_quat_fast`. It's not super nice to convert
to euler as an intermediate step performance wise, but it seems to be
the easiest solution for now. Extracting rotations from matrices should
not be done all that often anyway.

Pull Request: https://projects.blender.org/blender/blender/pulls/120568
2024-04-15 18:04:19 +02:00
Miguel Pozo
65d9311291 Fix: EEVEE-Next: Shadow Ray accumulation
Fix when ray_count > 1.
Regression from 77638a6.
2024-04-15 16:40:59 +02:00
Brecht Van Lommel
67582ed337 Fix: MaterialX export of Noise Texture colored for Fac output
Fixes blender/blender-addons#105266

Pull Request: https://projects.blender.org/blender/blender/pulls/120661
2024-04-15 15:23:26 +02:00
Aras Pranckevicius
e2e6b977a6 Cleanup: Remove pre-SSE4 fallbacks in BLI pixel interpolation functions
Commit 8b9743eb40 already made Blender be compiled with SSE4.2 flags
on x64 architecture, which kicked in the SSE4 code paths in
BLI_math_interp functions.

Which made them faster, e.g. in VSE on Windows/Ryzen5950X, scaling
up an image to 4K resolution:
- Bilinear 5.8ms -> 5.3ms
- Cubic Mitchell 16.3ms -> 15.7ms

This change removes the now-unneeded SSE pre-SSE4 code paths for
_mm_floor_ps, _mm_min_epi32 and _mm_max_epi32 emulation.

Additionally, including BLI_simd.h on SSE4 platform now includes
the necessary SSE4 intrinsics header.

Pull Request: https://projects.blender.org/blender/blender/pulls/120583
2024-04-15 15:21:58 +02:00
Campbell Barton
904d51d6cb RNA: use boolean for function callbacks & "valid" iterator state
Integers were used when the value is logically a boolean.

Ref !120130
2024-04-15 23:04:38 +10:00
Bartosz Kosiorek
9a0a75eff0 Fix: Prevent liquid leaking through effector with default settings
When a liquid is created together with collision/effector with default
settings, it often happens that the liquid is leaking through the solid
object/effector.

Change the CFL default value to decrease the chance of this happening.
There appears to be no noticeable performance impact in common cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/120355
2024-04-15 14:55:31 +02:00
Bartosz Kosiorek
ddb4aba4ef UI: Add tooltips for inputs of vector shaders nodes
Pull Request: https://projects.blender.org/blender/blender/pulls/119472
2024-04-15 13:40:51 +02:00
Clément Foucault
a772c84341 EEVEE-Next: Changes to thickness output
This contains two thing:
- default (nothing connected to socket) uses the bounding box min axis.
- transform the value plugged to the socket to world space.

We arbitrarly choose to output the axis with the minimum extent since
it is the axis along which the object is usually viewed at.

Rel #120384

Pull Request: https://projects.blender.org/blender/blender/pulls/120607
2024-04-15 12:16:51 +02:00
Damien Picard
c306677119 I18n: extract and disambiguate a few messages
Extract
- Statuses for the external text editor
- Newly created enum node item
- Newly created plane track data
- Newly created custom orientation data
- Operator names in drag and drop menu (need to use operator's
  translation context)
- GN attribute statistic node inputs

Disambiguate
- Single-letter colors: A and B can mean Alpha and Blue, or simply A
  and B as in two operands in an operation
- Dissolve: issue reported by Tamar Mebonia in #43295
- Translate in the User Preferences. This introduces a new
  BLT_I18NCONTEXT_EDITOR_PREFERENCES ("Preferences") translation
  context
- Planar (reported by deathblood)
  This one is incomplete, because there is currently no way to
  disambiguate presets or GN fields. I don't see how either could be
  achieved cleanly.
  The former would need to define the context inside the preset and
  evaluate the file prior to showing it in the presets menu, which
  sound bad.
  The latter would need to introduce an additional string inside
  `FieldInput`s, which would be controversial given how little it
  would be used.

Remove
- Unused translation `iface_("%s")` in toolbar
- Remove obsolete N_() tags in a few node descriptions.

Pull Request: https://projects.blender.org/blender/blender/pulls/119065
2024-04-15 12:02:17 +02:00
Sybren A. Stüvel
1315991ecb Anim: add keytype argument to keyframe_insert() RNA function
Add an optional keyword argument `keytype` to the
`rna_struct.keyframe_insert()` function.

This makes it possible to set the new key's type. The code for this was
almost all in place, the only thing that was missing was the RNA
wrapper, which is what this commit adds.

Example: `bpy.context.object.keyframe_insert("location",
keytype='JITTER')`

There is no backward compatibility issue here, because the argument is
optional and defaults to the previously hardcoded value of `KEYFRAME`.

Pull Request: https://projects.blender.org/blender/blender/pulls/120578
2024-04-15 11:36:38 +02:00
Sybren A. Stüvel
51e1f29a68 Anim: Add new keyframe type 'GENERATED'
Add a new keyframe type named 'generated', which is meant to indicate
that the key was set by some automated tool (like an add-on), rather
than manually by an animator.

This is meant for tooling that needs to create keys in a repeatable way.
With this new key type, the tool can know which keys it generated
before, and thus those can be removed and re-generated.

Pull Request: https://projects.blender.org/blender/blender/pulls/120564
2024-04-15 10:42:54 +02:00
Jesse Yurkovich
411371aa54 Fix: Sanitize filename for collection export
When creating a filename for use with a File Handler, we should guard
against problematic characters like "/" and "\\", among others, which are
not safe to use in paths. Sanitize the incoming name with
`BLI_path_make_safe_filename` to ensure the name can be used.

For empty incoming names, or names containing all spaces, we default to
"untitled" before adding the extension.

Pull Request: https://projects.blender.org/blender/blender/pulls/120652
2024-04-15 06:15:46 +02:00
Campbell Barton
49bf7ebbdd Cleanup: use const args & variables, remove redundant checks
- Declare const variables & arguments.
- Remove redundant null checks.
- Remove break after return.
- Replace suspicious "&" with "&&".
2024-04-15 09:50:47 +10:00
Hans Goudey
740d1fbc4b Geometry Nodes: Log socket values for node tools
To ease the process of debugging a node group while creating
a node tool, while the group is visible in a node editor, log the socket
values from its last execution. The values are only logged for the
active object is nothing selected. The Viewer node is still not supported
because visualization would probably be very tricky.

Pull Request: https://projects.blender.org/blender/blender/pulls/120596
2024-04-14 16:47:46 +02:00
Clément Foucault
bfd0105213 Fix: EEVEE-Next: Compilation error in forward + sss material 2024-04-14 16:34:08 +02:00
Campbell Barton
c31b4b810c Cleanup: pass by const reference instead of value 2024-04-14 23:09:35 +10:00
Jacques Lucke
c819d9fdc9 Fix #120579: incorrect compute context hashes
The problem was that `XXH3_128bits` was called on `len` bytes
and not `HashSizeInBytes + len` as before 51f8bf53b2.
This lead to more compute context duplicates that one would expect.

I changed the code a little bit to make this mistake less likely in case
the hash function is ever changed to something else.
2024-04-14 13:20:32 +02:00
Campbell Barton
c9a79f9a3c WM: handle multiple wheel events from GHOST
Scrolling the mouse wheel fast can generate multiple click-steps
which were ignored by window manager events.

This meant scrolling fast with a trackpad (with "Multi-touch gestures"
disabled) for e.g. would zoom less than the gesture made more slowly.
2024-04-14 17:55:20 +10:00
Campbell Barton
a70d6d79dd Cleanup: various non-functional C++ changes 2024-04-14 12:24:17 +10:00
Campbell Barton
6e3eaae299 Cleanup: spelling in comments 2024-04-14 12:13:55 +10:00
Harley Acheson
968528bde6 UI: Slight Adjust Last Operation Changes
Adjust Last Operation dialog gets a title with a line underneath and
slight change to margins to better match other similar dialogs. A
change agreed to in our last UI meeting.

Pull Request: https://projects.blender.org/blender/blender/pulls/120625
2024-04-14 04:03:43 +02:00
Campbell Barton
43179864f4 Cleanup: remove strcpy usage 2024-04-14 11:58:14 +10:00
Iliya Katueshenock
dd672c38b1 Fix #117515: Geometry Nodes: Count of unique face neighbors
Regular topology mapping does not care about deduplication of relations. And
this is correct for a lot of the case where we expect creating difference of this
relations in next operations. But this is not the case for users, since this should
be actually trivial info. Due to this reason, construct full topology map and count
number of unique connections. Performance side: difference linear check and
hash set for different sizes of connections set.

Pull Request: https://projects.blender.org/blender/blender/pulls/118848
2024-04-14 01:08:10 +02:00
Bastien Montagne
48baa80a05 Fix #120287: Annotations GPv2 data must not be converted.
This commit ensures that no legacy GP data is shared between GP objects
and annotations, before doing the conversion, by duplicating annotation
data when required.

Conversion code can then completely ignore annotation GPv2 IDs.

Pull Request: https://projects.blender.org/blender/blender/pulls/120581
2024-04-13 15:44:51 +02:00
Clément Foucault
fdf5a05bde Fix: EEVEE-Next: Broken shader compilation because of displacement
Oversight inside f371624b2e
2024-04-13 12:57:50 +02:00
Clément Foucault
f371624b2e Fix: EEVEE-Next: Displacement: Wrong output space
The space of the displacement socket on the ouput node
is local space. We now scale it back to world space
as expected by the consumer code.
2024-04-13 12:37:29 +02:00
Clément Foucault
b0e291952b EEVEE-Next: Light: Explicit loop unrolling for better codegen
Now that there is a condition in the loop count there is
possibility the compiler doesn't optimize this. Be
conservative an manually unroll for better codegen.
2024-04-13 12:21:07 +02:00
Clément Foucault
16059aca59 Fix: EEVEE-Next: Shadow with transmission
This fixes a few issues:
- Split of shadows in different direction caused by
  the shadow normal bias.
- Fixes #120599 by reverting to light vector to
  bias the shadow test.

Cleanup now unused variables.
2024-04-13 12:08:08 +02:00
Clément Foucault
a4e9224317 Fix: EEVEE-Next: Shadow broken for transmission BSDFs
Was not inverting the normal for `shadow_ray_above_horizon_ensure`.
2024-04-13 10:50:33 +02:00
Clément Foucault
ba0921e75e Fix: EEVEE-Next: Broken refraction thickness
Some parts were not offseting the ray in the right
directions.
2024-04-13 09:14:14 +02:00
Clément Foucault
b07d392b5a MTL: Remove warning in debug build 2024-04-13 09:12:22 +02:00
Hans Goudey
c91449836a Cleanup: Move BKE_workspace.h to C++ 2024-04-12 17:03:18 -04:00
Hans Goudey
75077a8b0e Refactor: Move node tools OperatorComputeContext to blenkernel
For socket value logging this needs to be used in a couple other places.
Also remove the operator name argument. For the forseable future this
will only be used with the existing node tools operator anyway.
2024-04-12 16:16:55 -04:00
Clément Foucault
77638a6bec EEVEE-Next: Fix missing shadow caused by ray going below surface
This should fix the light leaking present in most curved surfaces.
This is completely ad-hoc and should be fixed better.
2024-04-12 22:08:38 +02:00
Clément Foucault
8dfcb121d4 EEVEE-Next: Add consistent support for thickness output
This add support for the thickness output in a consistent
manner across all BSDF.

If thickness is above zero, for any ray going below the
surface, the object is modeled as a sphere tangent to
the shading point and of diameter equal to the given
thickness. The ray is then intersected with that sphere
and transmitted out.

This model perfectly matches a raytracer behavior
for a sphere model of diameter equal to thickness.

This replaces the old refraction depth model which was
modelling a infinite slab of material.

For simplicity, we do not do 2 microfacet transmission
events. We simply use the main lobe direction for the
first interface. This still matches the raytracer
behavior for smooth surfaces. Weirdly enough the
apparent roughness doesn't need to be amended.

To get shadowing and translucency approximation
to work, this splits the transmission BSDF evaluation
to its own light loop. This simplifies a lot of logic
and assumes only one transmission BSDF is ever
sampled in a nodetree.

This changes the behavior of the thickness output
with regard to the thickness from shadow. We now take
the min instead of the max between both. This
break a lot of file since the default thickness is
set to `0.1`.

This patch doesn't change the default thickness output
behavior but it will be changed in another PR.

Note this might change the shadow sampling pattern
since translucent and non-translucent are now
sampling them separately.

Pull Request: https://projects.blender.org/blender/blender/pulls/120329
2024-04-12 22:06:25 +02:00
Jesse Yurkovich
b24ac18130 Alembic: Support new Curves object type for export
Support the new Curves object type in Alembic when exporting curve data.
Make corresponding fixes to importing at the same time.

Summary of changes
 - Exporter now supports the `Curves` object type during Export
   including when using the convert to mesh option
 - Exporter will now enforce that only 1 combination of curve type and
   periodicity are in a given object [0].
 - Catmul-rom basis curves are now supported and will be used for Hair
   data [1].
 - Bezier curves are exported with their left/right handle data [2].
 - Cyclic bezier and nurbs curves should be handled correctly now.

Along the way this required changes on the Import side as well in order
to be complete
 - Importer will now load bezier curve handle data correctly
 - Importer could fail to set the correct cyclic data on the last spline
   of a multi-curve object

See PR for screenshots

[0] See https://github.com/alembic/alembic/blob/master/lib/Alembic/AbcGeom/OCurves.h#L55
Prior to this change the Alembic exporter could write invalid data to
the file in these cases.
[1] Alembics created with the new Curves Hair object with this patch
will not be loadable in prior versions of Blender. The importer does not
handle the curve data correctly and will crash.
[2] There was a long-standing TODO about how to handle bezier curve data
since nothing is documented on Alembic's side. Bezier data wouldn't even
round-trip properly inside Blender itself. On a hunch, because USD was
influenced by certain aspects of Alembic which came before it, I decided
to try writing out the data the same way as USD. That turned out to work
quite well in at least 1 external software so that's what this patch
will use for both import and export.

Pull Request: https://projects.blender.org/blender/blender/pulls/119894
2024-04-12 21:27:15 +02:00
Germano Cavalcante
f38c4d42bd Fix #120244: Snap cursor does not work in some Quad-View regions
The xy coordinates depend on the region, so we need to make sure we
pass the correct region.
2024-04-12 15:01:38 -03:00
Hans Goudey
3744b54790 Cleanup: Fix location of #pragma once in some headers 2024-04-12 12:52:51 -04:00
Hans Goudey
5c10f9fcb3 Fix #120549: Broken triangles in viewport with multiple materials
Error in 0f46e02310

The maximum index in the triangles index buffer was set incorrectly,
causing the GPU code to switch to using 16 bit integers when it shouldn't.
2024-04-12 12:38:25 -04:00