Commit Graph

99173 Commits

Author SHA1 Message Date
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
Campbell Barton 9d92f03536 Fix #112399: Memory leak with exceptions from scripts in the text editor
Regression in [0] caused the function to jump to the error in the text
editor not to restore the exception, using the trace-back being iterated
over instead of the original value.

[0]: 2d2baeaf04
2023-09-15 12:23:42 +10:00
Campbell Barton bcda667d37 Fix crash executing a script when sys.modules doesn't contain __main__
While in practice sys.modules has __main__ module, the purpose of
PyC_MainModule_Backup/Restore is to temporarily override __main__.

Running code outside of the text editor (callbacks for timers for e.g.)
could remove the __main__ module which would then crash when running
a script from the text editor.
2023-09-15 12:23:41 +10:00
Pablo Vazquez 2ec2e52a90 UI: Theme: Allow transparency when editing text in widgets
Allow transparency in both text and background color, to allow blending
the selected color with whatever is underneath. Making theming more
flexible, especially since the same property is used in different backgrounds.

Note: this doesn't affect the default themes since all of them have the alpha
component in inner at `1.0`.

Pull Request: https://projects.blender.org/blender/blender/pulls/112090
2023-09-14 19:28:30 +02:00
Brecht Van Lommel 42ed81b9ab Fix #112299: crash calling context.copy() in operator with popup
The context contained an invalid region pointer after closing the popup.
In the bug report this caused problems making a copy of context.property
which accesses the region, but doing other access to context.region was
a problem as well.
2023-09-14 18:59:10 +02:00
Brecht Van Lommel 89b3249c14 UV: when finding the best packing method, use area as tie breaker
When multiple packing methods results in effectively the same bounds,
prefer the packer that uses the smallest area. When all islands can
easily fit this is usually the box packer instead of alpaca. The zigzag
method of the latter has a tendendcy to take up more area and rotate
islands.

Fix #110724: smart UV project unnecessarily rotates islands

Pull Request: https://projects.blender.org/blender/blender/pulls/112295
2023-09-14 18:57:26 +02:00
Brecht Van Lommel d4cc0d02cb UV: disable best fit rotation of all islands at end of UV packing
This has a tendency to place islands diagonally in the image which is
not usually wanted, even if it's maximimizing the number of pixels for
the island.

Fix #109906: UV unwrap packs island diagonally instead of straight

Pull Request: https://projects.blender.org/blender/blender/pulls/112295
2023-09-14 18:57:26 +02:00
Weizhen Huang f014e44e8b Refactor: EEVEE: add utility function for 3D texture read
with manual trilinear interpolation. Currently only used for GGX BSDF LUT

Pull Request: https://projects.blender.org/blender/blender/pulls/112386
2023-09-14 18:46:07 +02:00
Hans Goudey 05045c3e50 Fix: Duplicate node tool catalog in point cloud edit mode
This isn't available in releases yet, but point cloud edit mode is
partially working with node group operators anyway.
2023-09-14 11:45:07 -04:00
Hans Goudey cc83951951 Geometry Nodes: Update node tool menus dynamically
See #101778

Remove the requirement of restarting Blender to refresh the
extended 3D view menus for node group changes. Also avoid
rebuilding the tree of relevant assets and catalogs on every
redraw, since parsing asset libraries, etc. could become more
expensive than we want. Those two goals combined mean we
have to be more rigorous in how we invalidate the cached
catalog tree.

The first main change required is to clear the tree as asset libraries
are being read, similar to other dynamic asset menus. This is done
with a 3D view header listener rather than a menu listener in this case.

However, that isn't enough, because there is an issue with the asset
system where the "all" library isn't updated when the current file library
changes. The solution is to explicitly rebuild the "all" library's catalogs
when other asset libraries are changed.

The other necessity for dynamic updates is clearing the catalog tree
to be rebuilt when the node group "asset traits" are changed. This is
done with a new notifier type (with the goal of being a bit selective
about when we re-read assets). This _also_ requires running the
"presave" callback that builds asset metadata when updating the
property. Otherwise saving the file and sending the notifier is
necessary, which is too confusing.

Pull Request: https://projects.blender.org/blender/blender/pulls/112166
2023-09-14 17:43:33 +02:00
Hans Goudey d2d4de8c71 Geometry Nodes: Show uncategorized assets in separate menus
In the add modifier menu, 3D viewport menus for node tools, and the node
editor add menu, assets not in catalogs are added to an "No Catalog"
menu rather than not being accessible at all.

This makes the default behavior when adding a node tool "not broken"
so at least something happens by default. The question of "How do I
add a catalog?" is much better than "Why didn't anything happen?"

Implements #111529
See #101778

---

![image](/attachments/b943e2c4-f660-4812-b9ab-f7c116b68b98)
![image](/attachments/e6ee94d7-cd14-475f-8fa6-abcc6774fd7e)
![image](/attachments/b1718d0c-4182-49c5-867a-1399082e98f0)

Pull Request: https://projects.blender.org/blender/blender/pulls/112355
2023-09-14 17:35:24 +02:00
Lukas Tönne 4aa3735d0f Node drawing: Fix unused variables in release builds
Pull Request: https://projects.blender.org/blender/blender/pulls/112384
2023-09-14 16:33:08 +02:00