Commit Graph

103705 Commits

Author SHA1 Message Date
Alaska
88ad79c2d1 Add panels to Principled BSDF node
Add panels to the Principled BSDF node to organize
and reduce the size of the node.

Layout inspired by previous work from @LukasStockner

Pull Request: https://projects.blender.org/blender/blender/pulls/112314
2023-09-17 15:42:15 +02:00
Jacques Lucke
7bde842e98 Cleanup: improve and unify naming 2023-09-17 15:13:30 +02:00
Jacques Lucke
4db6a22c72 Functions: use array indexing instead of VectorSet in graph executor
This avoids the need to build the VectorSet and array
indexing is generally faster than a hash table lookup.
2023-09-17 14:27:01 +02:00
Jacques Lucke
2a5f3bd1cc Functions: refactor lazy-function graph interface
Goals of the refactor:
* Simplify adding (named) graph inputs and outputs.
* Add ability to refer to a graph input or output with an index.
* Get rid of the "dummy" terminology which doesn't really help.

Previously, one would add "dummy nodes" which can then serve as input
and output nodes of the graph. Now one directly adds input and outputs
using `Graph.add_input` and `Graph.add_output`. There is one interface
node that contains all inputs and another one that contains all outputs.

Being able to refer to a graph input or output with an index makes it
more efficient to implement some algorithms. E.g. one could have a
bit span for a socket that contains all the information what graph
inputs this socket depends on.

Pull Request: https://projects.blender.org/blender/blender/pulls/112474
2023-09-17 13:54:09 +02:00
Campbell Barton
342ebeac09 Fix text editor word-wrap displaying characters with an unknown width
Characters with an unknown width (control characters for  e.g.)
caused word wrap not to work properly, the text cursor was out of sync
with the displayed text.

Use BLI_str_utf8_char_width_safe which is the convention for the
text editor.
2023-09-17 21:20:28 +10:00
Campbell Barton
0add567339 Text Editor: improvements to auto-close implementation
- Restore the selection if auto-closing a selection fails.
- Simplify auto-close selection by ordering the selection.
- Call text_update_line_edited on the selection when auto-closing
  a selection to ensure formatting is recalculated for the region.
- Internal changes needed to support multi-byte auto-closing
  although this is still limited to ASCII at the moment.
2023-09-17 17:17:34 +10:00
Campbell Barton
b9124d8a85 Fix text editor auto-close potentially auto-closing non-brackets
Entering non ascii characters would truncate the code-point to char
when passing it to text_closing_character_pair_get(), which could then
match bracket values. Resolve by checking the characters are ascii.
2023-09-17 17:17:33 +10:00
Campbell Barton
0464b9fc58 Fix selecting between tab (or other control characters) in the UI
It wasn't possible to select the position between two tab characters
with the mouse cursor in the UI. Don't handle characters with an unknown
width as combining.

Follow up to [0] which changed this for cursor motion.

[0]: bc51449ff1
2023-09-17 15:48:20 +10:00
Campbell Barton
5ae99270c1 Fix incorrect cast for BLF_str_offset_from_cursor_position
Casting size_t* to be used as an int* would fail on 64bit,
big-endian systems.
2023-09-17 15:39:39 +10:00
Campbell Barton
69bf9db9a4 Tests: update test for change to BLI_str_cursor_step_next_utf8
Change to handling of control characters in [0] caused tests to fail,
now the cursor no longer skips over control characters,
update test to account for this.

[0]: bc51449ff1
2023-09-17 14:55:19 +10:00
Campbell Barton
1cda66b911 WM: resolve transform triggering key-maps to be rebuilt
Since [0] modal transform in the 3D viewport caused key-maps to be
rebuilt by the event system. Creating a temporary copy for
ViewOpsData_Utility flagged the key-map as outdated.

This could crash (resolved by [1] - for the most-part), but would still
rebuild the whole key-map, adding unnecessary overhead.

This would also reset the KMI_EXPANDED flag, causing transform
to hide key-map items when using Blender with the key-map editor open.

Add a function to temporarily suppress key-map updates.
While not ideal, full support for temporary key-maps that behave
differently to user key-maps is a bigger project for something
that's only needed in one place.

[0]: 017d4912b2
[1]: 9a0eaa2062
2023-09-17 13:36:25 +10:00
Campbell Barton
edc47d3d5a Cleanup: split ID property access into get/ensure functions
- Add IDP_EnsureProperties,
- Remove create_if_needed argument from IDP_GetProperties.

Split access & creation so intention reads more clearly without
looking up function arguments.
2023-09-17 12:16:40 +10:00
Campbell Barton
ad04167a7d Cleanup: avoid path copying & allocation setting the window title 2023-09-17 12:03:08 +10:00
Campbell Barton
e39940e255 Fix error from 106d2bb312
Swapped width/height for the image size.
2023-09-17 11:32:41 +10:00
Campbell Barton
e3444fd314 Cleanup: various non-functional C++ changes 2023-09-17 09:05:40 +10:00
Campbell Barton
106d2bb312 Cleanup: document ownership for uiTooltipField, add function attributes
- Document ownership.
- Make some arguments const.
- Use function style casts.
- Make width/height into a size[2].
2023-09-17 09:05:40 +10:00
Campbell Barton
c75a304b51 Cleanup: use lowercase ui prefix for enum, rename Color -> ColorID
Follow current conventions for types e.g. uiFontStyle, uiBlock etc.
Also rename UiTooltipColor to uiTooltipColorID since this isn't
storing the color.
2023-09-17 09:05:40 +10:00
Campbell Barton
7eae806dda Cleanup: format, spelling 2023-09-17 09:05:40 +10:00
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