Commit Graph

103705 Commits

Author SHA1 Message Date
Jacques Lucke
8c43cc3f83 Cleanup: use menu type flag
Another flag is added in #110855.
2023-09-06 10:04:01 +02:00
Campbell Barton
48394561d7 Fix keyconfigs.remove(..) leaving dangling pointers
Removing key-configs that also had direct pointer access
left them pointing to freed memory.
2023-09-06 14:23:04 +10:00
Campbell Barton
1f01a64403 Cleanup: spelling in comments 2023-09-06 14:23:01 +10:00
Richard Antalik
b1526dd2c6 Fix #107726: Viewport animation render ignores start frame
This issue specifically happend if sound playback is synchronized by
Audaspace. In this case render engine can't override current frame.
`BKE_sound_sync_scene()` should return NaN as when rendering is in
progress, however viewport render operator doesn't set `G.is_rendering`.

Pull Request: https://projects.blender.org/blender/blender/pulls/111946
2023-09-06 04:40:39 +02:00
Campbell Barton
1f285a5ec8 Cleanup: early return to reduce right shift 2023-09-06 12:05:19 +10:00
Jacques Lucke
b5c89822ac RNA: return PointerRNA from rna create functions
There are a couple of functions that create rna pointers. For example
`RNA_main_pointer_create` and `RNA_pointer_create`. Currently, those
take an output parameter `r_ptr` as last argument. This patch changes
it so that the functions actually return a` PointerRNA` instead of using
the output parameters.

This has a few benefits:
* Output parameters should only be used when there is an actual benefit.
  Otherwise, one should default to returning the value.
* It's simpler to use the API in the large majority of cases (note that this
  patch reduces the number of lines of code).
* It allows the `PointerRNA` to be const on the call-site, if that is desired.

No performance regression has been measured in production files.
If one of these functions happened to be called in a hot loop where
there is a regression, the solution should be to use an inline function
there which allows the compiler to optimize it even better.

Pull Request: https://projects.blender.org/blender/blender/pulls/111976
2023-09-06 00:48:50 +02:00
Harley Acheson
8a3766e241 Fix #111017: Improvements to the drawing of Color Ramps
Color Ramp widget with themed outline, handling of line width changes,
padding fixes, scaling fixes, etc.

Pull Request: https://projects.blender.org/blender/blender/pulls/111903
2023-09-06 00:00:40 +02:00
Habib Gahbiche
f0acbd151d Fix: Build error with Audaspace turned on
To reproduce build error, set `WITH_AUDASPACE` to `ON` in `blender_lite.cmake` and build using `make lite`.

The problem is that the function `AUD_Sound_equalize` is declared in `blender/extern/audaspace/bindings/C/AUD_Sound.h` within `WITH_CONVOLUTION` and not `WITH_AUDASPACE`.

Pull Request: https://projects.blender.org/blender/blender/pulls/111994
2023-09-05 21:19:02 +02:00
Miguel Pozo
fdda220a64 FIx: Workbench: Texture-less materials in texture mode
Fallback to material color if there's no texture.
2023-09-05 19:47:28 +02:00
Nathan Vegdahl
d5b9127e1b Fix: free BoneCollection ID props when the collection is freed 2023-09-05 17:32:01 +02:00
Colin Basnett
c73bdce8f8 Fix: Crash when trying to poll the status of non-existent icons
This fixes a specific crash that would happen to me sometimes when changing
between files (the files may have been saved in older versions of the Blender).
The fix is just to null-check the icon lookup.

Pull Request: https://projects.blender.org/blender/blender/pulls/111670
2023-09-05 16:05:12 +02:00
Miguel Pozo
22e4e94d57 Fix #111699: Remove deleted interface from the VAO cache
Newer interfaces can share the same address as the old one,
causing a deleted VAO to be bound.

Pull Request: https://projects.blender.org/blender/blender/pulls/111929
2023-09-05 15:34:12 +02:00
Sybren A. Stüvel
bcd0198a46 Anim: versioning, also bone create collections for empty bone groups
Change the versioning code so that all bone groups are converted to bone
collections, so also the ones that did not have any bones assigned.

As Demeter[1] put it: While bone groups with 0 bones assigned are
usually unintended, versioning should still preserve them I feel like,
just to be on the safe side. If there was an update to the vertex group
system, I would also expect empty vertex groups to survive, even though
they are strictly speaking pretty much pointless.

[1]: https://projects.blender.org/blender/blender/issues/111711#issuecomment-1013159
2023-09-05 15:12:36 +02:00
Sybren A. Stüvel
5250ae156e Refactor: move default bone collection name to constant
No functional changes.
2023-09-05 14:57:01 +02:00
Hans Goudey
6da4b87661 Geometry Nodes: Extend add modifier menu with node group assets
Implements part of #111538.

Change the modifier add button to create a menu with submenus.
Extend the submenus dynamically with geometry node group assets.
This makes it much simpler to share and use custom modifiers.

Node groups get a new "Is Modifier" property, which is controllable
in a popover in the node editor header when the group is an asset.

The built in modifier can be rearranged in different categories in
a next step. For now the existing organization is used, except for
the geometry nodes modifier, which is called "Empty Modifier" and
put in the root menu.

The changes in !110855 and !110828 will be important to improve
interaction speed with the new UI. Those are planned for 4.0 as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/111717
2023-09-05 14:47:18 +02:00
Christoph Lendenfeld
b7a84c49ea Animation: Keep icons aligned when curves are baked
When curves were baked, the lock icon wasn't drawn, which resulted in
a misalignment of the other icons.
With this patch, the icons are kept in alignment.

Also removes the comments that are no longer valid.

Pull Request: https://projects.blender.org/blender/blender/pulls/108518
2023-09-05 14:27:09 +02:00
Christoph Lendenfeld
9d4edd3565 Cleanup: Make format 2023-09-05 14:23:54 +02:00
Christoph Lendenfeld
d7e3961a82 Animation: Graph Editor - Don't draw curve points if they are too close to each other
When viewing a curve with a lot of keys totally zoomed out,
the keys might be closer to each other than a pixel.
The code would still draw a line between them,
costing time in the draw code.

This PR skips any keys that are too close to each other in screen space.

## Performance

The setup: 62 bones with 6000f of animation keyed on every frame.
No keys displayed, just the curves.

| - | before | after |
| - | - | - |
| zoomed in | 11μs | 17μs |
| zoomed out |  55μs | 30μs |

So a small performance penalty when zoomed in in exchange for a big gain when zoomed out.

There is a small change in visuals when zoomed out a lot.
Because this change averages keys that are too close together,
it results in a small loss of high frequency detail.

## The logic
If `prevbezt` and `bezt` are too close it will not draw,
but extend a bounding box with `prevbezt` and `bezt` including handles if needed.
Eventually the keys will be far enough apart to draw.
At this point, draw the center of the bounding box and reset it.
Now because there could be the case where `bezt` in the
current loop is super far out (e.g 5 keys with 1f spacing and the 6th key is at f1000)
we need to recalculate the bounding box again.
In case the keys are far away, just draw normally.
If it is close still, the same  process repeats.

Pull Request: https://projects.blender.org/blender/blender/pulls/110788
2023-09-05 14:18:34 +02:00
Christoph Lendenfeld
93bf17f333 Fix: Warnings in transform_convert_nla.cc
No functional changes
The recent refactor patch introduced warnings on flag checks
2023-09-05 14:16:10 +02:00
Lukas Tönne
b2b1657721 Fix #111963: Copying sockets was not creating unique identifiers
Items in the node group interface need to have unique identifiers.
Copying an item (socket or panel) was not doing this, so the node groups
end up having sockets with the same identifier. Linking sockets was
broken because copies could not be distinguished.

Pull Request: https://projects.blender.org/blender/blender/pulls/111972
2023-09-05 13:31:58 +02:00
Christoph Lendenfeld
4033f3bcc3 Refactor: Code indentation in transform_convert_nla.cc
No functional changes

`transform_convert_nla.cc` had a few `if`s within
for loops that could be inverted to remove the indentation.

In addition to that I extracted the snapping functionality
so the `if`s there can also be inverted and return.

Pull Request: https://projects.blender.org/blender/blender/pulls/111968
2023-09-05 13:01:51 +02:00
nutti
1494929f94 Python API: Fix docstring from method to classmethod
`draw_handler_add` and `draw_handler_remove` method of bpy.types.SpaceXXX
should be class method not method. However, Python API document does not show
the classmethod.

This PR fixes the Python API document of them.

Pull Request: https://projects.blender.org/blender/blender/pulls/111107
2023-09-05 12:56:41 +02:00
Lukas Tönne
ed1f9d4fdd Nodes: Fix versioning 2.6 groups, causing dangling link pointers
In 2.6 the old method of using bNodeSocket lists in bNodeTree directly
as group sockets was replaced with new group input/output nodes. This
required versioning to create those input/output nodes and then redirect
links to the new node sockets. Because creating nodes relies heavily on
node typeinfo this versioning was done in the `_after_linking` section
of the 2.6 versioning code, running after _all other versioning_
(including for much newer versions!) has already happended.

While typinfo is available at that point, doing such late versioning
causes severe problems when the data structure changes, as is the case
with the recent node panels patch (#111348). The new node group
interface also has versioning code for 4.0, but this runs _before_ the
`_after_linking` code for 2.6! Versioning for node panels expects
sockets in bNodeTree to not have any links pointing at them, but this is
not true for old 2.6 files which have not yet been fully versioned at
that point, because of the late versioning stage. Subsequently 2.6
`_after_linking` code crashes when trying to modify node links with
dangling pointers.

The solution here is to move the old versioning code out of the
`after_linking` stage to restore the expected versioning chain. This
requires creating nodes and node sockets without any typeinfo, but
luckily we only need to create simple known group input/output nodes
which don't have much complicated behavior.

Pull Request: https://projects.blender.org/blender/blender/pulls/111704
2023-09-05 12:37:05 +02:00
Jacques Lucke
32f369c2dc Cleanup: remove dead code 2023-09-05 12:18:57 +02:00
Jacques Lucke
ce48a2a85c Fix #111934: crash sculpting on mesh
The order of the parameters was reversed.
This bug was caused by 4e94db97e2.
2023-09-05 11:32:29 +02:00
Jeroen Bakker
71821d1251 Fix compilation error draw test
Pull Request: https://projects.blender.org/blender/blender/pulls/111964
2023-09-05 11:02:33 +02:00
Jeroen Bakker
ad0e4f08c0 GPU: Add tests for 1d, 2d array texture types
This PR adds several unit tests to construct and upload data for
different texture types (1d_array, 2d_array).

Pull Request: https://projects.blender.org/blender/blender/pulls/111338
2023-09-05 10:51:49 +02:00
Jeroen Bakker
b6bc53760a Vulkan: Add recent introduced types
Recently shader::Type::SHORT/USHORT types have been added.
This will add them to the vulkan backend as well

Pull Request: https://projects.blender.org/blender/blender/pulls/111962
2023-09-05 10:47:58 +02:00
Lukas Tönne
bda17719d4 Fix #111950: missing "hide value" and "compact" flags for group sockets
The "compact" flag was still missing, while the "hide" flag used the
socket flag variant (indistinguishable because of int DNA types).

Pull Request: https://projects.blender.org/blender/blender/pulls/111956
2023-09-05 10:41:55 +02:00
Christoph Lendenfeld
11fe57cab8 Animation: Move Snapping to Scene
Part of #91973

Moving the snapping code for the
* Graph Editor
* Action Editor
* and NLA editor

into the common system that lives on the scene.
This includes the Magnet icon for turning
snapping on and off.

The old settings translate to the new in the following way:
* `Frame Step` -> `Frame`
* `Second Step` -> `Second`
* `Nearest Frame` -> `Frame` + `Absolute Time Snap`
* `Nearest Second` -> `Second` + `Absolute Time Snap`
* `Nearest Marker` -> `Nearest Marker`

Since this moves the location of the snapping settings
from the editor to the scene, it changes the behavior.
Previously each editor could have different snapping
settings, where now they are all synced.

Pull Request: https://projects.blender.org/blender/blender/pulls/109015
2023-09-05 10:06:55 +02:00
Pratik Borhade
20b3e62e93 Fix #111896: Regression: Crash for entering into Armature Edit Mode
Mistake in 0a633a4e07
pointer address (ebone) was passed to `add_element()`

Pull Request: https://projects.blender.org/blender/blender/pulls/111954
2023-09-05 09:23:24 +02:00
Hans Goudey
644297cc6e Cleanup: Remove mistanly committed timer
Mistake in afdbb734cf
2023-09-04 22:47:59 -04:00
Hans Goudey
646b3555ff Cleanup: Use C++ Set for expand snap enabled face sets
Instead of the less-type-safe and slower `GSet`.
2023-09-04 22:23:27 -04:00
Hans Goudey
e52404db95 Cleanup: Use simpler face vert iteration in sculpt expand 2023-09-04 22:23:26 -04:00
Hans Goudey
f4505e7b0a Cleanup: Use BitVector instead of BLI_Bitmap in sculpt expand 2023-09-04 22:23:26 -04:00
Hans Goudey
96f761a17c Cleanup: Use const arguments to sculpt "get" functions 2023-09-04 22:23:26 -04:00
Hans Goudey
8bc1e5a0e9 Cleanup: Use consistent static function names in sculpt_geodesic.cc
The capital prefixes are meant for non-static functions in C code.
2023-09-04 22:23:26 -04:00
Hans Goudey
afdbb734cf Cleanup: Avoid mesh positions copy applying sculpt to shape key
`BKE_pbvh_vert_coords_alloc` is unnecessary after 1af62cb3bf
since PBVH vertex positions are stored in a contiguous array.
2023-09-04 22:23:26 -04:00
Campbell Barton
6de294a191 PyAPI: postpone loading add-ons until after key-maps have been defined
Loading add-ons after key-maps resolves a problem where add-ons would
setup shortcuts before Blender had created the key-maps.
Making add-ons have to declare the key-maps using region & window types
matching Blender's internal values.

This PR a pitfall pointed out in #110030.

Ref !110092
2023-09-05 11:35:14 +10:00
Campbell Barton
bedfc68e3f Cleanup: use function style integer casts, modernize headers 2023-09-05 11:10:44 +10:00
Campbell Barton
0c26c84704 Cleanup: spelling in comments 2023-09-05 11:04:27 +10:00
Harley Acheson
8c826afc7b Cleanup: Make format
Just changes resulting from Make Format. Just space_node.cc
2023-09-04 16:08:54 -07:00
Harley Acheson
66f825135a Fix #111821: Fix Stats While in Sculpt Mode
Properly show vert and face count while in Sculpt mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/111945
2023-09-05 01:00:43 +02:00
Harley Acheson
20427cb3ad Fix #102687: Use Proper Style for Label Length Estimation
When estimating widget sizes, ui_text_icon_width_ex() assumes that all
items are using the "widget" text style, which is incorrect for labels.
This PR uses widget_label style for uiItemL_ and the label portion of
ui_item_with_label.

Pull Request: https://projects.blender.org/blender/blender/pulls/111908
2023-09-05 00:58:57 +02:00
Hans Goudey
f5472dcebc Cleanup: Simplify Hydra SubMesh creation and removal
Use blender::Vector instead of std::vector.
2023-09-04 18:08:02 -04:00
Germano Cavalcante
2cead79747 Snap: Support occlusion of 'In Front' objects
This fixes #111767

`In Front` objects remain visible even if they are behind non
`In Front` objects.

It is to be expected then that the snap for them is not occluded as if
they were not `In Front`.
2023-09-04 19:05:48 -03:00
Clément Foucault
4f3b224141 EEVEE-Next: Irradiance Volume: Add clamp options
This allows to clamp the lighting components
during the baking phase.

Also add back intensity option.

Pull Request: https://projects.blender.org/blender/blender/pulls/110858
2023-09-04 23:27:30 +02:00
Clément Foucault
bb1e8bde13 Fix: OSX: Compilation on OSX 10.15 target platform
This was because some features requiring OSX 11 were
not properly guarded by defines.

Pull Request: https://projects.blender.org/blender/blender/pulls/111940
2023-09-04 22:33:04 +02:00
Clément Foucault
715eb4d88e Fix: EEVEE-Next: Fix shader compilation on Metal 2023-09-04 19:40:36 +02:00
Bastien Montagne
d64542bfd9 Fix #111907: Crash loading file with library overrides and object-linked materials.
It is not fully clear why the object's material accessor does return
'valid' value for out-of-bound indices. In theory, item getter should
return `false` in such case, and not pretend to give valid data. But
this seems to be expected behavior for materials, according to some
comments in BKE underlying code?

In anycase, valid material slot indices can still return empty ('null')
data, if there is no material assigned to the indexed slot.

So this liboverride-specific code does need extra validation of the item
data returned by index, before trying to access it for name matching.
2023-09-04 19:30:00 +02:00