Commit Graph

110884 Commits

Author SHA1 Message Date
Hans Goudey
f187e84fe3 Cleanup: Sculpt: Remove unused variables from PBVH draw data 2024-06-28 09:18:59 -04:00
Hans Goudey
924942fadd Cleanup: Resolve warnings after previous color painting commit 2024-06-28 09:12:27 -04:00
Campbell Barton
b62afb8cd4 Unbreak build in sculpt_paint_color.cc 2024-06-28 23:09:17 +10:00
Hans Goudey
a90a7cd521 Refactor: Sculpt: Consolidate color painting API
Remove the `pbvh_colors.cc` file, since dealing with color attributes should
generally not be the responsibility of the PBVH. Move the color API functions
to the `color` namespace, replacing the two existing `SCULPT_color`
functions. Also replace `SCULPT_has_colors` and `SCULPT_has_loop_colors`
which are redundant with checking the easily accessible attributes directly.
2024-06-28 09:03:25 -04:00
Hans Goudey
155b7d6822 Refactor: Sculpt: Remove color attributes from PBVH and SculptSession
Remove `PBVH::color_layer`, `PBVH::color_domain`, and remove `vcol`, `mcol`,
`vcol_domain`, and `vcol_type` from `SculptSession`. Instead, retrieve attributes
and other arrays from the mesh as necessary and pass them around separately.
This adds more arguments to some functions but it makes their responsibilities
clearer.
2024-06-28 09:03:15 -04:00
Hans Goudey
fba79e21dd Refactor: Sculpt: Replace abstract vertex abstraction for color painting
Part of #118145.
Use vertex indices instead of `PBVHVertRef`. This doesn't lose functionality
because color attribute painting is only supported for base meshes anyway.
The next steps are refactoring the code to have the same structure as the
new brushes and using the same methods to add code paths for the other
data structures.
2024-06-28 09:03:06 -04:00
Christoph Lendenfeld
5427775fef Anim: Theme entry for time visualization
This patch adds two theme entries for data before/after the current frame.
Those entries control what color to use when displaying
reference data from a different point in time (motion path, onion skins).

They are under the `3D Viewport` section of the theme in the user preferences.

## User Facing Changes

### Grease Pencil

When `Custom Colors` is disabled it will now use the theme instead of the layer default color.
Currently this setting is enabled by default. Disable it to get Blender to use the theme.

### Motion Path
If Custom Color is disabled, read from the Theme.

### Annotations
If onion skin is enabled, and custom onion skin colors is disabled, read from the theme.

**Grease Pencil**
* previously the color used for onion skinning (without custom colors) was `U.gpencil_new_layer_col`. This is used in other places as well so it cannot be removed with this PR
* By default, custom colors are enabled with Grease Pencil objects. I specifically did **not** change that with this PR. I will instead let the GP module handle that on their terms.

This PR has been discussed in the Grease Pencil module meeting
https://devtalk.blender.org/t/2024-05-21-grease-pencil-module-meeting/34755#meeting-notes-2
and in the A&R module meeting
https://devtalk.blender.org/t/2024-05-24-animation-rigging-module-meeting/34813#patches-review-decision-time-4

Pull Request: https://projects.blender.org/blender/blender/pulls/120558
2024-06-28 14:59:41 +02:00
Sybren A. Stüvel
c4a7c4e2a1 Anim: add ID* cache of users to Action Bindings
Keep track of which IDs are animated by which Action Binding. This will
be necessary for display in the Action editor, where animation data that
is unrelated to the active object can be shown (when "show all bindings"
is on).

Note: animation evaluation will not be using this cache, at least not in
the near future. Potentially when we introduce animation-level
constraints this will change, but that's for the future.

The user cache isn't actually used in this commit. It will be used soon
in !122672.

Pull Request: https://projects.blender.org/blender/blender/pulls/123187

Pull Request: https://projects.blender.org/blender/blender/pulls/123187
2024-06-28 14:41:27 +02:00
Sybren A. Stüvel
d342f64fa4 Core: add BKE_lib_query_foreachid_process_main_get() function
Add a function to get the `Main *bmain` pointer from a
LibraryForeachIDData struct. Since the struct is opaque to the
`..._foreach_id` functions, a separate function like this is necessary
to get that pointer.

Not used yet, but will be in a followup commit.

Pull Request: https://projects.blender.org/blender/blender/pulls/123187
2024-06-28 14:41:26 +02:00
Sybren A. Stüvel
d3aa4ecfe6 Core: pass bmain to BKE_library_foreach_ID_link() wherever possible
Pass a non-`nullptr` `bmain` to `BKE_library_foreach_ID_link()` wherever
that `bmain` is known at the call site. This will be used in a followup
commit.

This should not introduce any functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/123187
2024-06-28 14:41:26 +02:00
Philipp Oeser
74c4b41f1a Merge branch 'blender-v4.2-release' 2024-06-28 14:35:13 +02:00
Philipp Oeser
33ca4daf8f Fix #123882: Ocean Modifier not updating normals in "Displace" mode
Exposed by 383a145a19

The real culprit was in 6a3c3c77b3 though (where the original meshes
normals were tagged dirty instead of the result's).

So to resolve, now tag the result (not the original).

Pull Request: https://projects.blender.org/blender/blender/pulls/123893
2024-06-28 14:34:26 +02:00
Pratik Borhade
5b444f5954 Fix: GPv3: Use OPTYPE_UNDO for color tag operator
Was missed in cea18e62c5.

Pull Request: https://projects.blender.org/blender/blender/pulls/123897
2024-06-28 14:13:38 +02:00
Philipp Oeser
dc72e5bac9 Merge branch 'blender-v4.2-release' 2024-06-28 13:54:01 +02:00
Philipp Oeser
296d05060d Fix #123560: Select by active material fails in multi-object-edit mode
This was the case when the slot index in the active object is greater
than the available slots of other selected objects.

Code was trying to avoid searching all materials by using
`BKE_object_material_get` to get an appropriate index (an addition to
D4441 added in 6b39dc7672). That function has the behavior of clamping
if a target index is greater than the available slots (for good
reasons), so we cant rely on the slot index being the same if
`BKE_object_material_get` finds a material. So in essence, this is not
what we want to use in this case.

 Now use the much simpler `BKE_object_material_index_get` to get the
index [this might be less performant in certain scenarios, dont think
this is critical though and correctness should beat performance here]

Pull Request: https://projects.blender.org/blender/blender/pulls/123718
2024-06-28 13:53:20 +02:00
Jeroen Bakker
3434260874 Vulkan: Add support for Cycles CPU
Other Cycles backend might also work. Not sure about or Optix/Cuda
as they require GPU synchronization.

Pull Request: https://projects.blender.org/blender/blender/pulls/123895
2024-06-28 13:51:51 +02:00
Jeroen Bakker
da4746fe96 Vulkan: Fix copy depth images with stencil
When copying the depth aspect of a depth+stencil image the incorrect
barriers where created. The barrier needs to have the full aspect, even
when we only copy a single aspect from the image.

Pull Request: https://projects.blender.org/blender/blender/pulls/123890
2024-06-28 13:13:33 +02:00
Jacques Lucke
eb35212f3d Cleanup: make format 2024-06-28 13:09:06 +02:00
Jacques Lucke
3410d0bf3f Nodes: simplify node link drawing shader
* Better separation between drawing backdrop and main line.
* Pass u and v coordinates of line to fragment shader for further processing.
* Remove `colorGradient` which can also be computed from `lineUV`.
* Simplify drawing potentially more than one parallel line as is done in #112677.
2024-06-28 13:08:05 +02:00
Pratik Borhade
91bbb27f8c Fix: GPv3: Object line art not working
Adding object line art does not work because the wrong source
object (lineart itself is set). `add_type/BKE_object_add_for_data` function
deselects all bases and sets new line art object as active. Get active object
before calling this function to fix this.

Pull Request: https://projects.blender.org/blender/blender/pulls/123836
2024-06-28 12:59:32 +02:00
Jacques Lucke
43c3ab9acb Geometry Nodes: refactor multi-input handling in lazy-function graph generation
The goal here is to remove the assumption that multi-inputs will always
have a corresponding node that packs all individual values into a `Vector`
(which is what `LazyFunctionForMultiInput` is doing).
2024-06-28 12:49:44 +02:00
Jacques Lucke
dda4a50bf5 Geometry Nodes: add utility to access logged primitive values 2024-06-28 12:46:08 +02:00
Jacques Lucke
d367b6e4a2 Nodes: add non-const owner_tree access 2024-06-28 12:44:44 +02:00
Jacques Lucke
d819bed88f Merge branch 'blender-v4.2-release' 2024-06-28 12:27:20 +02:00
Jacques Lucke
d6bf027f38 Fix: properly handle negative scale in safe conversion to loc/rot/scale 2024-06-28 12:20:46 +02:00
Jacques Lucke
7866fcd869 Fix: convert math::Axis to vector 2024-06-28 12:16:56 +02:00
Julian Eisel
b59e009acc UI: Add function to query debug name of view items
No user visible change expected.

There's no good way to identify items from their base class which is
annoying for development/debugging. I ended up adding a helper like this
a few times, so makes sense to just add this to the API.
2024-06-28 12:14:38 +02:00
Dalai Felinto
b528aca711 Merge remote-tracking branch 'origin/blender-v4.2-release' 2024-06-28 11:46:45 +02:00
Falk David
270c4fad48 Fix #123876: Crash using eyedropper tool
Caused by 6967255906.
The code was assuming that `UI_context_active_but_prop_get`
would return a valid button.
This simply checks if the returned value is not `nullptr`.

Pull Request: https://projects.blender.org/blender/blender/pulls/123879
2024-06-28 11:33:58 +02:00
Dalai Felinto
51e68fe0ed Cleanup: make format 2024-06-28 11:31:54 +02:00
Nathan Vegdahl
c83727f0bd Anim: add functions for asserting Project Baklava phase-1 invariants
This is implemented as an overloaded function,
`assert_baklava_phase_1_invariants()`, with variants for `Action`, `Layer`, and
`Strip`.

The invariants asserted are those that are specific to phase 1 and which will
later be lifted as more features (such as animation layers, additional strip
types, etc.) are added. The intention is for this to serve as a kind of todo
marker for later phases *and* to help ensure that the phase-1 invariants
currently hold at runtime.

In addition to adding the overloaded function itself, this commit also uses it
in a couple of places in the keyframing code.  Upcoming work on the keyframing
code will be using it more.

This is based on a discussion with @dr.sybren.

Pull Request: https://projects.blender.org/blender/blender/pulls/123830
2024-06-28 11:06:34 +02:00
Damien Picard
92c026c39b I18n: Fix multi-context message extraction regex
The BLT_I18N_MSGID_MULTI_CTXT() macro allows extracting a single
message into up to 16 different contexts. The regex to do that was
slightly wrong because it did not account for the macro potentially
ending with a ",".

The contexts for "New" were also sorted.

Pull Request: https://projects.blender.org/blender/blender/pulls/123793
2024-06-28 10:42:47 +02:00
Nathan Vegdahl
cae1faec12 Refactor: bundle fcurve lookup/creation parameters in a struct
This is a follow up to #123022 to clean up the resultant verbose parameter
passing.  We add a new struct `FCurveDescriptor` that contains the parameters
needed for either looking up or creating an fcurve, and that in turn is passed
down the keyframing call chains where fcurve lookup/creation needs to be done.

Pull Request: https://projects.blender.org/blender/blender/pulls/123486
2024-06-28 09:39:51 +02:00
Sean Kim
549d6fb573 Cleanup: Sculpt: Add assert on span size for helper method
Pull Request: https://projects.blender.org/blender/blender/pulls/123872
2024-06-28 06:25:47 +02:00
Harley Acheson
4ef2381ce3 Cleanup: UI: Remove Unused Icon Texture Drawing Code
About 330 lines of code removed that supported the old
ICON_TYPE_COLOR_TEXTURE icon drawing.

Pull Request: https://projects.blender.org/blender/blender/pulls/123868
2024-06-28 05:25:18 +02:00
Campbell Barton
0167dd08fc Merge branch 'blender-v4.2-release' 2024-06-28 12:04:13 +10:00
Campbell Barton
9d10b88f37 Cleanup: remove unnecessary icon scanning on startup
Blender was performing a redundant scan for icons on startup (200 files)
remove this since it adds small but unnecessary overhead.

Part of !123870
2024-06-28 11:53:44 +10:00
Campbell Barton
d77ebc41de Cleanup: remove icon file lists & unused functions
On started Blender was scanning icons for PNG's to display in the theme menu
which hasn't been available since early 2.x days.

Also remove some other unused icon functions.

Pull Request: https://projects.blender.org/blender/blender/pulls/123870
2024-06-28 03:38:25 +02:00
Hans Goudey
1ede471ba2 Cleanup: Remove unnecessary namespaces, pass math types by value
Also remove meaningless const in function declarations.
2024-06-27 17:52:16 -04:00
Sean Kim
868fed96c9 Cleanup: Sculpt: Remove unused sculpt clay brush code
Removal was missed in 0bc7631693.

Pull Request: https://projects.blender.org/blender/blender/pulls/123866
2024-06-27 23:50:58 +02:00
Harley Acheson
4d84940253 UI: File Browser File Type Icons Use Shader Outline
In the File Browser we sometimes show tiny icons at the bottom-left of
items. This PR draws these using the shader's outline mode rather than
overprinting them twice.

Pull Request: https://projects.blender.org/blender/blender/pulls/123865
2024-06-27 23:48:38 +02:00
Lukas Stockner
6967255906 Color management: Support white balance as part of the display transform
This implements a von-Kries-style chromatic adaption using the Bradford matrix.
The adaption is performed in scene linear space in the OCIO GLSL shader, with
the matrix being computed on the host.

The parameters specify the white point of the input, which is to be mapped to
the white point of the scene linear space. The main parameter is temperature,
specified in Kelvin, which defines the blackbody spectrum that is used as the
input white point. Additionally, a tint parameter can be used to shift the
white point away from pure blackbody spectra (e.g. to match a D illuminant).

The defaults are set to match D65 so there is no immediate color shift when
enabling the option. Tint = 10 is needed since the D-series illuminants aren't
perfect blackbody emitters.

As an alternative to manually specifying the values, there's also a color
picker. When a color is selected, temperature and tint are set such that this
color ends up being balanced to white.
This only works if the color is close enough to a blackbody emitter -
specifically, for tint values within +-150. Beyond this, there can be ambiguity
in the representation.
Currently, in this case, the input is just ignored and temperature/tint aren't
changed. Ideally, we'd eventually give UI feedback for this.

Presets are supported, and all the CIE standard illuminants are included.

One part that I'm not quite happy with is that the tint parameter starts to
give weird results at moderate values when the temperature is low.
The reason for this can be seen here:
https://commons.wikimedia.org/wiki/File:Planckian-locus.png
Tint is moving along the isotherm lines (with the plot corresponding to +-150),
but below 4000K some of that range is outside of the gamut. Not much can
be done there, other than possibly clipping those values...

Adding support for this to the compositor should be quite easy and is planned
as a next step.

Pull Request: https://projects.blender.org/blender/blender/pulls/123278
2024-06-27 23:27:58 +02:00
Harley Acheson
9ae237d0b4 UI: Allow Discretionary Use of Icon Outline
Icons can have contrasting outlines, but currently this can only happen
for some icons and when the theme setting "Icon Border" is greater than
zero. This change shows them in the same situations but also allows
them to be shown when needed. For special situations like having an
icon overlay on an icon, or for the icons in the corners of File
Browser preview items, etc.  In a nutshell this allows UI_icon_draw_ex
to honor its outline argument, rather than ignoring it unless the theme
setting was also set.

Pull Request: https://projects.blender.org/blender/blender/pulls/123863
2024-06-27 23:00:53 +02:00
Falk David
8f64329c79 Refactor: Use newer attribute API in create_liquid_geometry
The `create_liquid_geometry` still used the older attributes
API to write the velocities.
This replaces the use of `BKE_attribute_new` with
the newer attribute API.
No functional changes expected.

Pull Request: https://projects.blender.org/blender/blender/pulls/123854
2024-06-27 20:39:30 +02:00
Sergey Sharybin
d16eac9cee Merge branch 'blender-v4.2-release' 2024-06-27 19:57:51 +02:00
Hans Goudey
e1ca54c52a Fix #123768: Sculpt: Crash on undo with multires 2024-06-27 13:54:01 -04:00
Falk David
a0f0a4dd49 Cleanup: Remove BKE_attribute_allow_procedural_access
This function was already replaced by `bke::allow_procedural_attribute_access`.
Removes the rest of the usages.

Pull Request: https://projects.blender.org/blender/blender/pulls/123852
2024-06-27 19:20:04 +02:00
Miguel Pozo
baf07c22bd Revert "Fix #123794: Crash when UDIMs have gray and color tiles"
This reverts commit 095e78bd28.
2024-06-27 19:15:55 +02:00
Miguel Pozo
095e78bd28 Fix #123794: Crash when UDIMs have gray and color tiles 2024-06-27 19:14:48 +02:00
Michael Kowalski
b2f8f5a491 Fix: USD import: domelight Y-up orientation
Added necessary rotation to convert from Y-up to Z-up when
importing USD dome lights as world materials.

Pull Request: https://projects.blender.org/blender/blender/pulls/123797
2024-06-27 19:06:49 +02:00