Commit Graph

99401 Commits

Author SHA1 Message Date
Hans Goudey
ce96abd33a Fix: Build error after simulation header cleanup
Making the geometry state's geometry public to remove
the accessors didn't work without the constructor.
2023-05-08 17:21:15 -04:00
Hans Goudey
2f349ce884 Cleanup: Add comments to simulation state header
Pull Request: https://projects.blender.org/blender/blender/pulls/107744
2023-05-08 21:42:38 +02:00
Harley Acheson
8e4e616a4b Fix #106023: File Browser Lists with Incomplete Previews
Ensure all File Browser list items get previews.

Pull Request: https://projects.blender.org/blender/blender/pulls/107698
2023-05-08 20:53:08 +02:00
Iliya Katueshenock
819cd58864 Cleanup: Make Accumulate Attribute node more generic
Geometry Nodes strives to reduce template usage in code,
to use it only for extremely important loops or for template math
processing on attributes. Due to this, this pull request cleans up
to delete template classes and uses `convert_to_static_type` in
accumulate function directly.

Pull Request: https://projects.blender.org/blender/blender/pulls/104440
2023-05-08 20:36:12 +02:00
Julian Eisel
50d49e24c4 Asset Views: Decrease default preview cache size
This was set to a higher value than intended, because the actual caching
doubles the size internally. So it would keep up to 512 previews in
memory which is a bit excessive. See discussion in #107711.
2023-05-08 19:57:56 +02:00
illua1
07ac8cb15a Fix #107506: Depsgraph: non-geometry component is treated as geometry component
Pull Request: https://projects.blender.org/blender/blender/pulls/107509
2023-05-08 18:51:15 +02:00
Bastien Montagne
527b21f0ae LibOverride: Restore local references to virtual linked liboverrides on resync.
When resyncing linked liboverride data, new IDs may be created that do
not exist in actual library file (since the lib file has not been resynced).

If such 'virtual linked liboverrides' data-blocks are used locally (e.g.
by adding such object to a local collection), on next file read they will be
detected as missing.

Now resync code will list such missing linked IDs that were
liboverrides, and try to re-use them when matching (by root name and
library) with newly generated virtual liboverrides.

The process may not be 100% perfect, especially a perfect one-to-one
remapping cannot be ensured if source data keep being changed over and
over (because of the order in which virtual linked liboverrides
generated by resync may change over time). However, in practice this
should fix the vast majority of issues, especially if sane naming
practices are used on IDs.

---------------

For the record, an attempt was made to write liboverride data together
with the placeholders for linked IDs in .blendfile. In theory, this
should ensure a perfect and fully valid re-usage of such IDs.

However, for this to work, not only the liboverride data of linked IDs need
to be written on disk, but also all ID references in this data has to be
considered as directly linked, to ensure that such liboverride data can
be re-read properly.

Otherwise, these placeholders would get a liboverride data with NULL ID
pointers, which is useless.

Such change feels way to intrusive for the very limited benefit, so for
now would consider current solution as the best option.

Pull Request: https://projects.blender.org/blender/blender/pulls/107144
2023-05-08 18:22:33 +02:00
Sybren A. Stüvel
0327d2c963 Add missing notifier when setting cursor.matrix
Add a notifier when setting `scene.cursor.matrix`. This was already in
place for `cursor.location` and `cursor.rotation`, but was still missing
for `cursor.matrix`, which caused the cursor to remain displayed in its
old transform.
2023-05-08 16:58:26 +02:00
Jeroen Bakker
8759ae1760 GPU: Initialize SRGB In TestCases
Vulkan test cases uses SRGB conversion. These test cases where failing
as the conversion table wasn't initialized.

This PR initializes the conversion table and fix the Vulkan data
conversion tests.
2023-05-08 15:32:15 +02:00
Julian Eisel
7e79e0eec0 File Browser: Avoid filling file cache needlessly on auto-complete
This would iterate over all files and call the sneaky `filelist_file()`,
meaning each file would be added to the cache for a minor query. That's
plenty of unnecessary work and kinda defeats the purpose of the partial
cache design.
2023-05-08 15:01:00 +02:00
Julian Eisel
be19edf356 Cleanup: Add API comment on side-effect of file browser query function
`filelist_file()` is an easy way to do a bunch of unnecessary work and
fill the file browser caching for little reason. Unfortunately the
caching affects too many things to be a mere API implementation detail,
so rather be clear about this and point out alternatives.
2023-05-08 15:01:00 +02:00
Julian Eisel
c0ce427760 Cleanup: Move file cache lookup into function
The details on the file cache lookup just look confusing and make the
function look daunting. Encapsulate it into a function so it's trivial
to see what's going on
2023-05-08 15:01:00 +02:00
Lukas Tönne
967cd7f99e Fix: Viewer node crashes when the editor is pinned and has no Object ID
This case was not properly handled by the previous fix in #107621.

The viewer node path function still assumes that the node editor space
has a valid ID pointer (`snode.id`) and that it is an `Object`.
The ID pointer can be null when setting a pinned node tree through the
python API, like so:
```Py
space.pin = True
space.node_tree = some_other_node_tree
```

In this case the `ED_node_tree_start` function is called without and ID
pointer, which is allowed! This patch makes sure that the viewer node
path function is only used with a valid object context.

Pull Request: https://projects.blender.org/blender/blender/pulls/107737
2023-05-08 14:52:06 +02:00
Lukas Tönne
304e8a842d Fix: editor crashes during simulation bake
Fixes crashes in timeline and spreadsheet editors during simulation
nodes baking:
* Timeline tries to access the `states_at_frames_` list of the cache to
  determine which frames to draw as baked. This can collide with the
  baking thread. Needs a mutex to safely access the cache state.
  Note: the old point cache has a pre-allocated flag array
  `cached_frames` which the baking thread writes into while timeline is
  reading it concurrently - not thread-safe but harmless.
* Spreadsheet keeps a data pointer during drawing, which may become
  deallocated when the cache is updated. Common approach here is to use
  `G.is_rendering` to lock the editor while baking.

Pull Request: https://projects.blender.org/blender/blender/pulls/107621
2023-05-08 14:34:21 +02:00
Sybren A. Stüvel
f3be425e97 Fix Pose Library: crash when using partially-keyed quaternions
Remove the assumption that quaternions are always fully keyed in a pose
asset. Even though quaternions really should be fully keyed, better not
make Blender crash when this assumption doesn't hold.

If the quaternion is only partially keyed, the other components are taken
to be from the unit quaternion (`[1, 0, 0, 0]`) and the result is
normalized before blending into the existing pose.

This fixes blender/blender-addons#104591, which was reported against the
pose library add-on, but actually was caused by an issue in Blender.
2023-05-08 13:54:07 +02:00
Lukas Tönne
3e888d77ba Geometry Nodes: Simulation calculate to frame operator
Adds a new operator that resets caches and then iterates from the start
frame to the current frame in order to update caches.

Pull Request: https://projects.blender.org/blender/blender/pulls/107627
2023-05-08 13:41:21 +02:00
Jacques Lucke
b4fb17f11c Geometry Nodes: allow skipping frames during simulation
The maximum delta time is still capped to one frame even if multiple
frames are skipped. Passing in a too large delta time is mostly unexpected
and can reduce the stability of the simulation. Also it can be very slow
when the simulation uses the delta time to determine e.g. how many particles
should be added.
2023-05-08 13:10:30 +02:00
Jeroen Bakker
1f3fda16e6 Vulkan: Extract Correct UniformBuf Name From Interface
Fixes an issue as the uniformbuf name was incorrectly extracted
from the shader interface.

Pull Request: https://projects.blender.org/blender/blender/pulls/107736
2023-05-08 13:01:10 +02:00
Bastien Montagne
3c2dc42712 Fix (studio-reported) crash in liboverride resync code after recent changes. 2023-05-08 12:46:03 +02:00
Jacques Lucke
ae1c52b3f2 Cleanup: remove dead code 2023-05-08 11:48:01 +02:00
Jacques Lucke
d8388ef36a Fix: avoid extra depsgraph evaluation when stopping animation playback
The `NC_SCENE | ND_FRAME` was originally added so that the sequencer
preview is redrawn so that the fps stops showing (2855485565).

Using this specific notifier has the side effect that it also causes a depsgraph
update in `wm_event_do_notifiers`. However, that is not necessary just to
trigger the redraw. Using the `NC_SPACE | ND_SPACE_SEQUENCER` notifier
also triggers the redraw without causing a depsgraph update.
2023-05-08 11:27:50 +02:00
Jacques Lucke
8e9ada0079 Fix: force frame update only when starting animation timer
Otherwise this always causes an extra depsgraph update when
animation playback is stopped.
2023-05-08 11:27:50 +02:00
Jacques Lucke
037b3f87bd Fix: scrubbing time always has extra update that is only used by sequencer
The sequencer has a feature where it only draws a preview while scrubbing.
This was introduced in 8abdc89912.
When scrubbing ends, the sequencer requires an extra update so that the
non-preview version is shown again.

This is only needed by the sequencer and hence the update should not be
done if the sequencer is not used.

Changing `screen->scrubbing` is moved out of the sequencer specific
functions, because it's used elsewhere as well.
2023-05-08 11:27:50 +02:00
Jacques Lucke
2fbbc7acbb Fix: unnecessary depsgraph update when scrubbing in timeline
Previously, there was always a depsgraph update when the mouse moves
while scrubbing in the timeline. Even when the mouse movement does
not change the actual frame. This can happen when e.g. the mouse first
hovers over frame 5.2 and then it moves to frame 5.3. In both cases the
actual frame is rounded to 5, so no update is necessary (that is unless
subframes are used).
2023-05-08 11:27:50 +02:00
Campbell Barton
cd49cb08e3 BLI_string: call BLI_string_debug_size from functions with a buffer size 2023-05-08 19:12:48 +10:00
Campbell Barton
55f7f082a8 Cleanup: avoid BLI_path_basename when the filename is known 2023-05-08 19:12:48 +10:00
Jacques Lucke
c3365666e5 Fix #107637: crash when using density brush on empty hair 2023-05-08 09:26:15 +02:00
Philipp Oeser
04d50f4b23 UI: support operator enums in Quick Favorites
Part of #59244

This was heavily requested since there are a lot of usages of
`operator_menu_enum` around in our UI [and these menus all cannot be
added to Quick Favorites atm.].

The following are just a small sample from the 3D viewport menus (object
mode), but there are many more.

- Object
-- Set Origin
-- Relations >> Make Local...
-- Convert To
- Add
-- Grease Pencil
-- Empty
-- Force Field
-- Collection Instance
- Select
-- Select All by Type
-- Select Grouped
-- Select Linked
- ...

So in order to make this work, `USER_MENU_TYPE_OPERATOR` /
`bUserMenuItem_Op` is reused (but extended with a string to the property
in question). (Alternatively, a new type could be introduced -- but
would share most of the code with the type that is reused in this
patch).

Depending on being used with an enum or not [detected by the usage of
that new string] we then either call `uiItemFullO_ptr` or
`uiItemMenuEnumFullO_ptr` in `screen_user_menu_draw`.

NOTE: support for other enums (property enums such as pivot point or
transform orientations) will follow in a separate commit (building upon
6a13b6324b, trying to solve the way these draw as menus)

NOTE: opening User Preferences with such "new" Quick Favorites even
works (just not drawn with a menu)

Pull Request: https://projects.blender.org/blender/blender/pulls/107616
2023-05-08 09:14:45 +02:00
YimingWu
f080dca2c0 Fix #107717: Missing looptri_polys loading lineart
The `looptri_polys` array was missing likely due to a mesh data
structure update, causing lineart loading function to crash. Now fixed.
2023-05-08 12:18:11 +08:00
Campbell Barton
bb5a22539c Cleanup: correct path size argument
BKE_appdir_folder_documents clamps to FILE_MAXDIR internally.
2023-05-08 12:49:44 +10:00
Campbell Barton
8a852de147 BLI_fileops: change BLI_dir_create_recursive string size handling
Replace MAXPATHLEN with FILE_MAX, always allocate if the buffer isn't
big enough since creating a truncated directory isn't useful.

Having some code-paths only run in an ifdef complicated the code
and made it more difficult to follow.

Also assert the path doesn't contain ".." directories as they aren't
supported.
2023-05-08 12:49:44 +10:00
Campbell Barton
64674b10d1 Cleanup: quiet compiler warnings 2023-05-08 11:47:27 +10:00
Lukas Stockner
893bd37bc0 Cleanup: formatting 2023-05-08 01:20:41 +02:00
Lukas Stockner
c431b69a8a Fix #72011: Visible artifacts after baking normals with bevel shader
Pull Request: https://projects.blender.org/blender/blender/pulls/106988
2023-05-07 22:41:47 +02:00
Marino Toscano
c502d3ac53 Fix #105147: Rename geometry node to Is Face Planar
Renamed geometry node "Face Is Planar" to "Is Face Planar"
so that the name in the menu and in the node are the same.
Translations now also works as expected.

Pull Request: https://projects.blender.org/blender/blender/pulls/107713
2023-05-07 22:37:05 +02:00
Damien Picard
31d71f39ad UI: fix or improve many messages
- The official spelling of FFMPEG is FFmpeg (upper, then lower case).
- The normal vector copy and paste operators shoud be singular because
  they can only be used on a single element.
- The "Parent File" file browser operator goes up one level in the
  file hierarchy. It should be called "Parent Directory", like the
  current description "Go to the parent directory".
- "Mass Vertex Group" used to define the mass, but was reused at some
  point and now actually defines cloth pinning so it should be called
  "Pin Vertex Group", as in the UI.
- The Transformation constraint's Map To Type suffered from a
  typo (probably of -> on).
- "Fall-off" is more commonly spelled "Falloff".
- "Effected" should really be "Affected" in this case.
- Rephrase the descriptions for the curve painting tools drawing
  plane, which did not seem to match what the settings do. Namely,
  they allow selecting in which plane to draw curves using the Curve
  Draw tool.

Reported by @Joan-Pujolar in #43295:
- Force exporting animation on every objects [objects singular]
- Color of the interface widgets text insertion cursor (caret) [delete
  interface widgets]
- Index of active aov [AOV in uppercase everywhere else]
- Does this tool use an painting canvas [an]
- This script was written Blender version %d.%d.%d ["for" missing
  before "Blender"]
- [fcurve -> F-curve]
- unknown error stating file [statting]
- Offset into each stroke before the beginning of  the dashed segment
  generation [Two spaces between of and the]
- Find the nearest element in the a group. [either "the" or "a"]

Pull Request: https://projects.blender.org/blender/blender/pulls/107699
2023-05-07 15:27:28 +02:00
Campbell Barton
de5aca9418 Refactor: unify UNIX/WIN32 BLI_dir_create_recursive & some improvements
- Don't duplicate/allocate the path on each recursion,
  instead make a single copy which is modified in-place.

- Move slash-stepping to a BLI_path utility function that accesses
  the end position of the parent directory, handles multiple slashes
  and '/./'.
2023-05-07 23:09:56 +10:00
Campbell Barton
f7d3115d97 Cleanup: replace BLI_strncpy with memcpy when the size is known
Also remove temporary filename buffer which is no longer needed.
2023-05-07 16:55:40 +10:00
Campbell Barton
0d1362bfd7 Cleanup: spelling in comments 2023-05-07 16:46:37 +10:00
Campbell Barton
df54b627b3 Cleanup: use of the term 'len' & 'maxlen'
Only use the term len & maxlen when they represent the length & maximum
length of a string. Instead of the available bytes to use.

Also include the data they're referencing as a suffix, otherwise it's
not always clear what the length is in reference to.
2023-05-07 16:46:37 +10:00
Chris Blackbourn
5abb3c96cf UV: Add pinned island support to uv packer
New pinned modes:
 * Ignore pinned islands
 * Normal (default)
 * Lock scale
 * Lock rotation
 * Lock position of pinned UV islands.
2023-05-07 17:54:51 +12:00
Campbell Barton
5258604531 Cleanup: use of the term 'len' in BLI_string_utf8, BLI_string_utils
Reserve the term `len` for string length, some functions used this for
an string/array length, others a destination buffer size
(even within a single function declaration).

Also improve naming consistency across different functions.
2023-05-07 14:56:11 +10:00
Campbell Barton
7966888af5 Cleanup: don't use an inline function which is passed as an argument
GCC13 fails to compile this with `-O1`, while it should be supported,
there is no advantage to this being an inline function so remove it.
2023-05-07 14:50:27 +10:00
Campbell Barton
464a40c1a5 Cleanup: use the name of the CMake WITH_STRSIZE_DEBUG for the define
Prefer matching names so there is no reason to confuse the identifiers.
2023-05-07 13:55:19 +10:00
Campbell Barton
7f8495c44b CMake: add WITH_STRSIZE_DEBUG option, RNA support
Support string size debug so it can be used for regular development.

It works be writing values into strings, ensuring the buffer size
given is actually available. Developers can use this with memory
checking tools such as ASAN/valgrind to force an error when
the value used for the size of a buffer is larger than the buffer.

Resolve remaining issue with RNA using BLI_strncpy* in generated
callback functions where the size argument didn't represent the
size of the destination buffer.

This is automatically enabled along with ASAN for the
blender_developer.cmake configuration.

Ref PR !107602.
2023-05-07 13:52:49 +10:00
Campbell Barton
0cf682f570 RNA: ensure string size with RNA_property_string_get_alloc 2023-05-07 13:22:35 +10:00
Campbell Barton
3ed297633d Fix unintended fall-through in ANIM_is_active_channel
Regression in [0] would treat many eAnim_ChannelType types data as a
bActionGroup. Resolve by including the NULL check in the return.

[0]: 80feb13665
2023-05-07 13:14:20 +10:00
Chris Blackbourn
0eba9e41bf Cleanup: Convert float to double during uv unwrap
`sinf(float_angle)` is sometimes producing different results on
x86_64 cpus and apple silicon cpus. Convert to double precision
to increase accuracy and consistency.

Partial fix for #104513. More to come.
2023-05-07 12:07:40 +12:00
Chris Blackbourn
a684e61cbf Cleanup: fix warnings 2023-05-07 11:47:54 +12:00
Bastien Montagne
07dfc6eccc LibOverride: Further fixes/improvements to partial recursive resync process.
This addresses the 'liboverrides still tagged for resync after resync
process' error reports.

Turns out, this situation is (unfortunately) normal in some rare cases,
hwne the hierarchies in the liboverride and the reference data have
drastically diverged.Since the detection of liboverrides to resync, and
which one are valid partial resync roots, happens on the 'old' override
hierarchy, it may not match the actual hierarchy recreated from the
reference data, leading to some part of it being ignored by the resync
code.

There is no real way to avoid this situation, the only thing that can be
done is detect it, and re-process the resync code again when it happens.

From quick limited tests in (extremely dirty/outdated) Pets production files,
most of the time only one resync process is needed. Worst case so far
required 5 reprocessing of the same set of data.

There is no error messages from resync anymore in these tests, so at the
very least resync process should now be significantly more reliable than
before...
2023-05-06 16:27:50 +02:00