Commit Graph

119277 Commits

Author SHA1 Message Date
Jesse Yurkovich
ba60868477 USD: Animated camera property import
Imports in the following animated data from UsdGeomCameras:
- Focal length
- DOF distance
- DOF fstop
- Clip start, Clip end
- Tilt shift x, Tilt shift y
- Aperture sizes (with caveats)

Implementation wise, it's more complicated than I'd like due to needing
to read in both non-animated and animated data for each property. And
because I've tried to reduce the duplication of various transforms we
have to do on each value. E.g. scaling values by "tenth of scene units"
or the extraction of the USD clipping range from a GfVec2f into 2
separate properties, and 2 separate fcurves, in Blender etc. The current
approach was the best I could come up with so far.

Aperture sizes remain problematic for import, with animation data and
without, due to how Blender selects the largest sensor dimension to base
downstream calculations on and for which there's no concept in USD to
strictly dictate which dimension to use. Additionally, changing the
sensor size will impact the Tilt values as well. This means that if the
Aperture sizes are animated, we must also animate the tilt values; leads
to more fcurves being created than perhaps expected.

The `projection` attribute (perspective and orthographic) remains
unchanged (non animated only) due to differences in how USD<>Blender
interoperate with the Orthographic projection method. Note: Blender only
exports perspective cameras due to the same reason.

Pull Request: https://projects.blender.org/blender/blender/pulls/137487
2025-04-25 19:57:12 +02:00
Guillermo Venegas
90644b30b2 Refactor: UI: Replace uiLayoutRow with class method uiLayout::row
This converts the public `uiLayoutRow` function to an object oriented
API (`uiLayout::row`), matching the python API.
This reduces the difference between the C++ API with the python version,
its also helps while converting code from python to C++ code (or vice-versa),
making it almost seamless.

`uiLayout::row` now returns an `uiLayout` reference instead of a pointer.
New calls to this method should use references too.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/137979
2025-04-25 19:45:25 +02:00
Lukas Stockner
bf412ed9dd Cycles: Support for custom OSL cameras
This allows users to implement arbitrary camera models using OSL by writing
shaders that take an image position as input and compute ray origin and
direction.

The obvious applications for this are e.g. panorama modes, lens distortion
models and realistic lens simulation, but the possibilities are endless.

Currently, this is only supported on devices with OSL support, so CPU and
OptiX. However, it is independent from the shading model used, so custom
cameras can be used without getting the performance hit of OSL shading.

A few samples are provided as Text Editor templates.

One notable current limitation (in addition to the limited device support)
is that inverse mapping is not supported, so Window texture coordinates and
the Vector pass will not work with custom cameras.

Pull Request: https://projects.blender.org/blender/blender/pulls/129495
2025-04-25 19:27:30 +02:00
Clément Foucault
81c00bf272 EEVEE: Shadow Terminator Normal Bias
This implement the design detailed in #135935.

A new per object property called `Shadow Terminator Normal Offset` is
introduced to shift the shadowed position along the shading normal.

The amount of shift is defined in object space on the object datablock.

This amount is modulated by the facing ratio to the light. Faces
already facing the light will get no offset. This avoids most light
leaking artifacts.

In case of multiple shading normal, the normal used for the shift
is arbitrary. Note that this is the same behavior for other biases.

The magnitude of the bias is controlled by `Shadow Terminator Normal Offset`.
The amount of faces affected by the bias is controlled using
`Shadow Terminator Geometry Offset` just like cycles.

Tweaking the `Shadow Terminator Geometry Offset` allows to avoid too much
shadow distortion on surfaces with bump mapping.

Cycles properties are copied from the Cycles object datablock to the
blender datablock. This break the python API for Cycles.

The defaults are set to no bias because:
- There is no good default. The best value depends on the geometry.
- The best value might depend on real-time displacement.
- Any bias will introduce light leaking on surfaces that do not need it.
- There is an additional cost of enabling it, which is proportional
  to the amount of pixels on screen using it.

Pull Request: https://projects.blender.org/blender/blender/pulls/136935
2025-04-25 19:12:04 +02:00
Clément Foucault
417ffa8f54 Fix #137097: Cycles: No occlusion with Grease Pencil in the viewport
This was caused by missing depth of objects.
The old implementation was relying on the external engine
to provide the correct depth of the objects.
This patch does exactly this.

The downside is that, if overlays are present, the prepass
will be also drawn by the overlay engine.

Pull Request: https://projects.blender.org/blender/blender/pulls/138004
2025-04-25 19:05:57 +02:00
Harley Acheson
94acb16e7e UI: Remove Gizmo 3D Part Hit-space Scaling
Removal of the code that scales gizmo 3D part hitspace with gizmo size,
introduced in a043a0e74d, as requested by Campbell.

Pull Request: https://projects.blender.org/blender/blender/pulls/138007
2025-04-25 18:51:58 +02:00
Bastien Montagne
6231267d86 Add missing header in compositing node code after recent change.
Recent clang compilers do not like types that are not fully defined in
the current unit...
2025-04-25 18:30:14 +02:00
Hans Goudey
afd8d744e1 Shape Keys: Tweaks to duplicate operator
- The new shape key is added directly below the source.
- The new shape key is made active.
- The flag, including the lock status, is now copied.
2025-04-25 12:28:37 -04:00
Philipp Oeser
c08d0b53e9 Fix #131778: Grease Pencil: Cursor radius wrong for transformed object
Cursor radius wouldnt match the drawn line if the object was not at the
origin.

When getting the radius in `grease_pencil_brush_cursor_draw`,
`DrawingPlacement::project` gives us a location in layer space.
The following `project_brush_radius` expects a worldspace location as
input though.

So to resolve, convert to worldpsace again.

Pull Request: https://projects.blender.org/blender/blender/pulls/138006
2025-04-25 17:56:57 +02:00
Sybren A. Stüvel
1625d9359d Fix #137864: Action Constraint without Action produces invalid result
When there is no Action set on an Action constraint, the matrix returned
by the constraint would be uninitialized. In practice, this meant an
all-zeroes matrix. Now, the unit matrix is returned in such a case.

Pull Request: https://projects.blender.org/blender/blender/pulls/137965
2025-04-25 17:24:11 +02:00
Omar Emara
7066a8fdb8 Compositor: Support link search for Glare node
This patch supports link search the glare node types, such that users
can add specific effects like Bloom quickly.

Pull Request: https://projects.blender.org/blender/blender/pulls/137988
2025-04-25 17:20:45 +02:00
Julian Eisel
79d760fcae Assets: Disable snap feedback for dragging collections that will be linked
Part of #134755 / #134766.

When linking collections without collection instancing, they cannot be
transformed, so snapping doesn't make sense. Don't draw the snapping indicator
when using drag & drop, it would be misleading.
2025-04-25 17:08:08 +02:00
ChengduLittleA
f47df7bc52 Fix #137792: Applying auto-keyframing when resetting property values.
When resetting a proprety with animation, auto-keyframing should also
record the changed value as a new keyframe.

Pull Request: https://projects.blender.org/blender/blender/pulls/137835
2025-04-25 16:41:18 +02:00
Aras Pranckevicius
393a1d3d88 Cleanup: DURIAN_CAMERA_SWITCH is always on
The DURIAN_CAMERA_SWITCH feature has been always on since c3401eb5cb
(2009, Blender 2.51), remove the preprocessor option to turn it off.

Pull Request: https://projects.blender.org/blender/blender/pulls/137991
2025-04-25 14:20:52 +02:00
YimingWu
48f9212483 Fix #137700: Guard null lt.editlatt in DRW_cache_lattice_wire_get
Switching to lattice edit mode when it has an armature modifier can
crash if the armature modifier's `show_in_editmode` is turned on. Now
prevent null `editlatt` access.

Pull Request: https://projects.blender.org/blender/blender/pulls/137701
2025-04-25 13:07:54 +02:00
Campbell Barton
93f5f57e64 Fix: correct type for wmWindow::event_queue_consecutive_gesture_type
The event type was stored in a char when event type values
require a larger range.

Also correct the doc-string location of `addmousemove`.
2025-04-25 04:24:10 +00:00
Alaska
4a2e918576 Cleanup: Make format 2025-04-25 15:46:33 +12:00
Campbell Barton
c50ae81c4d Fix: incorrect use of the last handled event
Recent commits ([0], [1]) referenced the last handled event
which is incorrect.

- It represents the previous event (not the event being handled).
- It's documented to only be used by the event queue logic.

Resolve using the current event instead of the last handled.

[0]: a043a0e74d
[1]: 5102880f51
2025-04-25 02:10:47 +00:00
ChengduLittleA
1f657cd38d Cleanup: Modeling: Don't show failed object conversion as incompatible
Previously in b795f09e22 the variable
`incompatible_count` was increased when object conversion failed, this
was not logically correct since the objects type combination is
acceptable compatible, but it's the conversion itself has failed. Do not
increase `incompatible_count` value when this happens, this makes it
consistent with the error message
2025-04-25 10:02:49 +08:00
Howard Trickey
5f57d9ac94 Modeling: fix face merging issue with manifold boolean.
The new manifold boolean operation would merge coplanar faces
even if they had different faceIDs. This doesn't fit user
expectations.
By using the manifold library's "OriginalID" mechanism, we can
prevent that from happening. However, it slows the code by
almost a factor of 2 on large examples.
The Manifold maintainers going to work on a better solution.
2025-04-24 21:32:52 -04:00
Campbell Barton
f09ca4d807 Fix #137940: 3D text cursor displays intermittently when zoomed out
Draw a wire quad along with the filled quad to ensure it's never
less than a pixel width wide.
2025-04-25 11:23:23 +10:00
Campbell Barton
b096066da5 Revert "Fix #137940: Wider Text Caret for Text Object Editing"
This reverts commit 4856cfa89c.

The change only slightly mitigated the issue, revert in favor
of an alternative fix.
2025-04-25 01:23:13 +00:00
Campbell Barton
2ef03e08b3 WM: warn when file selector properties don't match expected types 2025-04-25 10:53:20 +10:00
Campbell Barton
0314f9318c Docs: move WindowManager.fileselect_add descriptions into an example
- Allow for formatting and expanded descriptions.
- Clarify the expected types of each property.
2025-04-25 10:18:36 +10:00
Campbell Barton
2d4290f285 Cleanup: spelling in comments (make check_spelling_*)
Also inconsistent capitalization.
2025-04-24 22:45:22 +00:00
Harley Acheson
4856cfa89c Fix #137940: Wider Text Caret for Text Object Editing
While editing text objects a vertical bar is used as a text caret to
indicate the current cursor position within the string. This is drawn
by the overlay engine with a specific shader that changes size with the
object. Unfortunately this is currently too narrow and will become
subpixel and not display while the text is still readable. This PR just
increases the text caret width so that it is still visible at very
small sizes.

Pull Request: https://projects.blender.org/blender/blender/pulls/137975
2025-04-25 00:13:44 +02:00
Jonas Holzman
19fe66c940 Cleanup: Wandering semicolon in screen_ops.cc 2025-04-24 23:58:53 +02:00
Harley Acheson
587a7f877c UI: Path Line Breaking Characters
This PR adds more line breaking opportunities when breaking file paths.
This adds ".-%?&". Some, like "." are moved to the subsequent line, to
keep period with the extension.

Pull Request: https://projects.blender.org/blender/blender/pulls/137972
2025-04-24 22:23:22 +02:00
Harley Acheson
9dd4e90136 UI: Line Break on Conditional Punctuation
This PR adds new typographical line breaking opportunities, characters
that break depending on what follows. For example comma if not followed
by a space or a number. Period if not followed by a space or another
period. Along with related non-Latin equivalents, like Greek question
mark, full width punctuation, Hebrew, Arabic, etc.

Pull Request: https://projects.blender.org/blender/blender/pulls/137934
2025-04-24 20:42:32 +02:00
Hans Goudey
eb2ce222f5 Fix: Convert attribute operator can change active attribute
Part of #137964.
2025-04-24 14:30:53 -04:00
Pablo Vazquez
f4c31b75ba UI: Rename "Tris to Quads" to "Triangles to Quads"
Rename the operator label to `Triangles to Quads`. This way, when
searching it will show up both when looking for `Triangles` or `Tris`.
Instead of having to always search for `Tris` which is less intuitive.

This also matches the manual, which has been calling this operator
`Triangles to Quads` for several years now.

This does not rename any API or operator name.
2025-04-24 19:00:48 +02:00
Julian Eisel
a8b031dcc6 UI: Use two lines for Asset/File Browser file names under previews
Part of #134755 / #134766

Makes asset and file browser use up to two lines to display the name of the asset or file under
preview images. Lines are wrapped using our existing wrapping algorithm at characters like spaces,
hyphens, under-scores, etc.

This leads to much less information loss because of clipped labels in common cases. When displaying
assets or files as previews the labels would become rather useless in many cases. Especially with
smaller preview sizes.

When there's still not enough space to display the full asset or file name, the second line is
truncated in the middle, leaving the beginning, and some of the end of the label visible. This
produced best results in testing.

Pull Request: https://projects.blender.org/blender/blender/pulls/136907
2025-04-24 18:03:26 +02:00
Christoph Lendenfeld
9663d287fc Anim: merge keyframe jump operators
This merges the `GRAPH_OT_keyframe_jump` operator into the more generic
`SCREEN_OT_keyframe_jump` operator. (the former introduced with #108549)

The functionality of both operators is retained by running
a `switch/case` based on the editor type.
Doing so, we can filter out the Dope Sheet as well which fixes #93944
The `GRAPH_OT_keyframe_jump` is preserved, but when it is called,
it generates a warning stating it should not be used anymore.
It then calls directly into the `SCREEN_OT_keyframe_jump` to
ensure functionality doesn't drift apart.

Fixes #136176
Fixes #93944

Pull Request: https://projects.blender.org/blender/blender/pulls/137542
2025-04-24 18:01:05 +02:00
Julian Eisel
dd3f2ef36b Fix #137939: Collection Exporter properties no longer respond to Undo
The collection exporter UI template uses operator property drawing to
add buttons in the Properties editor. It creates a sort of mock operator
to be able to do that.

This isn't something we usually do. In all other cases where operator
properties are drawn, we don't want them to send undo pushes. Think it's
fine to make that an option of the template. It's opt in though, since
it's an unusual need.
2025-04-24 17:51:24 +02:00
Guillermo Venegas
9887f2290e Refactor: UI: Rename uiItem properties with trailing underscore
This adds a trailing underscore to uiItem member variables
to distinguish them as private.

Continuation of 7002f16992

Pull Request: https://projects.blender.org/blender/blender/pulls/137914
2025-04-24 17:22:28 +02:00
Brecht Van Lommel
a00885666b Fix #98339: Spreadsheet does not immediately report mesh subdiv info
Pull Request: https://projects.blender.org/blender/blender/pulls/137959
2025-04-24 16:07:52 +02:00
Brecht Van Lommel
e21924d0ff Cleanup: Fix kdtree node warnings with GCC
Alternative fix to 50023eab75.

Pull Request: https://projects.blender.org/blender/blender/pulls/137962
2025-04-24 16:00:44 +02:00
Brecht Van Lommel
b23aaa4641 Fix #137821: Crash with grease pencil render, compositor and render region
When using the compositor, the parent scene overrides the render resolution
and region of the child scene. Unlike workbench and EEVEE, the grease pencil
engine was reading this information from the child scene.

Pull Request: https://projects.blender.org/blender/blender/pulls/137923
2025-04-24 16:00:10 +02:00
Brecht Van Lommel
3ee7750fe1 Fix #137869, #105665, #98339: Wrong or delayed mesh subdivision stats
* Fix CPU subdivided meshes not being counted
* Fix wrong check for GPU subdivision
* Draw status bar last so stats reflect latest 3D viewport drawing

Pull Request: https://projects.blender.org/blender/blender/pulls/137959
2025-04-24 15:59:58 +02:00
Clément Foucault
84210efde8 Fix: Vulkan: Avoid warning about enum value not handled in switch 2025-04-24 15:53:21 +02:00
Clément Foucault
551b659c6f Fix: Overlay: Shader error because of implicit cast 2025-04-24 15:52:38 +02:00
Clément Foucault
438f8930cc Fix #137958: Overlay: Lines are too thick
Caused by b8f591c348.
The copy pasted code was not the same everywere.
Invert the result only for the grid shader as it
used to be.
2025-04-24 15:20:33 +02:00
Hans Goudey
0f72fffac3 UI: Clarify Boolean solver descriptions/names and make consistent
Use the same solver names and descriptions for the geometry node,
the modifier, the sculpt trim tool, and the edit mesh intersect operator.
Also clarify the descriptions, some of which used to say that the float
solver had the best performance which isn't true anymore.

Pull Request: https://projects.blender.org/blender/blender/pulls/137922
2025-04-24 15:06:26 +02:00
Clément Foucault
06e642a9a1 Fix: Overlay: Broken shader compilation due to implicit cast 2025-04-24 14:58:37 +02:00
Hans Goudey
13e0e8bd6d Viewport: Fix quadratic runtime for object box selection
Replace a linear search through all objects for every single selection
result with a Map from select ID to object base. This makes the runtime
linear instead of quadratic, resulting in a 100x performance improvement
from 6s to 60ms when selecting about half of 60k objects in a scene.

Pull Request: https://projects.blender.org/blender/blender/pulls/137832
2025-04-24 14:53:06 +02:00
Clément Foucault
59df50c326 GPU: Refactor Qualifier and ImageType
This allow to use types closer to GLSL in resource
declaration.

These are aliased for clarity in the GPU
module (i.e. `isampler2D` is shortened to `Int2D`).

Rel #137446

Pull Request: https://projects.blender.org/blender/blender/pulls/137954
2025-04-24 14:38:13 +02:00
Clément Foucault
b8f591c348 Cleanup: Overlay: Share line width macros
Pull Request: https://projects.blender.org/blender/blender/pulls/137953
2025-04-24 13:48:51 +02:00
Clément Foucault
77ed9359dc Cleanup: Overlay: Share vertex enum values 2025-04-24 13:48:51 +02:00
Clément Foucault
d2373cf5d5 Cleanup: Overlay: Use enums instead of defines 2025-04-24 13:48:51 +02:00
Christoph Lendenfeld
09df710eff Refactor: pose select enum to enum class
No functional changes.

This patch converts the `ePose_SelectSame_Mode` enum to an enum class
called `SelectRelatedMode`.
This is done in preparation of adding more modes to the operator.

Pull Request: https://projects.blender.org/blender/blender/pulls/137952
2025-04-24 13:26:56 +02:00