Commit Graph

3976 Commits

Author SHA1 Message Date
Campbell Barton
1f80345242 Cleanup: quiet some array-bounds warnings with GCC 15
Warnings remain but suppression is not as simple, see: !146150.
2025-09-12 21:48:43 +10:00
Campbell Barton
84511b8509 Core: add type checks to ID property accessors
Since moving the C++ ID property access macros cast "const" away,
replace with get/set accessors and add asserts that correct types
are used.
2025-09-12 06:29:42 +00:00
Hans Goudey
a08cd68f1e Modifiers: Use implicit sharing for some bind data
Addresses #145680.

In one (relatively extreme) test file with the surface deform modifier,
memory usage goes from 14 GB to 4 GB, and an annoying freeze
from preparing an undo step after every operation is gone.

Pull Request: https://projects.blender.org/blender/blender/pulls/145705
2025-09-11 20:00:01 +02:00
Brecht Van Lommel
1439b11de9 Fix: Build error in lite build without USD and Alembic 2025-09-10 19:37:30 +02:00
Brecht Van Lommel
6d25aad41f Cycles: Remove Alembic procedural
This was added for a fairly specialezed use case and is no longer being used
as far as we know. A future replacement would be to add a USD/Hydra procedural,
for which most of the groundwork already exists.

Pull Request: https://projects.blender.org/blender/blender/pulls/146021
2025-09-10 16:39:01 +02:00
Campbell Barton
3c7f4edd92 Cleanup: spelling in comments & string
Also back-tick quote literals in CMakeLists files.
2025-09-06 09:27:54 +10:00
Brecht Van Lommel
a4e9e4869d Refactor: Add foreach_working_space_color to ID type
Left for future work:
* Freestyle modifiers, dynamic paint, legacy texture mapping
* Editor colors: should be changed to sRGB?
* Studio light preferences: also sRGB, though less clear

Pull Request: https://projects.blender.org/blender/blender/pulls/145476
2025-09-05 19:03:32 +02:00
Brecht Van Lommel
ffa4f8c7ad Refactor: Split off lighter BLI_color_types.hh from BLI_color.hh
Functions for convert between the color types and ostream support are
now outside the classes.

Many files were changed to fix cases where direct includes for headers
were missing.

Pull Request: https://projects.blender.org/blender/blender/pulls/145756
2025-09-05 11:11:32 +02:00
YimingWu
02737c7b93 LineArt: Allow curves objects to be loaded into calculation
When line art is first developed, curves objects does not exist yet, now
it is added to line art so it will be read and take part in feature line
generation and occlusion tests.

This patch also adds "Line Art" panel for curves object, just like other
objects supported by line art.

Pull Request: https://projects.blender.org/blender/blender/pulls/145296
2025-08-28 17:28:47 +02:00
Hans Goudey
18fc19b4fe Cleanup: Rename "mloopuv" to "uv_map"
The old name refers to the `MLoopUV` struct which isn't use anymore.

Pull Request: https://projects.blender.org/blender/blender/pulls/145251
2025-08-27 17:44:08 +02:00
Sean Kim
fee064e524 Multires: Add 'Conform Base' functionality
This commit modifies the `OBJECT_OT_multires_base_apply` operator to
take in a new parameter which determines whether the final heuristic of
adjusting for a subdivision surface modifier applies.

Resolves #124553

Pull Request: https://projects.blender.org/blender/blender/pulls/145055
2025-08-27 01:39:23 +02:00
Hans Goudey
715cff1299 Cleanup: Use attribute API in weighted normal modifier
Use the attribute API instead of CustomData to access
the face strength integer attribute.

Ref #122398

Pull Request: https://projects.blender.org/blender/blender/pulls/145205
2025-08-27 00:57:33 +02:00
Hans Goudey
dce7626b6b Cleanup: Remove unused CustomData interpolation "subweights" argument
This argument is always passed as null. Removing it simplifies the
transition to `AttributeStorage`. Nowadays it seems that most more
complicated interpolation needs are not handled directly by the
CustomData system.

Pull Request: https://projects.blender.org/blender/blender/pulls/145197
2025-08-27 00:02:20 +02:00
Sergey Sharybin
e0154de320 Rework Bake from Multires
The main idea is to switch Bake from Multires from legacy DerivedMesh
to Subdiv. On the development side of things this change removes a lot
of code, also making it easier easier to rework CustomData and related
topics, without being pulled down by the DerivedMesh.

On the user level switch to Subdiv means:

- Much more closer handling of the multi-resolution data: the derived
  mesh code was close, but not exactly the same when it comes to the
  final look of mesh.

  Other than less obvious cases (like old DerivedMesh approach doing
  recursive subdivision instead of pushing subdivided vertices on the
  limit surface) there are more obvious ones like difference in edge
  creases, and non-supported vertex creases by the DerivedMesh.

- UV interpolation is done correctly now when baking to non-base level
  (baking to multi-resolution level >= 1).

  Previously in this case the old derived mesh interpolation was used
  to interpolate face-varying data, which gives different results from
  the OpenSubdiv interpolation.

- Ngon faces are properly supported now.

A possible remaining issue is the fact that getting normal from CCG
always uses smooth interpolation. Based on the code it always has been
the case, so while it is something to look into it might be considered
a separate topic to dig into.
2025-08-22 17:59:27 +02:00
Casey Bianco-Davis
18da9cc777 Fix #142644: Grease Pencil: Subdivide Modifier not smoothing first point when cyclical
The problem was that the `Subdivide Modifier` would not apply catmull clark
smoothing to the first and last points when a curve was cyclical.

This also fixes a mistake were the smoothing would read from the same data
as writing, leading to the shape to be skewed.

Pull Request: https://projects.blender.org/blender/blender/pulls/144529
2025-08-15 12:19:41 +02:00
Jesse Yurkovich
0240a1f32f Cleanup: CMake: Modernize bf_intern_openvdb dependencies
This follows the other CMake "modernization" commits, this time for
`bf_intern_openvdb` and the OpenVDB dependency itself.

The difference with this one is that `intern/openvdb` becomes an
"optional" dependency itself. This is because downstream consumers often
want to include this dependency rather than openvdb directly, so this
target must also be optional. Optional, in this case, means the target
always exists but may be entirely empty.

Summary
- If you are using BKE APIs to access openvdb features, then use the
  `bf::blenkernel` target
- If you are only using `intern/openvdb` APIs then use the
  `bf::intern::optional::openvdb` target (rare)
- For all other cases, use the `bf::dependencies::optional::openvdb`
  target (rare)

context: https://devtalk.blender.org/t/cmake-cleanup/30260
Pull Request: https://projects.blender.org/blender/blender/pulls/137071
2025-08-12 21:26:38 +02:00
Falk David
8873dff159 Fix: Grease Pencil: Assert in length modifier due to wrong argument
Discovered in #144048.

The `evaluated_length_total_for_curve` function expects the correct
cyclic value of the curve to be passed in.
2025-08-08 13:45:36 +02:00
Campbell Barton
cccc2c77c5 Cleanup: consistent for C-style comment blocks 2025-08-08 07:37:33 +10:00
YimingWu
6f57268e9a LineArt: Use "Radius" instead of "Thickness" for generating strokes
Previously line art uses the same thickness value as found in grease
pencil before blender v4.3 for generating strokes, now everything is
migrated to using "radius", so it makes more sense to change that it to
using "radius" so it's consistent with everywhere else.

Pull Request: https://projects.blender.org/blender/blender/pulls/144121
2025-08-07 15:40:17 +02:00
Falk David
4a013194dd Cleanup: Core: Replace FPS scene macro with member function
Replaces the `FPS` macro with `scene->frames_per_second()`.

The macro has two major issues:
* It hides that it depends on a `Scene *` variable named `scene`.
* It makes debugging harder.

This is now replaced with a member function on the scene.

Pull Request: https://projects.blender.org/blender/blender/pulls/144127
2025-08-07 11:30:25 +02:00
Jacques Lucke
54bfc11f68 Cleanup: avoid indenting entire geometry nodes modifier blend-write function 2025-08-04 06:39:16 +02:00
YimingWu
250e809d6f Fix #143870: Grease Pencil: Fix typo in dash modifier
Previously modified by e7a3f0758e, should be `!joined_geo.has_curves()`.

Pull Request: https://projects.blender.org/blender/blender/pulls/143889
2025-08-03 14:09:08 +02:00
Campbell Barton
2c27d2be54 Cleanup: grammar corrections, minor improvements to wording 2025-08-01 21:41:24 +10:00
Jacques Lucke
3905cdd89a Fix #143455: crash in Grease Pencil Shrinkwrap modifier when there is a dependency cycle
The case when no mesh can be retrieved from the shrinkwrap target object can be
retrieved was not handled. It was handled by `ensure_shrinkwrap_cache_data` but
the calling function didn't check if the cache was actually created.
`BKE_modifier_get_evaluated_mesh_from_evaluated_object` can return null for an
object that would usually have a mesh but the object has not been evaluated yet,
as can be the case when there is a depsgraph cycle.

From my current understanding, the issue existed without 83325d1fd. Changing the
hash just made the depsgraph do different scheduling decisions so that now the
shrinkwrap was evaluated before the target object. The order in which these two
things are evaluated is arbitrary when there is a depsgraph cycle.

Pull Request: https://projects.blender.org/blender/blender/pulls/143757
2025-08-01 12:58:31 +02:00
Campbell Barton
f281f5a500 Cleanup: header grouping
Group includes, this is mostly being done already but had become mixed
up in some areas.
2025-07-30 14:22:06 +10:00
YimingWu
272178d001 Fix #143420: Grease Pencil: Handle empty result in dash modifier
The dash modifier creates final result by combining filtered/processed
and unfiltered strokes, but this result could be empty. The code assumes
valid joined geometry when it's sometimes not the case. This patch did
a null check and it worked as it should.

Pull Request: https://projects.blender.org/blender/blender/pulls/143424
2025-07-28 13:38:08 +02:00
Campbell Barton
e8f9e2d1d1 Cleanup: use UTF8 string functions in editors & related logic
Use UTF8 aware functions unless raw bytes are expected.
2025-07-27 16:41:19 +10:00
Campbell Barton
649b89781e Cleanup: ensure UTF8 string copy for DNA & screen data
Use `BLI_strncpy_utf8` & `BLI_snprintf_utf8` for fixed size buffers in
DNA and screen data structures such as panels, menus & operators.

This could be considered a fix as copying a UTF8 string into a smaller
buffer without proper truncation can create an invalid UTF8 sequence.
However identifying which of these users are likely to run into would
be time consuming and not especially useful.
2025-07-26 12:33:15 +00:00
Hans Goudey
8b883a3922 Fix #143142: Displace modifier Custom Normal direction broken
Caused by cf6ee877a0
2025-07-25 09:27:57 -04:00
Hans Goudey
4f372d64d4 Geometry Nodes: Initial very basic list support
This includes a new list structure type and socket shape, a node
to create lists, a node to retrieve values from lists, and a node to
retrieve the length of lists. It also implements multi-function support
so that function nodes work on lists.

There are three nodes included in this PR.
- **List** Creates a list of elements with a given size. The values
  are computed with a field that can use the index as an input.
- **Get List Item** A field node that retrieves an element from a
  a list at a given index. The index input is dynamic, so if the input
  is a list, the output will be a list too.
- **List Length** Just gives the length of a list.

When a function node is used with multiple list inputs, the shorter
lists are repeated to extend it to the length of the longest.

The list nodes and structure type are hidden behind an experimental
feature until we can be sure they're useful for an actual use case.

Pull Request: https://projects.blender.org/blender/blender/pulls/140679
2025-07-24 16:16:40 +02:00
Hans Goudey
9c9695b103 Refactor: Move ReportList definition from DNA to blenkernel
Ever since [0], ReportList is not actually used in any DNA structs.
That makes sense, since reports are conceptually only necessary
at runtime. Move the definition of the struct to BKE_report.hh, and
fix a bunch of include errors where types were previously available
transitively. Besides adding some clarity, theoretically this change
could reduce compile times because of less header parsing.

[0]: 1bf6d8b0b9

Pull Request: https://projects.blender.org/blender/blender/pulls/138872
2025-07-24 15:59:52 +02:00
Hans Goudey
9ea9d3b777 Fix #142087: Use true normals in solidify modifier
The behavior was changed by d3f84449ad.

It's unclear whether considering custom normals is the "correct"
behavior here. Intuitively it makes more sense to use the true normals
for solidify because the purpose is generally to create even offsets
from existing goemetry. It's also valuable to just restore the old
behavior. A hypothetical node-based solidify would probably provide the
option to customize the offset vector.

Pull Request: https://projects.blender.org/blender/blender/pulls/142892
2025-07-23 14:22:15 +02:00
Guillermo Venegas
9c98ea1a18 Refactor: UI: Make button type params typed enums
This converts `eButType` and `eButPointerType` as typed enums.

This improves a bit `uiDefBut` self-documentation by taking an
struct with `ButType` and `ButPointerType` types, instead of
using a single `int` to write both enum types and bit index.

Almost all other `uiDefBut*` functions take just a `ButType`
parameter now.

`uiDefButI` for example is equivalent to:
`uiDefBut({ButType(type), ButPointerType::Int},...);`

Pull Request: https://projects.blender.org/blender/blender/pulls/142132
2025-07-18 13:12:16 +02:00
Jacques Lucke
55e2fd2929 Cleanup: unify naming for named constructors
Previously, we used an inconsistent naming scheme for such "named constructors".
Now it always uses `from_*`.

Pull Request: https://projects.blender.org/blender/blender/pulls/142175
2025-07-17 09:09:16 +02:00
Campbell Barton
fc07a4d45e Cleanup: quiet ignored qualifier & unused warnings 2025-07-17 12:30:39 +10:00
Hans Goudey
65131f22f8 Cleanup: Use Span arguments for some mesh remapping functions
Pull Request: https://projects.blender.org/blender/blender/pulls/142123
2025-07-16 21:59:25 +02:00
Hans Goudey
b20ecee555 Mesh: Move freestyle tags to generic attributes
This commit moves the freestyle edge and face mark tags to become
generic attributes, similar to other changes over the past years. The
attributes are called "freestyle_edge" and "freestyle_face", and they're
now propagated like regular boolean attributes.

Compatibility wise, forward and backward blend file compatibility are
maintained (for forward compatibility this is implemented a bit
differently than in the past because of the ongoing `AttributeStorage`
transition). In the Python API, `use_freestyle_mark` has been removed;
the attribute API should be used instead (just like bevel weights).
The BMesh (`freestyle`) accessors are removed too.

The conversions benefit from the fact that bit-wise, the old structs are
the same as `bool`, so we can convert to the old and new formats without
reallocating arrays.

Pull Request: https://projects.blender.org/blender/blender/pulls/141996
2025-07-16 18:26:26 +02:00
Guillermo Venegas
1a247fbaa8 Refactor: WM: Make OperatorCallContext an enum class, move to namespace
This allows forward declaring `OpCallContext`, avoiding the
transitive include `WM_Types.hh` in `UI_interface_layout.hh`

Pull Request: https://projects.blender.org/blender/blender/pulls/141804
2025-07-15 03:08:04 +02:00
Campbell Barton
ec8751f826 Cleanup: white-space around C-style comment blocks
Also use C++ style comments for disabling code.
2025-07-13 21:58:53 +10:00
Jesse Yurkovich
4de536c114 Cleanup: Remove unused includes of grease pencil legacy headers
Removes unnecessary usages of the following headers:
- BKE_gpencil_geom_legacy.h
- BKE_gpencil_legacy.h
- BKE_gpencil_modifier_legacy.h
- BKE_grease_pencil_legacy_convert.hh
- DNA_gpencil_legacy_types.h

Pull Request: https://projects.blender.org/blender/blender/pulls/141471
2025-07-11 05:01:57 +02:00
Hans Goudey
a3e8da0072 Cleanup: Line Art: Simplify Freestyle flag CustomData access 2025-07-10 22:18:06 +02:00
Hans Goudey
5b6e632582 Cleanup: Use attribute API for solidify modifier result attributes
Use the attribute API for the result bevel weight and crease custom
interpolation.
2025-07-10 22:18:06 +02:00
Hans Goudey
cec05ab440 Cleanup: Use mesh helper functions to access vertex group data 2025-07-10 16:17:05 +02:00
Guillermo Venegas
f22ea2e0ae Refactor: UI: Remove uiItemEnumO* functions
Similar to other removed UI layout functions, this removes uiItemEnumO*
functions and replaces them by calling `uiLayout::op` and writing enum
properties to the returned RNA pointer.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/141632
2025-07-10 07:57:21 +02:00
Lukas Tönne
090d3ea994 Refactor: Armature deform API and threading function cleanup
Improved readability of `armature_deform.cc` high level API functions
by using spans, references, and optional values instead of raw pointers.
Threading callbacks are reorganized to avoid unused function parameters
in code branches and makes it easier to verify which parts of the code
are executed for given input arguments.

Pull Request: https://projects.blender.org/blender/blender/pulls/141453
2025-07-07 15:50:38 +02:00
Guillermo Venegas
a0f9e25682 Refector: UI: Add uiLayout decorator, menu_contents and progress_indicator methods
This replaces uiItemMContents, uiItemDecoratorR* and
uiItemProgressIndicator API with uiLayout methods following
uiLayout refactors and the Python API.

`eButProgressType` is changed to a typed enum class
`blender::ui::ButProgressType`

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/141189
2025-07-02 10:06:48 +02:00
Hans Goudey
1f92fd7577 Refactor: Use AttrType instead of CustomData type in attribute API
Change `eCustomDataType` to `bke::AttrType` for uses of the attribute
API (the `AttributeAccessor` one anyway). I didn't touch any values that
might be saved in files; those should be handled on a case by case basis.

Part of #122398

Pull Request: https://projects.blender.org/blender/blender/pulls/141301
2025-07-01 22:14:26 +02:00
Hans Goudey
85dae1757e Cleanup: Use attribute API for some solidify modifier inputs 2025-07-01 19:20:05 +02:00
Hans Goudey
e9cd348a36 Cleanup: Use attribute API for colors in particle instance modifier 2025-07-01 19:20:05 +02:00
Hans Goudey
22e6aa619b Cleanup: Use attribute API to access UV maps in a few places 2025-07-01 19:20:05 +02:00