Commit Graph

123688 Commits

Author SHA1 Message Date
Campbell Barton
f9fbbd8f80 Cleanup: expand on code-comments
Rename layout_old to layout_ref as the layout is a reference
(the old layout has been freed).
Also use boolean for save_copy argument.
2023-05-03 16:31:37 +10:00
Campbell Barton
b690b8c16f Fix incorrect buffer size copying to StudioLight::filepath
Use STRNCPY macro so these don't get out of sync.
2023-05-03 16:26:42 +10:00
Campbell Barton
d770fd5ac4 Cleanup: remove unused BLI_dir_* functions
Loading a font in BLF would search a list of directory presets
however these presets were never used.
Remove them as all callers pass in full paths.

Also rename FontBLF::name to mem_name as it's only needed as an ID
for in-memory fonts (to prevent them being loaded multiple times).

Non-unique font loading now compares against the filepath or mem_name
when loading from files or memory (before both used `name` which was
often the filepath, sometimes the full ID-name).
2023-05-03 16:08:31 +10:00
Campbell Barton
6b9a500a3a Cleanup: disambiguate terms "name", "file" & "str" / "string"
- Rename name/filename/path to filepath when it's used for full paths.
- Rename name/path to dirpath when it refers to a directory.
- Rename file to filepath or path (when it may be a file or dir).
- Rename ImBuf::name & anim::name to filepath.
2023-05-03 15:26:14 +10:00
Campbell Barton
1f96fa1129 Cleanup: rename BLI_make_existing_file for clarity
Rename BLI_make_existing_file to BLI_file_ensure_parent_dir_exists.
The previous name read as if it would make (touch) the file,
where as it ensures the directory component of the path exists.

Move from BLI_path to BLI_fileops as path utilities should only
manipulate paths and not deal with file IO creation
(this has more in common with BLI_file_touch for e.g.).
2023-05-03 11:49:47 +10:00
Campbell Barton
bb341eaf12 BLI_path: use module prefix for BLI_filename_make_safe
Rename BLI_filename_make_safe -> BLI_path_make_safe_filename.
2023-05-03 11:48:52 +10:00
Campbell Barton
01aead42fc Cleanup: re-order split prefix/suffix return arguments last 2023-05-03 11:25:30 +10:00
Campbell Barton
947465c511 Cleanup: rename BLI_split_name_num, order return arguments last 2023-05-03 11:25:30 +10:00
Campbell Barton
f30434ac99 BLI_string_utils: BLI_uniquename no longer accepts NULL defname
A NULL defname would early exit (doing nothing) this isn't good behavior
as this function should always make the name unique and a NULL defname
is likely an error in the code which would allow duplicate names.
This is also inconsistent with BLI_uniquename_cb which always
wrote the defname into the name if it was empty.

Mark this argument as never-NULL.
2023-05-03 11:25:30 +10:00
Campbell Barton
4115fcbc38 Cleanup: update, add function attributes for BLI_string & BLI_path
Explicitly list ATTR_NONNULL indices in most cases so it's explicit
that arguments aren't NULL (and adding new arguments that can be NULL
isn't such a hassle).
2023-05-03 11:25:30 +10:00
Campbell Barton
381de3bd9e Cleanup: format 2023-05-03 11:25:30 +10:00
Hans Goudey
d5fc1b9ba4 Fix #107505: Temporary stack not cleared in BMesh normal calculation
Mistake in f8eebd3b25.
2023-05-02 17:24:00 -04:00
Hans Goudey
c2a2c2dcab Cleanup: Use array and span in weighted normal modifier 2023-05-02 17:08:14 -04:00
Hans Goudey
2e50e0a849 Fix #107514: Broken normals wtih weighted normal "keep sharp" option
The data indices for all loops in a fan weren't set, only the first.
2023-05-02 17:08:14 -04:00
Christoph Lendenfeld
f865e67593 Refactor: Replace move_key with BKE_fcurve_keyframe_move_value_with_handles
The helper function `move_key` did exactly the same things as `BKE_fcurve_keyframe_move_value_with_handles`
It was only created because I wasn't aware that such logic already existed
No functional changes

Pull Request: https://projects.blender.org/blender/blender/pulls/107402
2023-05-02 22:12:54 +02:00
Christoph Lendenfeld
dc0251df72 Fix: Graph Editor - add operator flags for cursor wrapping
The slider operators in the Graph Editor were missing operator flags for the cursor wrapping to work.
I've added it to the operators that allow overshoot, because for those it is really important to have no limits on scrolling.

Pull Request: https://projects.blender.org/blender/blender/pulls/107435
2023-05-02 21:38:57 +02:00
Hans Goudey
b3a3b94976 Cleanup: Avoid allocating extra array in sample nearest node
The distances array was filled but never used.
2023-05-02 15:07:52 -04:00
Erik Abrahamsson
5b876b810f Fix #106776: Volume cube won't render in Cycles
In some cases the Geometry Nodes Volume Cube generates
a Volume grid that doesn't contain any leaf nodes. This can happen
when only tiles are needed to represent the volume.

This PR changes the `empty_grid` check function to also check if
there are any active tiles in the grid before returning `true`.

Pull Request: https://projects.blender.org/blender/blender/pulls/107551
2023-05-02 20:13:58 +02:00
Harley Acheson
22245115fd Fix #107499: Text Object Selection with Scale To Fit Mode
Allow mouse text selection and cursor positioning to work correctly
when the text box has overflow mode set to "Scale to Fit."

Pull Request: https://projects.blender.org/blender/blender/pulls/107510
2023-05-02 19:32:47 +02:00
illua1
71e4f48180 Nodes: Improve link drag search value moving
Now, when link drag search is used to create new input value nodes, it
also moves socket values into node storage. This means, by design, that
result of evaluation on node tree will not be changed. For data blocks,
the original value is set to null, thus avoiding the existence of
unused pointers.

Right now a few nodes (in shader in many cases) are implemented without
node storage, but by storing value in socket itself. Float value input
node is unsupported in this way too.

Pull Request: https://projects.blender.org/blender/blender/pulls/107470
2023-05-02 18:50:34 +02:00
Philipp Oeser
dc73b63460 Fix: crash baking empty rigid body world
Found investigating #107420.

Steps to reproduce were:
- remove all objects from the scene
- add rigid body world
- bake
- crash

BKE_ptcache_bake would assume a cache can always be found, but with an
empty rigid body world this is not the case -- accessing flags would then
crash.

Now just check if we actually have a cache.

Pull Request: https://projects.blender.org/blender/blender/pulls/107537
2023-05-02 17:57:21 +02:00
Philipp Oeser
d0c6117196 Fix #107420: crash getting PTCacheID when baking scene rigid body world
`ptcache_baker_create` falsely assumed the PointCache owner id is always
an **object**, but when baking rigid body world it is a **scene**. Code
would cast the ID to an object and passed that to `BKE_ptcache_id_find` /
`BKE_ptcache_ids_from_object` (which can get terribly wrong -- reading
_something_ on the scene as something from the assumed object).

Prior to f61ff22967 this was less likely to be a problem, but that
commit introduced a `DrawDataList` into the `struct Scene`. In the file
from the report, this would lead to `foreach_object_particle_ptcache`
now recognizing garbage memory as a particle system, accessing its
`ParticleSettings` `phystype` would then crash (buffer-overflow).

Now pass a NULL object to `BKE_ptcache_id_find` in case we are having a
scene, following code still handles rigid bodies just fine (the scene is
actually passed separately as well).

Pull Request: https://projects.blender.org/blender/blender/pulls/107536
2023-05-02 17:56:17 +02:00
Omar Emara
88d03d15c1 Realtime Compositor: Implement Stabilize 2D node
This patch implements the Stabilize 2D node for the realtime compositor.

Pull Request: https://projects.blender.org/blender/blender/pulls/107401
2023-05-02 17:11:59 +02:00
Hong Shin
1a5ad33a57 Cleanup: Move pipeline.h to C++
Ref: #103343

Pull Request: https://projects.blender.org/blender/blender/pulls/107516
2023-05-02 16:55:45 +02:00
Bastien Montagne
9954a5d07c Cleanup: Remove left-over debug prints in own previous commits.
Sorry for the noise.
2023-05-02 16:21:00 +02:00
Jeroen Bakker
96dcdbfc51 Vulkan: Correct Aspectbits for Depth Textures
Vulkan spec only wants to have a single aspect bit when a texture
contains both a stencil and a depth part. As for Blender depth
is more used than stencil we standardize to depth aspect.

Pull Request: https://projects.blender.org/blender/blender/pulls/107542
2023-05-02 16:20:25 +02:00
Bastien Montagne
5095ecc67b Cleanup: Rename LibOverride-related enum flags/tags.
Mainly use a shorter, straight-forward prefix (`LIBOVERRIDE`), and
unify/make these enum names more consistant. No functional changes
expected here.
2023-05-02 16:14:53 +02:00
Bastien Montagne
9ea2170cce LibOverride: Resync: Fix some issues with partial resync.
In some cases, some partial resync roots would be missed during the
partial resync process, leading to incomplete resync of all the needed
data.

This was caused by tagging some liboverrides for resync _after_ they had
already be evaluated as part of parenting hierarchy of other
liboverrides. Fix is simply to split both steps apart, such that all IDs
that need it are tagged to resync first, and then hierarchies are
evaluated to find the required partial resync roots whithin a hierarchy.
2023-05-02 16:14:53 +02:00
Bastien Montagne
ba9ca7afb6 LibOverride: Resync: Delete non-user-edited 'isolated from root' liboverrides.
These should not be needed anymore. Follow-up to previous commit.
2023-05-02 16:14:53 +02:00
Bastien Montagne
5574a1bfc1 LibOverride: Fix/Improve resync behavior in some complex cases.
This commit mainly addresses issues when a part of an override hierarchy
does not match anymore the linked reference data, and gets isolated form
the hierarchy root (there is no parenting chain to the root anymore).

The typical case being an object or sub-collection being moved to
another subcollection in the linked data.

Case identified while working on some Pets production files.

Note that in some cases this isolated chunk of the hierarchy will be
linked back into the appropriate place, in others it should be fully
removed (instead of staying as unused data). The later will be handled
in a another future commit.

This commit mainly detect and use a new tag for such cases, and correct
the checks to take it into account.

It also does a bit of cleanup, and replaces some asserts by `CLOG_ERROR`
reports.
2023-05-02 16:14:53 +02:00
Bastien Montagne
b724015840 LibOverride: Fix wrong assert in some cases in RNA tracks handling.
Due to index-only referencing in insertion of new NLA tracks in
liboverride data, it may happen that the source of an inserted track
cannot be found.

This index-only based handling of NLA tracks in liboverrides is very
weak, in the future this will be solved by ensure uniqueness of their
names, then name-based reference can be used instead, as already done with
modifiers, constraints, etc.
2023-05-02 16:14:53 +02:00
Jeroen Bakker
17201752d9 Vulkan: Add FLOAT to SRGB and Depth24 Conversion
This PR adds support to convert host/device data from floats
to GPU_SRGB8_A8 and GPU_DEPTH_COMPONENT24.

Pull Request: https://projects.blender.org/blender/blender/pulls/107544
2023-05-02 15:57:17 +02:00
Jeroen Bakker
13fe6d0170 Vulkan: Silence Compilation Warnings
This PR silences some compilation warnings in the command buffer.

Pull Request: https://projects.blender.org/blender/blender/pulls/107541
2023-05-02 15:52:53 +02:00
Julian Eisel
5e3bf37982 Cleanup: Add internal header for View2D files
Code was exposing apparently internal functions to the public header, so
it could reuse it in other View2D files. Worse even, a struct was
defined twice in different source files and they would have to be kept
in sync, just because there is no shared header file.
Such internal header files are useful and don't really cause any harm.
2023-05-02 15:02:06 +02:00
Jacques Lucke
20b19f2b12 Fix: calculating duplicates in kdtree does not work with selection
This fixes a crash where merging vertices by distance leads to a crash since
0652945dbd. The change did not cause
the bug though, it just made the underlying issue visible.

The issue was that `kdtree_order` assumed that the `KDTreeNode.index` didn't
have gaps, i.e. every index in a certain range is used. However, that is not the
case when only a subset of the vertices of a mesh are added to the kdtree.

Pull Request: https://projects.blender.org/blender/blender/pulls/107535
2023-05-02 14:25:55 +02:00
Pratik Borhade
c04e709c6a Bump blender file format subversion
This change is required for 0001485365. File version bump was included
in PR but it was behind the main branch. In main, version was updated
by 5d0595fded.
2023-05-02 17:37:58 +05:30
Campbell Barton
3b5aba8cf8 Fix invalid argument to BLI_path_split_dir_file
get_index_dir passed in the wrong size, also remove strange use of
BLI_path_split_dir_file which copied the directory into `file`,
only to overwrite it with the `file` afterwards.
2023-05-02 21:32:51 +10:00
Campbell Barton
27e4ab80fb BLI_path: disallow passing NULL arguments to BLI_path_split_dir_file
Instead BLI_path_split_dir_part & BLI_path_split_file_part can be used.
2023-05-02 21:32:51 +10:00
Campbell Barton
1ab72e8459 Cleanup: use BLI_path_* prefix for path splitting functions
Also order string size after each string instead of grouping strings and
their sizes afterwards.
2023-05-02 21:08:13 +10:00
Pratik Borhade
0001485365 Allow renaming F-curve modifier
Modifier name is being displayed as label in panel header which has restricted
the editing of it. This PR will allow to change the name of F-curve modifier
by exposing string property "name"
Included versioning code for modifier name. This will add suffix to the name if
multiple instances of same modifier exists in modifier stack.

Differential Revision: https://archive.blender.org/developer/D17142

Pull Request: https://projects.blender.org/blender/blender/pulls/104949
2023-05-02 13:07:48 +02:00
Campbell Barton
90361278d7 Cleanup: use function style casts, remove redundant parenthesis 2023-05-02 20:26:17 +10:00
Sergey Sharybin
93b9b79b19 Fix strict compiler warning
Mismatched array bounds in function declaration and definition.

Pull Request: https://projects.blender.org/blender/blender/pulls/107530
2023-05-02 11:32:45 +02:00
Sergey Sharybin
e3f14b99c3 Refactor: Convert ImBuf to C++
Pull Request: https://projects.blender.org/blender/blender/pulls/107503
2023-05-02 11:32:27 +02:00
Sergey Sharybin
a54c399b41 Fix crash doing a stroke in the weight paint
A regression since 2d2f4d9d28: the sculpt session is re-used by the
weight paint, so changes to semantic in one place requires same
changes in another.

Before the change the `original` was intiialized to false (due to the
clear-alloc), but after the change it was the accum with an inverted
meaning which was initialized to false.

Pull Request: https://projects.blender.org/blender/blender/pulls/107533
2023-05-02 11:02:13 +02:00
Adi Sage
cc84d83929 Fix #106853: Tooltip fix of OT_constraints_clear
The existing tooltip of Clear Constraints modifier in object mode
(`object.constraints_clear`) didn't match its functionality. It said it
works only on the active object, but it affects all selected objects.

Hence, the tooltip has been changed from 'Clear all the constraints for
the active object only' to 'Clear all the constraints for the selected
objects'.

Also the tooltip for 'Clear Pose Constraints' in Pose Mode was updated
for consistency with the above update.

Pull Request: https://projects.blender.org/blender/blender/pulls/106918
2023-05-02 10:23:51 +02:00
YimingWu
4c99043a85 Weight Paint: Fix wrongly used lookup_or_default()
This function is changed by #107059 since my original patch in #106417,
so when merged it caused compilation error. Now fixed.

Pull Request: https://projects.blender.org/blender/blender/pulls/107529
2023-05-02 10:19:35 +02:00
Campbell Barton
03377281d2 Cleanup: avoid nullptr casts to access a struct members size 2023-05-02 17:19:49 +10:00
Campbell Barton
015343033c Cleanup: use FILE_MAX instead of PATH_MAX for sequencer add code
This is clamped by StripElem::name which is a filename component,
so no need to use PATH_MAX which is much larger.
2023-05-02 17:19:48 +10:00
Campbell Barton
b315a17902 Cleanup: replace strcpy, strcat with BLI_string_join
Avoids buffer overflows & more straightforward.
2023-05-02 17:19:48 +10:00
Campbell Barton
f154d37335 BLI_path: add a size argument to BLI_path_frame
Resolves potential buffer overflow in
USDVolumeWriter::construct_vdb_file_path which passed in a smaller
fixed size buffer than FILE_MAX.
2023-05-02 17:19:48 +10:00