Commit Graph

101589 Commits

Author SHA1 Message Date
Hans Goudey
f10965dcb8 Sculpt: Improve PBVH draw performance for meshes
Reduce overhead of copying attribute data into GPU buffers when the
PBVH is active. The existing lambda with a FunctionRef callback had
a significant overhead. While that was reduced by 25917f0165
already, even making the `foreach_faces` lambda into a template gave
significant overhead compared to simpler loops. Instead, separate
value conversion and iteration over visible triangles in a way that the
compiler is able to optimize more easily.

According to the GPU module, it's also better to use raw data access
than `GPU_vertbuf_raw_step`, since the data format strides aren't
meant to vary by platform, and the runtime stride can have a
noticeable performance impact.

Also avoid recalculating face normals, since they're already used to
calculate vertex normals anyway (since ac02f94caf).

I tested the runtime of the initial data-upload after entering sculpt
mode with a 16 million vertex mesh. Before, that took 1350 ms, after
it took 680 ms, which is almost a 2x improvement. In my tests, the
performance improvement was only observable for the initial data
upload, theoretically it is a more general change though.

It's possible that a similar optimization could be applied to multires
or dynamic topology sculpting, but that can be looked at later too.

Pull Request: https://projects.blender.org/blender/blender/pulls/110621
2023-07-31 14:40:41 +02:00
Clément Foucault
92be22ff4b Fix: EEVEE-Next: Broken world diffuse irradiance 2023-07-31 14:28:55 +02:00
Caleb-Cleavinger
20091a2b9e Fix #110096: Crash Crash on calling curve pen operator
Changed poll function to `ED_operator_editcurve` to prevent
crashing when accessed from the developer menu in modes other
than edit mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/110619
2023-07-31 14:06:18 +02:00
Amelie Fondevilla
6f8ff2846f GPv3: Add API function to get active frame
Adds the Layer method `frame_at` which finds the frame that is active at a given frame number.

Pull Request: https://projects.blender.org/blender/blender/pulls/110583
2023-07-31 12:23:31 +02:00
Campbell Barton
79e7449a52 Cleanup: remove unused declarations 2023-07-31 20:01:40 +10:00
Campbell Barton
6d2326dabf Cleanup: use function style casts 2023-07-31 19:57:32 +10:00
Sergey Sharybin
c2dfa1a066 Fix crash in GPU compositor when viewer size changes
This change fixes crash which happens when a viewer node is used for
backdrop, and the scene render size is modified. After the modification
the render size and the texture size gets out of sync since the texture
was never adapting for the size change.

Pull Request: https://projects.blender.org/blender/blender/pulls/110590
2023-07-31 11:17:14 +02:00
Chris Blackbourn
fc2ee7d912 Cleanup: improve uv packing inline comments 2023-07-31 16:49:38 +08:00
Chao Li
b40e8242ca GPv3 : Select circle/lasso grease pencil frames
Adapt the `ACTION_OT_select_circle` and `ACTION_OT_select_lasso` operators to take into account grease pencil layer channels. These operators both call `region_select_action_keys` which subsequently calls `region_select_elem` function. In the last function, grease pencil layer needs to be taken into consideration. This resolves #110521

Pull Request: https://projects.blender.org/blender/blender/pulls/110558
2023-07-31 10:35:36 +02:00
Campbell Barton
52acf6a6ec Cleanup: correct file names in comments after C -> C++ renaming
Use back-tick quotes to differentiate these from plain text.
2023-07-31 13:02:30 +10:00
Chris Blackbourn
a35ad5899f Fix #110626: restore abf uv unwrap logic
Regression from 8ace65e3c6.
2023-07-31 10:40:38 +08:00
Campbell Barton
74a222f0e0 Cleanup: rename BMEditMesh 'editData' to 'em'
Avoid confusion with EditMeshData, often accessed via
`mesh->runtime->edit_data`.
2023-07-31 10:20:26 +10:00
Campbell Barton
724755879e Cleanup: spelling in comments, use doxygen doc-strings 2023-07-31 10:18:09 +10:00
Campbell Barton
d5fc5c5a04 Cleanup: quite MSVC warning in datatoc_icon.cc 2023-07-31 10:00:23 +10:00
Campbell Barton
f324cbf2a6 Cleanup: use doxygen docs for datatoc_icon 2023-07-31 10:00:23 +10:00
Bastien Montagne
a14c747fe8 Fix (unreported) minor bug in RNA/Liboverride apply code.
The wrong RNA pointers were passed (passing the root ones instead of the
ones actually owning the rna-path-resolved property).

This was likely a harmless mistake, since it only affected RNA
collections of IDs, afaik we currently don't have many (if any) of these
in non-ID RNA structures. The children collections and objects in a
Collection data-block RNA structure e.g. were not affected.

But the potential consequence of that bug would have been missing
automatic detection of some needed liboverride resyncs.
2023-07-30 17:51:01 +02:00
Campbell Barton
fd0977284b Cleanup: simplify typedefs
Also remove unused `buffer_struct`.
2023-07-30 16:14:09 +10:00
Hans Goudey
79cb56e1f1 Cleanup: Remove check for null object when building PBVH
In the two callers of `BKE_sculpt_object_pbvh_ensure`,
the object is already expected to be non-null.
2023-07-29 23:47:13 -04:00
Hans Goudey
c4ac4ecc4c Mesh: Extract loose edges and vertices in two threads
The process of calculating the caches for loose edges and loose vertices
and extracting their indices are independent and both single threaded.
If the CPU isn't doing anything else, using two threads can half the
total time for both. For example, this saves 40-50ms opening a file
with a 16 million face mesh.
2023-07-29 23:47:13 -04:00
Hans Goudey
38fc111fc9 Cleanup: Clarify string usage in PBVH draw
Use StringRef where possible to avoid copying strings, avoid
redundant string returns, and use std::string for attribute
request names now that all the relevant code is C++.
2023-07-29 23:47:13 -04:00
Hans Goudey
e749599f95 Cleanup: Remove using keyword for std::string in pbvh draw
Typically it's considered questionable to add `using` for `std` types
and functions. With just a few more characters, the type is always
familiar.
2023-07-29 23:47:13 -04:00
Jacques Lucke
830fb684c3 Fix: failing mesh boolean test in debug build due to unnormalized normal
This was accidentally changed in f557222a7b.
2023-07-29 12:03:07 +02:00
Campbell Barton
916f6a7bf3 UI: add weight paint gradient menu items for discoverability 2023-07-29 16:33:14 +10:00
Campbell Barton
cfffd813c1 Cleanup: use typed enum for UI_ITEM_* flags
Using an int lead to confusion with other flags often used with buttons.
For e.g. these flags could be easily confused with uiItem::flag.
2023-07-29 15:32:45 +10:00
Campbell Barton
acbf16d91a Cleanup: correct invalid flag types
- wmOperatorCallContext was used to store UI_ITEM_* flags.
- Collada export use passed invalid UI_ITEM_* flag as an argument.
2023-07-29 14:52:47 +10:00
Campbell Barton
98f848dc4b Cleanup: use typed flag for uiItem::flag 2023-07-29 14:48:13 +10:00
Campbell Barton
ed01e16aa6 Cleanup: quiet uninitialized warnings 2023-07-29 13:47:57 +10:00
Campbell Barton
2bc89982dc Cleanup: remove unused variable 2023-07-29 13:47:53 +10:00
Germano Cavalcante
22206a1592 Fix #110571: Property option 'TEXTEDIT_UPDATE' no longer updates
The `ENUM_OPERATORS` utility was used in `PropertyFlag` in d154ebfa83.

In that commit, it was set with a maximum value lower than
`PROP_TEXTEDIT_UPDATE`.

Consequently, when `bpy_props.c` was converted to C++ in 6fcecb7e46,
the cast to `PropertyFlag` caused the value of `PROP_TEXTEDIT_UPDATE`
to be cleared.

The solution is to set the maximum value to `PROP_TEXTEDIT_UPDATE`
instead of `PROP_NO_DEG_UPDATE`.
2023-07-28 17:51:54 -03:00
Jacques Lucke
860196d5a1 Geometry Nodes: extract bake items from simulation baking
The goal is to reuse the same bake items for simulation and normal baking (#110137).
Previously, the bake data was tied to a simulation state which made it harder to reuse.

Now the code for the following things can be reused easily:
- Convert geometry node socket values into bake items and back.
- Serialize and deserialize bake items.

Pull Request: https://projects.blender.org/blender/blender/pulls/110577
2023-07-28 18:30:32 +02:00
Bastien Montagne
ef26e5d313 Cleanup: Rename 'override' variables and parameters to 'liboverride'.
`override` is a reserved keyword in C++.

Pull Request: https://projects.blender.org/blender/blender/pulls/110534
2023-07-28 16:37:06 +02:00
Bastien Montagne
ded695bc73 LibOverride/RNA Diffing refactor.
Use a context structure for both parameters and results of the rna
diffing functions, instead of 10+ individual parameters.

Also switch to C++ features like `std::string` and `std::optional`
instead of handling manually buffers and allocated C-style strings.

This commit also makes some minor cleanups, add some documentation, and
removes a few small parts of code that have been detected as
redundant/useless.

No behavioral nor performance changes are expected with this commit.
2023-07-28 16:36:31 +02:00
Falk David
187545109a Cleanup: GPv3 drawings API
This cleans up the API a bit to make things more readable.
No functional changes.
2023-07-28 16:32:42 +02:00
Amelie Fondevilla
f7130d98c4 GPv3: Select frames by column
Implementation of column-based operators : "Columns on selected keys", "Column on current frame", and "Columns on selected markers" for grease pencil frames in the dopesheet.

Pull Request: https://projects.blender.org/blender/blender/pulls/110523
2023-07-28 16:18:40 +02:00
Julian Eisel
088d7a0bdd UI: Activate view item on right click on nested button too
No user visible change expected.

Right-clicking a view item is supposed to activate it and display the
context menu. However, nested buttons could "swallow" the right click
event. Ensure the view item is still activated.
2023-07-28 15:31:52 +02:00
Julian Eisel
1fe45cef91 Fix broking popover refreshing
Mistake in 167c5c6b53, basically making the commit have no effect.
2023-07-28 15:25:48 +02:00
Christoph Lendenfeld
9cd60da3cb Refactor: extract code from dopesheet draw function
No functional changes

Extracting code into two new functions in the dopesheet draw code
to improve readability and reduce variable scopes.
in addition to the extraction two if checks were negated to reduce indentation.

the diff makes it look a bit convoluted, but it's just copy paste into functions

Pull Request: https://projects.blender.org/blender/blender/pulls/110290
2023-07-28 15:14:56 +02:00
Julian Eisel
3053cba6e9 Fix glitch when unhiding fixed size regions with region resizing
Some regions have a fixed size or the size is determined by the layout
somehow, and so the regions should allow hiding/unhiding via the resize
operator, but the size shouldn't be modified. When the region was just
unhidden, it would still use a size based on the mouse position for one
mouse move event. Ensure the size isn't modified, as requested.
2023-07-28 14:36:02 +02:00
Julian Eisel
4319c211dc UI: Support layout based region resizing that still allows user resizing
No user visible changes expected.

This is needed for the asset shelf (#104831), so that the user can
resize the asset shelf region, but it's ensured to always be snapped to
a multiple of the row height (which can change over redraws).

Before this, `RGN_FLAG_DYNAMIC_SIZE` would have to be set so that
regions can control their own size in the `ARegionType::layout()`
callback. But this would also disable resizing the region by the user.
Tagging regions as being dynamically sized and disabling user resizing
are now two separate options/flags.

Included changes:
- Rename `RGN_FLAG_PREFSIZE_OR_HIDDEN` to `RGN_FLAG_NO_USER_RESIZE` and
  make that generally disable user resizing like `RGN_FLAG_DYNAMIC_SIZE`
  used to, so that it can be used for more than just the properties
  editor tabs region.
- Ensure regions that relied on the previous `RGN_FLAG_DYNAMIC_SIZE`
  behavior that disallowed user resizing have the
  `RGN_FLAG_NO_USER_RESIZE` flag set too now.
- Versioning to ensure the previous point for old files.
- Update comments.
2023-07-28 14:36:02 +02:00
Falk David
20b1077097 GPv3: Initial modifier support
This commit adds modifier support for Grease Pencil 3.
The `BKE_grease_pencil_data_update` function evaluates the modifiers by
first creating a `GeometrySet` from the grease pencil data,
then evaluating the modifiers, and finally reading the
resulting `GreasePencilComponent` component and assigning
the evaluated object data.

Pull Request: https://projects.blender.org/blender/blender/pulls/110500
2023-07-28 14:25:38 +02:00
Jacques Lucke
38294bcbe7 Fix #110543: black faces on mesh extrude
That was a mistake in 932332ad6e.
2023-07-28 13:50:02 +02:00
Hans Goudey
a632f1ddfd Sculpt: Remove dynamic topology "Smooth Shading" option
Dynamic topology drawing can now use the smooth status saved in each
edge. Because of that, the "Smooth Shading" draw option is unnecessary
and just adds confusion because of inconsistency between dynamic
topology drawing and other modes.

Fixes #109191

Pull Request: https://projects.blender.org/blender/blender/pulls/110548
2023-07-28 13:44:01 +02:00
Andras-Borsanyi
f418e4f648 Walk Navigation: Controls to adjust jump height interactively
In Walk Navigation mode with gravity enabled, the jump height is
often inappropriate for the scene that you are viewing. This is a small
feature that lets you change the jump height in modal walk navigation
as you go, i.e. if there are varying elevation changes across the scene.

Pressing '.' increases and ',' decreases the jump height (because these keys
are the same for most layouts).

Pull Request: https://projects.blender.org/blender/blender/pulls/109827
2023-07-28 13:43:35 +02:00
Sergey Sharybin
f839c31f6c Fix Blender crash on startup on macOS
The issue was caused by recent C++ transition: the header file is
shared between CPU and GPU. The Metal defines __cplusplus so it is
not enough to check for it to use C linking as it is not a valid
syntax for shaders.

Pull Request: https://projects.blender.org/blender/blender/pulls/110570
2023-07-28 12:42:15 +02:00
Julian Eisel
44c54eda6f Cleanup: Apply clang-format for recent Outliner changes 2023-07-28 12:36:32 +02:00
Julian Eisel
d1e590eafa Refactor: Avoid evil context storage in drag data for asset import
Context is needed to import and instantiate assets correctly. Previously
the context was stored as "evil" pointer in the drag data. Since
77794b1a7b, context is passed to the dragging callbacks doing the asset
import, so the context doesn't need to be stored that way anymore and
can simply be passed to the import function.
2023-07-28 12:20:27 +02:00
Almaz-Shinbay
1f722a6d01 Outliner: Port grease pencil effect elements to new tree-element code design
No user visible changes expected.

Part of #96713, continuation of work started in 249e4df110 and 2e221de4ce.
Refer to these for a motivation and design overview.

Adds new classes for grease pencil effect elements.

Pull Request: https://projects.blender.org/blender/blender/pulls/110551
2023-07-28 11:26:09 +02:00
Guillermo
82c178a574 Fix #110556, #110546: wrong variable initialization
Fixes attempt to access an overridden variable value.

Pull Request: https://projects.blender.org/blender/blender/pulls/110557
2023-07-28 09:15:31 +02:00
Campbell Barton
88902a273e UI: add menu items for sample weight/color
These were only available as shortcuts without any menu item.
2023-07-28 16:27:24 +10:00
Campbell Barton
09c66631a6 Refactor: use object.vertex_group_set_active for group sample operator
This change is needed for PAINT_OT_weight_sample_group to be accessed
from a menu.

Otherwise using the OPTYPE_DEPENDS_ON_CURSOR flag causes both the
initial activation and the selected vertex group to prompt the user
to select a region.
2023-07-28 16:09:29 +10:00