Commit Graph

103042 Commits

Author SHA1 Message Date
Sybren A. Stüvel
0ddd0460f0 Anim, when removing bone constraints, clear the constflag
When removing all constraints from pose bones, just reset the `constflag`
field to `0`, instead of clearing out specific flags. It was already
missing a flag that should have been cleared.

Effectively no functional changes, just a nice cleanup.
2023-09-25 14:33:51 +02:00
Sybren A. Stüvel
05b725c744 Anim: redefine PCHAN_HAS_CONST flag to mean "has a constraint"
Change the definition of the `PCHAN_HAS_CONST` pose channel flag. It used
to mean "has a constraint that is not IK or Spline IK", and now it just
means "has a constraint".

This has no direct effect yet, as the flag is only used in drawing code
when there is no (spline) IK constraint. However, I feel that the flag
name should match its expected behaviour, and IMO, in this case, making
that behaviour simpler is better than documenting more.
2023-09-25 14:33:51 +02:00
Sybren A. Stüvel
12fc4b6c58 Refactor: anim, change if-elseif-else chain to switch + reduce iterations
Refactor `BKE_pose_channel_copy_data()` so that it iterates over the entire
armature only once (instead of twice), and to use a `switch` instead of
a chain of `if`/`else if`/`else` clauses.

No functional changes.
2023-09-25 14:33:51 +02:00
Sybren A. Stüvel
69bf3f4e9a Refactor: simplify visualkey_can_use() function
Just some reordering to simplify things, and to put the cheapest checks
first.

No functional changes, except for the addition of a `BLI_assert()` to
check cases in which this function shouldn't be called anyway.
2023-09-25 14:33:51 +02:00
Sybren A. Stüvel
08f1ec65c7 Refactor: anim, avoid function call in draw_bone_relations()
Avoid a call to `bone.as_posebone()`, as the result of that call is already
stored in the `pchan` variable.

No functional changes.
2023-09-25 14:33:51 +02:00
Hans Goudey
6875925efa Geometry Nodes: Add option to force inputs to be single values
Add a checkbox to node group inputs to force inputs to be single values
and not accept varying fields. While this could also be done more
automatically, and it could be argued that requiring the flexibility is
helpful for users who want to use attributes, there are cases where the
field inferencing doesn't work, or the "use attribute" option is just
unhelpful. People use workarounds with primitive nodes to get the same
behavior anyway.

Pull Request: https://projects.blender.org/blender/blender/pulls/112745
2023-09-25 13:39:44 +02:00
Omar Emara
869d0aeaa1 Fix: Cached distortion grids are not reset
The patch that introduced distortion grids forgot to reset them in the
static cache manager.
2023-09-25 14:13:42 +03:00
Miguel Pozo
8fbfc991a5 Fix: EEVEE-Next: Surfel debug draw
Regression after 5ad7d81549.
2023-09-25 12:55:23 +02:00
Jeroen Bakker
a6d6251b6e Fix #111532: Partial Update Byte Data Texture with Scaling Broken
When texture painting on a Non-color byte texture with Texture limit active
(or the texture didn't fit on the GPU) the data for partial updating of a GPU
texture was incorrect.

`gpu_texture_update_scaled` expects an input buffer clipped to
the bounds of the input area that needs to be updated. In case for Byte
textures with Non Color colorspace  it received the unmodified input
buffer, resulting in incorrect data to be uploaded to the GPU texture.

This PR fixes this by selecting the non-optimized branch when the
texture is a Byte buffer with Data color space and scaling should
happen.

Pull Request: https://projects.blender.org/blender/blender/pulls/112834
2023-09-25 12:46:17 +02:00
Miguel Pozo
eefeb3ee22 Fix #112675: Workbench: Shadows disabled for active object 2023-09-25 12:43:26 +02:00
Falk David
16e195a111 Cleanup: GPv3 layer tree manipulations
In preparation of https://projects.blender.org/blender/blender/pulls/112535, we need to make sure all layer tree manipulations are in functions on the `GreasePencil` struct so we can keep the `CustomData` for layers in sync with the layer tree.

 This PR makes sure that all the functions that change the layer tree in any way are `protected` on the `LayerGroup` class. The `GreasePencil` struct is declared `friend` with `LayerGroup`.

We also cleanup and remove a lot of code duplication between layers and layer groups and try to write functions in a generic way for `TreeNode` (both layers and layer groups are tree nodes).

Pull Request: https://projects.blender.org/blender/blender/pulls/112837
2023-09-25 12:11:18 +02:00
Alexander Gavrilov
2abd026cfe Anim: remove the deprecated use_inherit_scale bone property.
This boolean property has been replaced with an enum all the way
back in 2019, so it is time to remove it completely. It is purely
an RNA wrapper around the real enum property, so the only thing
this change can break is some python scripts and add-ons.

Pull Request: https://projects.blender.org/blender/blender/pulls/112836
2023-09-25 11:13:36 +02:00
Jacques Lucke
8362563949 UI: show recently selected items at the top of searches
The goal is to make the search faster to use by dynamically adapting to the user.
This can be achieved using the simple but common approach of showing recently
selected items at the top. Note, that the "matching score" between the query and
each search item still has precedence when determining the order. So the last used
item is only at the top, if there is no other search item that matches the query better.

Besides making the search generally faster to use, my hope is that this can also
reduce the need for manually weighting search items in some places. This is
because while the ordering might not be perfect the first time, it will always be
once the user selected the element that should be at the top once.

This patch includes:
* Support for taking recent searches into account in string searching.
* Keep track of a global list of recent searches.
* Store recent searches on disk similar to recently opened files.
* A new setting in the user preferences that allows disabling the functionality.
  This can be used if deterministic key strokes are required, e.g. for automated tests.

In the future this could be improved in different ways:
* Add some kind of separator in the search list to indicate which elements are at
  the top because they have been used recently.
* Store the recent search items per search, instead of in a global list. This way
  it could adapt to the user even better.

Pull Request: https://projects.blender.org/blender/blender/pulls/110828
2023-09-25 10:56:12 +02:00
Jeroen Bakker
676a03cf1e Cleanup: Make format 2023-09-25 09:35:00 +02:00
Campbell Barton
e38ff7c06d Cleanup: use C++ comments for disabled code 2023-09-25 17:06:04 +10:00
Omar Emara
acb88528a5 Realtime Compositor: Implement Inpaint node
This patch implements the Inpaint node for the Realtime Compositor. The
inpainting region is filled by sampling the color of the nearest boundary pixel
if it is not further than the user supplied distance. Additionally, a lateral
blur is applied in the tangential path to the inpainting boundary to smooth out
the inpainted region.

The implementation is not identical to the existing CPU implementation due to
technical infeasibility. In particular, the CPU implementation uses a Manhattan
distance transform, while the GPU implementation uses an Euclidean one, which is
a consequence of the use of the Jump Flooding algorithm. Furthermore, the CPU
uses a serial convolution starting from the boundary outwards, while the GPU
uses a lateral Gaussian blur in the direction tangent to the boundary.

Pull Request: https://projects.blender.org/blender/blender/pulls/111792
2023-09-25 08:45:46 +02:00
Omar Emara
5008938a1c Realtime Compositor: Implement Double Edge Mask node
This patch implements the Double Edge Mask node for the Realtime
Compositor. The implementation is primarily based on the 1+JFA Jump
Flooding algorithm, which was also introduced in this commit.

Pull Request: https://projects.blender.org/blender/blender/pulls/112223
2023-09-25 08:35:42 +02:00
Peng Yan
f59ef84835 Cleanup: avoid redundant loop extruding face regions
Correct typo in bmo_extrude.cc that lead to a redundant loop over
a vertices faces.
2023-09-25 16:02:11 +10:00
Campbell Barton
6c91e1c205 Cleanup: spelling in comments 2023-09-25 15:25:43 +10:00
Campbell Barton
1a5326fe02 Cleanup: remove commented DNA_struct_member_exists check 2023-09-25 13:25:37 +10:00
Campbell Barton
e2c07b64a8 Cleanup: remove references to DNA_struct_find
There is no need to define this for versioning since DNA_struct_exists
is sufficient for versioning checks.
2023-09-25 13:20:17 +10:00
Campbell Barton
ef2d56385e Docs: improve doc-strings & grouping for DNA lookup functions 2023-09-25 13:17:35 +10:00
Campbell Barton
fc6a0e9bd3 Cleanup: prefer using with_alias(..) lookup functions
In these cases it doesn't make a difference as the named match.
Prefer the alias versions to avoid mismatch in the future.
2023-09-25 12:56:00 +10:00
Campbell Barton
e7ced9f595 Cleanup: use aliased struct name for BLO_get_struct_id_by_name
Currently this doesn't make a difference as old script names were never
used. Avoid issues in the future by using aliased names.
2023-09-25 12:39:40 +10:00
Campbell Barton
c5b53dcab4 blenloader: use aliased names for versioning checks
Avoid confusion when checking for DNA members by using the names
in DNA headers ("Light" instead of "Lamp" for e.g.)

Internally SDNA stores names without aliases for compatibility.
The intention with aliasing DNA names is for `dna_rename_defs.h`
to be the only place where the non-aliased names needed to be referenced
however versioning checks also needed to reference the old names.

This wasn't obvious, causing mistakes in versioning checks (now fixed):

- SpaceOutliner::filter
- BrushGpencilSettings::hardness
- bGPDstroke::hardness

Details:

- Alias lookup tables are now ensured for BlendFileData::filesdna.
- DNA_struct_exists & DNA_struct_member_exists now use aliased names
  in versioning code.
2023-09-25 12:26:38 +10:00
Campbell Barton
eb141f1608 DNA: differentiate with/without alias versions of SDNA lookup functions
Use with_alias / without_alias suffix for functions
so it's clear which is intended (no functional changes).

Add macros for versioning checks to avoid noisy changes,
currently they use the non-aliased versions of these functions
but should eventually be moved to use the aliased versions because
it's confusing to use the original names when these should only need
to be referenced from `dna_rename_defs.h`.
2023-09-25 12:25:32 +10:00
Campbell Barton
59210c18bc DNA: add alias version of DNA_struct_exists 2023-09-25 12:25:31 +10:00
Campbell Barton
3f8443ed6b Cleanup: use _with_alias(..) suffix for SDNA functions that uses aliases
Name the lookup functions to make it clear they are versions of the
non-aliased functions that use an alias.

Prepare for explicit with/without alias versions of functions.
2023-09-25 12:25:30 +10:00
Campbell Barton
91e48c9596 DNA: add a DNA offset lookup function that supports aliased names
Prepare for using aliased names in more places (currently unused).
2023-09-25 12:25:28 +10:00
Campbell Barton
d1699a6110 Cleanup: use _by_name(..) suffix for DNA patching functions
Remove _nr(..) suffix, make named funcitons explicit.
2023-09-25 12:25:27 +10:00
Campbell Barton
f9c9981b6b Cleanup: use const SDNA for DNA_struct_member_offset_by_name 2023-09-25 12:25:26 +10:00
Campbell Barton
35b08448c6 DNA: prevent leak running ensure alias functions multiple times
Currently this isn't causing leaks as far as I know however calling
"ensure" funcitons multiple times should be supported.
2023-09-25 12:13:29 +10:00
Campbell Barton
caef976ceb Cleanup: correct typo "hardeness" to "hardness" in DNA & variable names 2023-09-25 12:05:50 +10:00
Campbell Barton
7c614ff11d Cleanup: sort DNA rename defines (as noted in comments) 2023-09-25 12:01:08 +10:00
Campbell Barton
407e2b9f70 Fix crash in geo_node_* tests, missing null check
Missing null check in [0] caused tests
(geo_node_simulation_test_simple_particles & others) to crash.

[0]: 7015d83368
2023-09-25 10:25:48 +10:00
Jacques Lucke
eef2a706b4 Fix: UI: garbage string when invoking search from menu
The issue was that `event.utf8_buf` is not null-terminated.
In debug builds, it's explicitly filled with `0xff` which let to
the garbage characters. Now check for the size of the first
valid utf8 char and only copy that.

Thanks to PratikPB2123 for the investigation in #112719.
2023-09-24 22:37:01 +02:00
Jacques Lucke
7015d83368 Cleanup: Geometry Nodes: move functions to a more reusable place 2023-09-24 21:07:56 +02:00
NueSB
4aaae8d0a6 GPencil: Implement nearest neighbor filtering for pixelate effect
The Pixelate effect has an antialiasing switch that cleans up
pixels mostly, but still has some inbetween artifacts that are
a little frustrating to deal with. This makes it so that pixels are
completely hard-edged when AA is disabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/112605
2023-09-24 16:01:31 +02:00
Campbell Barton
b38a61fa07 Cleanup: rename DNA_genfile.h functions
Rename for clarity in preparation for further refactoring.
Remove the need for `_nr` in function names.

- Rename *_find() functions to *_exists() since they returned a boolean.
- Rename *_find_nr() functions to *_find().
- Rename *_struct_elem_* to *_struct_member_*.
- Rename DNA_elem_size_nr -> DNA_struct_member_size.
- Rename DNA_elem_offset -> DNA_struct_member_offset_by_name.
2023-09-24 16:11:13 +10:00
Campbell Barton
2721b937fb Cleanup: use braces in headers 2023-09-24 14:52:38 +10:00
Hans Goudey
c1954f9846 UI: Use "unassigned" icon for assets in modifier and node add menus
Use the same icon as in the asset browser "unassigned" item for
unassigned node group assets exposed in the modifier or node
add menus, helping to make the connection to the asset browser.
The downside is potentially drawing unnecessary attention to these
categories, but ideally they won't exist for most users anyway (since
the assets should be in proper catalogs).
2023-09-23 20:32:52 -04:00
Hans Goudey
4d07c08cc2 Fix: Missing units in quadrilateral node points inputs 2023-09-23 20:32:52 -04:00
Hans Goudey
07f01b5fc2 Curves: Add RNA API to add points
Add a simple function for adding curves to a `Curves` data-block.
The only argument is a list of the number of points in each added
curves. Attribute data is meant to be filled in separately.

It can be used like this: `curves.add_curves([8, 8, 16])`, which will
add two curves with 8 points, and one with 16 points. This API is
chosen in order to make the API generic, and to push users to
add more curves at once, rather than appending a single curve
at a time, which would be slower.

Pull Request: https://projects.blender.org/blender/blender/pulls/112400
2023-09-23 18:27:00 +02:00
Campbell Barton
d4dbbab5d9 Cleanup: locate break statements inside the case body
Follow the convention used almost everywhere in Blender's code.
2023-09-23 21:17:50 +10:00
Pratik Borhade
90f22739f7 Fix #112650: UI: Missing Header Status in Node Editor after Turning off Auto-offset
Caused by 42f8b49581
When auto-offset is OFF, garbage characters was displayed due to
uninitialized string.

Pull Request: https://projects.blender.org/blender/blender/pulls/112657
2023-09-23 12:37:25 +02:00
Campbell Barton
d2c271ec84 CMake: use bf_io_ prefix for IO tests
This simplifies running built-in IO tests with:

  ctest -R bf_io_

Also use "bf_io_" prefix for the libraries since it was already used
by some and it's a useful hint the libraries are used for IO.
2023-09-23 20:22:19 +10:00
Harley Acheson
7c636c1702 Fix #112736: Don't do Subpixel AA if not Antialised
There should be no Subpixel AA if the user has deselected
"Anti-Aliasing". Render target FT_LOAD_TARGET_MONO is strongly
hinted to pixel grid and shouldn't be messed with.

Pull Request: https://projects.blender.org/blender/blender/pulls/112759
2023-09-23 01:32:49 +02:00
Hans Goudey
e44932473a Fix: Improve button alignment of single value node group operator inputs
Animation decorators aren't used in the redo panel.
2023-09-22 15:33:45 -04:00
Hans Goudey
0e1aca735a UI: Rename "No Catalog" node assets menus to "Unassigned"
After discussion with module members, it was agreed that "Unassigned"
was better because the word is already used in the asset browser, and
because it sounds more natural.
2023-09-22 14:28:35 -04:00
Hans Goudey
70ffc7a2de Fix: Missing "Add Shortcut" for node group operator
The operator uses the relatively new "GEOMETRY_OT" prefix,
which wasn't handled in the function that finds a keymap for an
operator. To support this, choose the 3D View keymap depending
on the current mode for the geometry object types.
2023-09-22 14:28:35 -04:00