Commit Graph

102787 Commits

Author SHA1 Message Date
Pablo Vazquez
fd6076ae3e UI: Add icons to Color Ramp context menu items
* Add icon to "Reset Color Ramp" (same used by Reset to Default Value)
* Add icon to "Flip Color Ramp" (sideways arrows, similar to invert
  vertex groups).
* Add separators after stops distribution operators, and before
  reset since they have pretty different purposes.
2023-09-17 00:31:47 +02:00
Jacques Lucke
c63f4e3085 Geometry Nodes: use separate struct for side effect nodes
This makes it easier to add another map containing side effect
nodes in #112421.

No functional changes expected.
2023-09-16 18:57:04 +02:00
Jacques Lucke
54fd33d783 Functions: support wrapping lazy-function node execute function
This is a light weight solution to passing in some extra context into
a lazy-function that is invoked by the graph executor.
The new functionality is used by #112421.
2023-09-16 18:50:54 +02:00
Jacques Lucke
93f8d55473 Function: add assert to detect invalid side effect nodes early 2023-09-16 18:44:58 +02:00
Jacques Lucke
07977bb413 Geometry Nodes: generalize zone body function generation
This makes the code for creating a lazy-function for the body
of a zone more reusable. Currently, it is only used by the repeat
zone, but in the future the same could be used for simulations
and for-each zones.
2023-09-16 18:40:16 +02:00
Habib Gahbiche
e621b7a621 Compositor: Kuwahara filter: consider alpha channel.
This makes the results more consistent with GPU implementation.

Pull Request: https://projects.blender.org/blender/blender/pulls/112199
2023-09-16 15:50:26 +02:00
Jacques Lucke
bd414cdbda Functions: reduce memory usage in node state
By storing a raw pointer instead of a `Span`, we save 16 bytes
per node state. I measured a ~5% speedup in my setup with
a simple repeat zone.

5c450aea05 added some additional asserts to check for valid
indices. Generally, index-errors in this area lead to wrong
behaviors of geometry nodes very quickly.
2023-09-16 12:30:23 +02:00
Jacques Lucke
5c450aea05 Functions: add asserts to check indices 2023-09-16 12:24:54 +02:00
Jacques Lucke
60c65ab13b Functions: better pack socket state structs
This reduces the amount of used memory.
2023-09-16 12:11:08 +02:00
Clément Foucault
c00962d038 EEVEE-Next: Raytrace: Add back Screen Space radiance input
This finalize the implementation of the screen space tracing
for EEVEE-Next.

Refractive objects can now have screen space reflection too
and self reflect.

This keeps the feedback radiance buffer principle of the
Classic EEVEE so that we still get infinite bounces by default.

There are some conflict with refraction tracing and ambient
occlusion nodes. Materials using screen space refraction will
not be able to detect occlusion from any refractive surface using
screen space refraction including itself.
They also won't be visible to screen space reflections from other
materials *not* using screen space refraction.
This should be added to the list of limitations for now.

Note that the current approach to feed the radiance is to copy
the radiance buffer. This has the nice property of only containing
the currently rendered objects and not project transparent objects
or other non-yet rendered object onto the depth behind them.

Pull Request: https://projects.blender.org/blender/blender/pulls/112341
2023-09-16 11:48:13 +02:00
Jacques Lucke
c74a309209 Functions: combine allocations in lazy function graph executor
There are many small allocations when the graph executor is
initialized (e.g. all the node/sockets have to be allocated). Those
were already combined into a few allocations by making use
of `LinearAllocator`. However, even better performance can be
achieved by making one larger allocation and then using
preprocessed offsets into that buffer.

I measured up to 20% speedup in geometry nodes with a simple
repeat zone.
2023-09-16 11:38:40 +02:00
Jacques Lucke
142541c279 Geometry Nodes: create local tree logger only when something is logged
Currently, we create a logger for every compute context that is evaluated,
even when we don't actually log anything in that context (due to other
optimizations). Now, the logger is not created eagerly anymore.

This can be especially benefitial when there are many compute contexts
that should not log anything, e.g. if there is a repeat zone with many iterations.
In an extrem case I measured a speedup for the modifier evaluation
from 24ms to 14ms.
2023-09-16 10:08:06 +02:00
Harley Acheson
636f3697ee UI: Window Title With Version
Include blender version information in title (including cycle), and
also indicate unsaved and dirty status better.

Pull Request: https://projects.blender.org/blender/blender/pulls/111998
2023-09-16 02:37:06 +02:00
Harley Acheson
b3baeeaa32 UI: Fix Error in Custom Tooltips
Fix typo in ui_tooltip_data_from_button_or_extra_icon introduced in
6453b00f44. Incorrect variable referenced - but_label.strinfo used
instead of but_tip_label.strinfo.

Pull Request: https://projects.blender.org/blender/blender/pulls/112428
2023-09-16 00:25:42 +02:00
Harley Acheson
58435f25d6 Cleanup: Make format
Formatting changes resulting from Make Formatting.
2023-09-15 12:12:23 -07:00
Harley Acheson
6453b00f44 UI: Custom Tooltips with Optional Images
This adds an optional uiBut callback that allows creating a tooltip
line-by-line with specified style and color in any order. It also
allows adding images as well to create very informative tooltips.

Pull Request: https://projects.blender.org/blender/blender/pulls/105905
2023-09-15 21:06:30 +02:00
Harley Acheson
ee81a49bb2 Cleanup: Make format
Formatting changes resulting from Make Format
2023-09-15 10:42:40 -07:00
Leon Schittek
42f8b49581 Fix: Show modal keymap for operators called inside macros
Display the modal keymap in the status bar for modal operators that
are called within macros. Most notably, the keymap for the transform
operator is displayed when it's called as part of the duplicate,
extrude, or loopcut operators or when moving nodes.

Pull Request: https://projects.blender.org/blender/blender/pulls/108027
2023-09-15 19:33:20 +02:00
Bastien Montagne
0ce02355c1 I18N module: updates for transition to weblate.
Remove `es_ES` language.
Rename `uz_UZ` to `uz_UZ@latin`
Rename `zh_CN` to `zh_HANS`
Rename `zh_TW` to `zh_HANT`

Add support for lowercase chars in `country` part of the locale code
(although in the end it is not needed, since `boost::locale` backend
does not supports lowercase 'country' part in locales identifiers
currently) .

Related to https://projects.blender.org/infrastructure/blender-projects-platform/issues/65
2023-09-15 18:08:52 +02:00
Philipp Oeser
72624f9678 Fix #112397: modifiers.execution_time doesn't work on curve objects
The `ScopedModifierTimer` would work for "real" curve modifiers, but was
skipping geometry node modifiers.
Now move it up so geometry node modifiers are included.

Pull Request: https://projects.blender.org/blender/blender/pulls/112420
2023-09-15 17:41:44 +02:00
Jacques Lucke
cd0587c784 Geometry Nodes: send lazy threading hint from ico sphere node
This allows for better multi threading because work can be moved to
other threads while waiting for the ico sphere to be generated.

Most other nodes don't need this, because they use `parallel_for`
internally, which sends the hint as well.
2023-09-15 17:38:13 +02:00
Richard Antalik
f5eff9353c Fix #111595: Missing metadata info when blending image
Copy metadata from original image to blended result.

Pull Request: https://projects.blender.org/blender/blender/pulls/111948
2023-09-15 16:57:46 +02:00
Julian Eisel
728d47f3e4 Asset shelf: Use asset representation for asset shelf BPY methods
Changes the `asset_poll()` and `draw_context_menu()` methods for asset
shelves to use the `AssetRepresentation` type, instead of `AssetHandle`.
The latter should be removed, so it's better to avoid using it in the
asset shelf BPY to avoid future compatibility breakage. This is possible
now with d421ebac5e.
2023-09-15 16:17:44 +02:00
Julian Eisel
d421ebac5e Assets: Expose ID type in asset representation RNA for Python access
Previously Python code would require the hacky `AssetHandle` type and
query the ID type through the file data it contained (like
`asset_handle.file_data.id_type`). We want to get rid of `AssetHandle`.

With this commit we can change asset shelf methods like
`AssetShelf.asset_poll()` to take an `AssetRepresentation` instead of
`AssetHandle`, since the ID type is currently the only relevant part.
This is much nicer and won't require breaking compatibility in future to
deprecate `AssetHandle`.
2023-09-15 16:10:00 +02:00
Miguel Pozo
264c81a0a0 Fix #112409: Workbench: Cavity disabled when Xray is enabled 2023-09-15 15:35:01 +02:00
Sybren A. Stüvel
9580c377fe Cleanup: Anim, add some more comments to the bone collection system
Add some TODOs and clarification in comments.

No functional changes.
2023-09-15 14:54:04 +02:00
Sybren A. Stüvel
de13d7861c Anim: when applying overrides, just assert the bone hash is there
Instead of calling `BKE_armature_bone_hash_make(armature)`, just do an
assertion that the bone hash is there.
2023-09-15 14:54:04 +02:00
Sybren A. Stüvel
44d1964b5f Anim: add reverse pointers from bone to collection on overrides
When inserting a bone collection via a library override, make sure that
the reverse pointers (from the bones in the collection to the collection
itself) are also added. These are used for the "given the active bone,
which collections is it in?" kind of queries.
2023-09-15 14:54:04 +02:00
Sybren A. Stüvel
cb2afa6553 Cleanup: Anim, remove out of date note on ANIM_armature_runtime_refresh
The docstring warned about memory not being freed, but that information
is out of date so I removed it.

No functional changes.
2023-09-15 14:54:04 +02:00
Sybren A. Stüvel
89962977e5 Anim: only show editable bone collections in M/shift+M menu
When showing a list of bone collections in the M/Shift+M menus, only show
those bone collections that can be assigned to. Bone collections from
linked armatures are hidden, because they're read-only anyway.

It would probably be better to still show these read-only collections,
but not sure how that can be done with the current code.
2023-09-15 14:54:04 +02:00
Sybren A. Stüvel
24048ef05d Anim: allow assigning bones to added-in-local-override collections
Assigning & unassigning to the active collection works. Using named
collections is still untested.
2023-09-15 14:54:04 +02:00
Sybren A. Stüvel
8499c6d4b3 Refactor: Anim, consistent abstraction level ANIM_armature_bonecoll_assign
Refactor `ANIM_armature_bonecoll_assign()` to ensure it has a consistent
abstraction level.

No functional changes.
2023-09-15 14:54:03 +02:00
Sybren A. Stüvel
347ffd6262 Anim: add support for renaming bone collections added by overrides
Add a flag `BONE_COLLECTION_OVERRIDE_LIBRARY_LOCAL` that's only set on
bone collections that have been overridden locally.
2023-09-15 14:54:03 +02:00
Sybren A. Stüvel
89aee9defb Anim: store Armature's active bone collection by name
Instead of storing the active bone collection as `BoneCollection*`, store
its name in DNA. This makes it impossible to point to non-owned bone
collections, makes it easier to handle copy-on-write copies, and should
make it possible to use library overrides on it.

This now also introduces a new requirement that bone collections always
have a name. If the name is set to the empty string, the default name
("Bones") will be used instead.

The `active_collection` pointer is still there for ease of access, but
it's been moved to the armature's `runtime` property.

The library overrides part isn't working yet, though.
2023-09-15 14:54:03 +02:00
Sybren A. Stüvel
f1c65c9635 Anim: allow appending bone collections with liboverrides 2023-09-15 14:54:03 +02:00
Sybren A. Stüvel
63f2a416b2 Anim: allow (de)selecting bones in collection on overridden armature
When the Armature & its Object are library-overridden, allow (de)selecting
the bones in a bone collection.
2023-09-15 14:54:03 +02:00
Sybren A. Stüvel
68bb3fa388 Anim: disallow bone collection operations on linked armatures
Do not allow bone collection operations on linked armatures, regardless of
whether it is overridden or not. This is the first step in making the
library overrides system work with bone collections.

This changes the pre-existing check on the object to actually check the
armature, which is the owner of bone collections. The object is irrelevant
here.
2023-09-15 14:54:03 +02:00
Pratik Borhade
59e8be7aa4 Fix #101550: Transfer Mode operator doesn't update outliner selection
Notifiers was sent to outliner for redraw but outliner was out of sync
due to missing flag which is required for syncing.
This will correctly set the select/active outliner element flags with
the help of Base in `outliner_select_sync_from_object`. So correct active
tree element will be highlighted in `outliner_draw_highlights`

Pull Request: https://projects.blender.org/blender/blender/pulls/112370
2023-09-15 13:21:08 +02:00
Julian Eisel
4fff53d9ef Cleanup: Improve internal asset shelf function name
Be a bit more clear about what this is doing. It's now more obvious what
part of the UI this belongs to.
2023-09-15 12:59:21 +02:00
Lukas Tönne
5d77d8d832 Fix #112233: Panel collapsed state should not hide socket links
#112019 included open/closed state of the parent panel in socket
visibility calculation. This prevents dragging links, but also disables
other features that should still work, such as drawing links.

A narrower condition is needed for icon visibility vs. general socket
visibility. The cases which use the new `is_icon_visible` condition:
- Drawing socket selection outlines (same as unselected sockets)
- Drawing multi-input sockets (same as unselected sockets)
- `node_find_indicated_socket`, used by a wide range of mouse click
  operators, including the link-drag operator that was cause for
  #112019.

Cases using the original `is_visible` (true even if parent panel is
collapsed):
- `nodeLinkIsHidden` draws links only when at least one socket is
  visible.
- `node_update_basis`, sockets still added to layout even if icon isn't
  rendered.
- `node_update_hidden`, panels are ignored for "hidden" nodes, all
  sockets are rendered.
- `NODE_OT_link_make` operator for finding "best" sockets to connect.
- `node_link_viewer` finding sockets to connect to a viewer node.
- `get_main_socket` used for insert-on-links (find sockets to splice
  into) and some shader previews
- `node_gather_link_searches`, suggestions for adding a new node at the
  end of a link.

Pull Request: https://projects.blender.org/blender/blender/pulls/112326
2023-09-15 12:57:56 +02:00
Julian Eisel
18281ee211 Asset Shelf: Make header buttons consistent with Asset browser
In the Asset Browser, the display popup is first, and the search second.
Also, the search button is enlarged horizontally. Apply both to the
asset shelf header.
2023-09-15 12:51:03 +02:00
Pratik Borhade
0b8c83d273 GPv3: Send updates after drop operation
Redraw dopesheet and outliner editors when layer is dropped to some other
position or inside a group.

Pull Request: https://projects.blender.org/blender/blender/pulls/111519
2023-09-15 11:31:25 +02:00
Christoph Lendenfeld
bd305c8d18 Fix #110108: NLA absolute snapping
Before this patch the following snapping options were broken

* snap to markers
* snap to seconds with "Absolute Time Snap" turned on
* technically also snap to Frames with "Absolute Time Snap"
turned on (but made no real difference)

The issue was that each end of the strip would snap individually.
Potentially collapsing the strip.
This would happen e.g. when snapping to markers but with only 1 marker present.

This PR fixes the issue by finding out the closest snap offset and
shifting the strip as a whole by that amount.
That means either the start or the end of the strip will snap to the target.
By doing it that way the length of the strip is never changed by snapping.

This means when snapping to Seconds with "Absolute Time Snap" turned on,
the start of the strip might not be on a full second when the end is.

Pull Request: https://projects.blender.org/blender/blender/pulls/111984
2023-09-15 09:52:40 +02:00
Campbell Barton
af81ee37b9 Fix divide by zero displaying characters with an unknown column width
The result of BLI_wcwidth wasn't checked before using the result to
calculate a width, this cause a negative return value to be multiplied
by the font size which divided by zero.
2023-09-15 16:05:29 +10:00
Campbell Barton
bc51449ff1 Fix cursor motion across characters with an unknown column width
BLI_str_utf8_char_width returns -1 for character without a known width.
This caused the right cursor motion to skip these characters.

While editable text should not contain control characters,
cursor motion should behave properly in cases when they do.
2023-09-15 16:04:28 +10:00
Campbell Barton
635a4eac05 Fix delete key setting a control character in wmEvent::utf8_buf
The check for control characters didn't account for delete (127).
This wasn't noticeable in most cases as delete is mapped to delete text.
Pressing Shift-Delete would enter 127 control character in the
text-editor, 3D text & Python console. This happened X11 & Wayland,
I didn't check other platforms.
2023-09-15 16:01:00 +10:00
Campbell Barton
67c9056bed Fix memory leak in PyC_Err_Format_Prefix for Python 3.12
In Python 3.12 Every PyErr_Fetch must have a matching PyErr_Restore
call, otherwise references are created and never de-referenced.
2023-09-15 14:26:49 +10:00
Campbell Barton
425cc82aff Cleanup: remove unnecessary PyC_Err_Format_Prefix use
In this case there is no error to prefix, use PyErr_Format instead.
2023-09-15 14:23:16 +10:00
Campbell Barton
9903a692cc Cleanup: clarify & simplify Python traceback extraction
- Remove duplicate PyErr_NormalizeException call.
- Avoid unnecessary traceback casts.
- Remove warning about #97731 which has been resolved.
- Clarify comments.
2023-09-15 13:17:12 +10:00
Hans Goudey
99f9a53321 Attributes: Expose "is required" read-only property to Python
This allows detecting if deleting the attribute will be possible
without actually trying to delete it, which can give warning
messages in the terminal.

As an example:
```
>>> [(item.name, item.is_required) for item in mesh.attributes]
[('Attribute', False),
 ('position', True),
 ('.edge_verts', True),
 ('sharp_face', False),
 ('.corner_vert', True),
 ('.corner_edge', True)]
```

Pull Request: https://projects.blender.org/blender/blender/pulls/111468
2023-09-15 04:56:27 +02:00