Commit Graph

123697 Commits

Author SHA1 Message Date
Sebastian Herholz
3298c61d1f Deps: Updating to Open PGL 0.5.0
Pull Request: https://projects.blender.org/blender/blender/pulls/107343
2023-04-29 12:58:08 +02:00
Chris Blackbourn
ca00cb5470 Cleanup: format 2023-04-29 13:50:23 +12:00
Campbell Barton
d145dfdae0 Fix #107443 movie clip fails to load
Regression with incorrect sizeof argument to BLI_path_sequence_encode.

[0]: 6701d24084
2023-04-29 11:31:16 +10:00
Joseph Eagar
2d2f4d9d28 Cleanup: Rename StrokeCache.original to .accum
Note: the value is inverted, StrokeCache.accum = !StrokeCache.original.
2023-04-28 17:58:26 -07:00
Joseph Eagar
15d2487e26 Sculpt: Fix #105303: improper setting of SculptCache.original
I'm going to rename this in a seperate commit
2023-04-28 17:53:47 -07:00
Chris Blackbourn
69d52c5f1c UV: Fix uv packing overflow with fraction margin method
When UV Packing with the `fraction` margin method, if the UVs
overflowed the unit square, the UVs could sometimes overlap.

(island_index was incorrect.)
2023-04-29 10:25:40 +12:00
Chris Blackbourn
bf56df3236 UV: Add new packing option, scale_to_fit
When `scale_to_fit` is enabled, the existing behavior is used,
UVs will be scaled to fill the unit square.

If disabled, UVs will not be rescaled. They will be packed to the
bottom-left corner, possibly overflowing the unit square, or not
filling space.
2023-04-29 09:50:33 +12:00
Jesse Yurkovich
97222519de Fix #106945: IES file parsing failures
There were two issues here preventing the proper display of the IES
files in question.

The primary one was that these lights are actually vertical. Their
profiles actually point upwards from 90deg to 180deg but our parser was
trying hard to adjust it to start at 0deg incorrectly.

Lastly, the files in question ended with the parser in the `eof`
state - they are "missing" the final carriage return that other IES
files tend to have but other viewers don't seem to mind. Change the
`eof` check instead for a better one that will indicate if any parsing
errors occurred along the way.

Pull Request: https://projects.blender.org/blender/blender/pulls/107320
2023-04-28 23:29:04 +02:00
Harley Acheson
a20bb83c21 Fix 3D text selection & cursor mismatch when not on curve
Commit 5c184525ed improved text cursor
placement when text is on a curve, but when not on a curve it is now
on the baseline. This corrects for that, placing 25% below baseline.
2023-04-28 14:12:56 -07:00
Chris Blackbourn
609010f5c0 Cleanup: format 2023-04-29 08:41:33 +12:00
Damien Picard
44103f5529 I18n: improve geometry nodes field tooltips
Node socket tooltips suffered from several issues.

- Some could not be translated because they were not properly
  extracted, so extraction macros were added.

- Some were extracted but included newlines at the end which did not
  get translated, such as `ss << TIP_("Geometry:\n")`, changed to
  `ss << TIP_("Geometry:") << "\n"`.

- Some translations were not functional, such as:
  `TIP_(attributes_num == 1 ? " Named Attribute" : " Named Attributes");`
  because `TIP_()` needs to be around a single string.

- Some extraction macros had no effect and were removed, such as:
  `.description(N_(leading_out_description));`
  This is a no-op macro which can be used only around a string literal.

Pull Request: https://projects.blender.org/blender/blender/pulls/107257
2023-04-28 21:37:33 +02:00
Germano Cavalcante
e33974effb Fix Auto Depth not working
Error in 67203c0ec8

The wrong Auto Depth flag was being read.
2023-04-28 16:38:15 -03:00
Hans Goudey
96fd14a65f Cleanup: Fix typo in mesh sample function name 2023-04-28 14:45:22 -04:00
Hans Goudey
bec033e057 Cleanup: Simplify and deduplicate mesh sampling code
It arguably reads easier if simple operations like reading from indices
of an array don't each get their own line. Also the same corner
attribute sampling was repeated in a few places. And add a new
function to sample normals from the corner domain, and use
lower level arguments to the lower level functions (i.e. not just
a mesh pointer, but the necessary data arrays).
2023-04-28 14:45:22 -04:00
Hans Goudey
f8cc6cc866 Cleanup: Simplify passing empty anonymous attribute set 2023-04-28 14:45:22 -04:00
Hans Goudey
696b56c1da Cleanup: Add note about adding attributes while iterating 2023-04-28 14:45:22 -04:00
Hans Goudey
0a5f0890cc Cleanup: Use helper function to sample normals when adding curves 2023-04-28 14:45:22 -04:00
Harley Acheson
b367a2b5f9 UI: Measure/Ruler Text Position
Small improvements to the placement of text with Ruler tool.

Pull Request: https://projects.blender.org/blender/blender/pulls/107350
2023-04-28 20:25:20 +02:00
Hans Goudey
bea6391188 Fix: Wrong logic in recent extrude node fix
A local change that I forgot to add to the commit before pushing.
2023-04-28 14:14:32 -04:00
Hans Goudey
060216ac31 Cleanup: Implement "make available" for extrude node individual input
Since the faces mode is already the default, this won't change
anything, but it makes sense to have for consistency anyway.
2023-04-28 14:00:10 -04:00
Hans Goudey
82769653f8 Cleanup: Use short2 for custom normals, simplify access
Use a span instead of a pointer, which allows using `fill_indices`
to set values and using the assign operator in the future.
2023-04-28 14:00:10 -04:00
Hans Goudey
5ce4447f02 Cleanup: Remove unnecessary vertex normal custom data masks
These are handled lazily now, these masks have no effect.
2023-04-28 14:00:10 -04:00
Hans Goudey
0f47722d82 Fix: Extrude node propagates all anonymous attributes
Usually anonymous attributes are removed earlier, but otherwise
the extrude node can end up doing extra work.We need to retrieve the
propagation set and remove not-propagated attributes. And also fix
a case where in vertex mode, the offsets array could be freed when
the mesh is resized.
2023-04-28 14:00:10 -04:00
Brecht Van Lommel
5b69be00a6 Fix Cycles MetalRT not working after recent oneAPI changes
Forgot to initialize the device info.
2023-04-28 19:54:49 +02:00
Bastien Montagne
2fcf34a6bd I18N: Updated UI translations from svn trunk (r6490). 2023-04-28 19:51:22 +02:00
Harley Acheson
d1219b727c Fix #97530: Overlapping Content Causing Region Scrolling
Selecting filter in NLA/Graph Editor causes scrolling in the region
below it. This PR makes `UI_but_ensure_in_view` not occur if the block
has UI_BLOCK_CLIP_EVENTS.

Pull Request: https://projects.blender.org/blender/blender/pulls/107404
2023-04-28 19:06:30 +02:00
Xavier Hallade
252b0a023e Cycles: use intrinsics for fast_rint
MSVC can't optimize it out and even keeps an external call to CRT
function rintf: https://godbolt.org/z/Ex9vjf8vj

It does translate to a real speedup on windows on some scenes, here are the ratios I had on my 13900K:
classroom	101.53%
junkshop	100.71%
monster	100.76%
attic	107.98%
bistro	113.00%

Pull Request: https://projects.blender.org/blender/blender/pulls/107371
2023-04-28 18:49:46 +02:00
Sergey Sharybin
5e217fdec1 Deps: Bump version of sse2neon
This brings the following improvements:

- Implementation of _MM_SET_FLUSH_ZERO_MODE and _MM_SET_DENORMALS_ZERO_MODE
- Implementation of _mm_round_ss

Does not seem to be any performance impact with just this upgrade.

Pull Request: https://projects.blender.org/blender/blender/pulls/107396
2023-04-28 17:36:04 +02:00
Sergey Sharybin
7738f93d56 Cycles: Support newer version of sse2neon
Since the version v1.5.0 of sse2neon the functionality for denormals
flushing is implemented in the library. This commit makes it so the
_MM_SET_FLUSH_ZERO_MODE and _MM_SET_DENORMALS_ZERO_MODE are used from
the ss2neon if available.

This solves macro re-definition when a newer sse2neon is used.

The change is implemented in a way that both current and new sse2neon
are supported.
2023-04-28 17:36:02 +02:00
Jacques Lucke
7d38cef6d1 Geometry Nodes: use new BitGroupVector to find attribute propagation sets
A `BitGroupVector` is a compact data structure that allows storing multiple
bits per element, for example 5 bits per vertex. The implementation is
mostly just a wrapper around `BitVector`. There is some additional logic
to make sure that the bit span of every element is bounded (according
to the `is_bounded_span` function). This makes it more efficient to operate
on groups as a whole (e.g. `or` one group into another). In some sense,
this data structure can also be interpreted as a 2D bit array. Functions
like `append` can be added when they become necessary.

The new data structure is used to replace some `MultiValueMap` in
geometry nodes. This simplifies the code.
2023-04-28 16:54:43 +02:00
Hans Goudey
d6c61ccadc Cleanup: Extract function to make extend node declaration 2023-04-28 10:24:32 -04:00
Hans Goudey
098e58ea24 Attributes: Allow attribute API to create non-deleteable attributes
This can be useful to allow creating these core attributes with shared
arrays. Otherwise CustomData has to be used directly, which is nice
to avoid. This was done in e45ed69349, but not everywhere.
2023-04-28 10:24:32 -04:00
Jacques Lucke
fee9a3796c Cleanup: Add not equal operator to compute constext hash 2023-04-28 10:24:32 -04:00
Jacques Lucke
ac1827edda BLI: Add utility method to check if CPPType matches multiple types 2023-04-28 10:24:32 -04:00
Hans Goudey
67700ced54 BLI: Add "take front" and "take back" methods to bit spans
This is consistent with `Span`, and also allows returning a bounded
bit span when taking the front of an existing bounded span, which
can simplify using optimized bit processing.

Pull Request: https://projects.blender.org/blender/blender/pulls/107441
2023-04-28 16:14:03 +02:00
Germano Cavalcante
6beaf1dc7d Fix error in recent navigation refactor
Error in 67203c0ec8

The modal zoom operation was always being activated.
2023-04-28 11:11:13 -03:00
Hans Goudey
5a1013f6a8 Fix #106289: Copy optimal display edges in mirror, array modifiers
These aren't propagated as attributes since interpolating them with the
generic rules often gives strange results, and they're intended to as
an optimization. Though theoretically it would be nice if this
copying became more generic in the future.
2023-04-28 10:05:57 -04:00
Hans Goudey
b87ccedd75 BLI: Add bit span operations and bounded bit spans
Most of this patch is by Jacques Lucke, from the simulation branch.

This commit adds generic expression evaluation for bit spans, helping
to generalize the optimizations that avoid processing a single bit
at a time. Operations like "for each 1 index", "or", and "and" are
already implemented in this pull request. Bits in full integers are
processed 64 at a time, then remaining bits are processed all at once.
The operations allow implementing a `copy_from` method for bit spans.

Currently this optimized evaluation is only implemented for simpler
bounded bit spans. Bounded bit spans have constraints on their bit
ranges that make them more efficient to process. Large spans must start
at the beginning of the first int, and small spans must start and end
within the first int.

Knowing these constraints at compile time reduces the number of edge
cases in the operations, but mainly allows skipping alignment between
multiple spans with different offsets.

Pull Request: https://projects.blender.org/blender/blender/pulls/107408
2023-04-28 15:43:34 +02:00
Germano Cavalcante
d74f3895e7 Overlay: do not draw grids with undefined units
The `ED_view3d_grid_steps` function creates steps of units other than
those defined in `unit.c`.

This seems to be used for grid drawing in order to draw a unit after
the miles (in this case it would be something like 10 miles).

But that doesn't seem right as it's an undefined unit.

Therefore, the solution is not to create these different unit values.

The change in the overlay is that the softer grid that used to
correspond to 10 miles now corresponds to mile.

Pull Request: https://projects.blender.org/blender/blender/pulls/107405
2023-04-28 14:38:38 +02:00
Germano Cavalcante
67203c0ec8 3D View: Refactor navigation operators
No functional changes.

Merge the modal callbacks of the `VIEW3D_OT_move`, `VIEW3D_OT_rotate`
and `VIEW3D_OT_zoom` operators into a single simplified
`view3d_navigate_modal_fn` callback.

Deduplicate code for initialization, also the code for finalization and
the code to get the `event_code`.

Improve support for operation switching by the existing (but unused)
modal keymap items `VIEWROT_MODAL_SWITCH_ZOOM`,
`VIEWROT_MODAL_SWITCH_MOVE` and
`VIEWROT_MODAL_SWITCH_ROTATE`.

Pull Request: https://projects.blender.org/blender/blender/pulls/106279
2023-04-28 14:11:00 +02:00
Campbell Barton
ff0cf45bc2 Fix potential buffer overflows from invalid string size arguments
- FILENAME_MAX was used when the output was later limited by FILE_MAX.
- Some were passing in incorrect/dummy sizes in a couple of places.
2023-04-28 21:49:05 +10:00
Campbell Barton
ba978e1b68 Fix potential buffer overflow in internal pointcache logic
Buffer lengths in internal point-cache logic offent didn't match
the actual buffer size.
2023-04-28 21:45:19 +10:00
Campbell Barton
e462e20e21 Fix buffer overflow in BKE_image_ensure_tile_token use
BKE_image_ensure_tile_token took only the file name component but used
FILE_MAX to limit the input buffer.

Split this function in two, one that takes the full path as this is the
most common usage and another which takes only the filename.
Both now take a string size argument.
2023-04-28 21:40:04 +10:00
Campbell Barton
6701d24084 BLI_path: add string size arguments to sequence encode/decode functions 2023-04-28 21:33:38 +10:00
Jacques Lucke
bfcc2b1c4c BLI: add utility methods for serialization
This simplifies the code that works with the `BLI_serialize.hh` header.
The various `lookup` methods do a linear search. If there are only a
few elements that can even be faster than building the map first.
In the future it might be nice to transparently build and cache the
map internally if necessary.
2023-04-28 13:30:26 +02:00
Campbell Barton
5c184525ed Fix 3D text selection & cursor mismatch with text-on-curve enabled
The cursor & selection were shifted down in local (object) space,
ignoring character rotation.
2023-04-28 21:15:38 +10:00
Campbell Barton
6586c4c73f Fix negative index in text cursor drawing
Recent changes to cursor drawing read an index of -1 when there was no
text.
2023-04-28 21:14:07 +10:00
Sergey Sharybin
c40b92b039 Fix strict warnings in external code
Happens with a default build on Debian stable with Clang-13 compiler.
2023-04-28 12:14:14 +02:00
Jacques Lucke
b4d914b676 BLI: support weak users and version in implicit sharing info
The main goal of these changes is to support checking if some data has
been changed over time. This is used by the WIP simulation nodes during
baking to detect which attributes have to be stored in every frame because
they have changed.

By using a combination of a weak user count and a version counter, it is
possible to detect that an attribute (or any data controlled by implicit
sharing) has not been changed with O(1) memory and time. It's still
possible that the data has been changed multiple times and is the same
in the end and beginning of course. That wouldn't be detected using this
mechanism.

The `ImplicitSharingInfo` struct has a new weak user count. A weak
reference is one that does not keep the referenced data alive, but makes sure
that the `ImplicitSharingInfo` itself is not deleted. If some piece of
data has one strong and multiple weak users, it is still mutable. If the
strong user count goes down to zero, the referenced data is freed.
Remaining weak users can check for this condition using `is_expired`.

This is a bit similar to `std::weak_ptr` but there is an important difference:
a weak user can not become a strong user while one can create a `shared_ptr`
from a `weak_ptr`. This restriction is necessary, because some code might
be changing the referenced data assuming that it is the only owner. If
another thread suddenly adds a new owner, the data would be shared again
and the first thread would not have been allowed to modify the data in
the first place.

There is also a new integer version counter in `ImplicitSharingInfo`.
It is incremented whenever some code wants to modify the referenced data.
Obviously, this can only be done when the data is not shared because then
it would be immutable. By comparing an old and new version number of the
same sharing info, one can check if the data has been modified. One has
to keep a weak reference to the sharing info together with the old version
number to ensure that the new sharing info is still the same as the old one.
Without this, it can happen that the sharing info was freed and a new
one was allocated at the same pointer address. Using a strong reference
for this purpose does not work, because then the data would never be
modified because it's shared.
2023-04-28 12:05:00 +02:00
Philipp Oeser
19aaf980d5 Cleanup: format 2023-04-28 11:46:25 +02:00