Commit Graph

102197 Commits

Author SHA1 Message Date
Clément Foucault
2eb447b00f EEVEE-Next: Shadow: Fix shader compilation
Some platforms do not support `bool` type as
shared variables, and no component reference
for atomics.
2023-08-25 11:07:00 +02:00
Bastien Montagne
e20a284cb9 Fix #111488: Copying object crashes Blender after recent refactor.
Caused by 8bb5916183.

Trivial mistake, would have been caught by a basic test, so also added
said test for the 'write partial' feature.
2023-08-25 11:04:03 +02:00
Pratik Borhade
4462100cee GPv3: Delete channels
Support deleting Grease pencil channels in dopesheet.
`remove_layer` function is used to remove the layer from GP object.

Pull Request: https://projects.blender.org/blender/blender/pulls/111426
2023-08-25 11:00:37 +02:00
Campbell Barton
0094bf8357 Remove debug printf committed by accident 2023-08-25 17:13:49 +10:00
Campbell Barton
4c0ef81926 Fix frame-rate display using times from previous playback
The average times weren't reset so the last draw time would be used
making the FPS seem low for the first ~10 or so frames.
The averages from the last time the playback operator ran were also
used which could be misleading although this was also limited to the
first 8 frames.

Resolve by freeing the ScreenFrameRateInfo on animation start/end.
2023-08-25 17:01:18 +10:00
Campbell Barton
2c587e31dd Fix error in frame-rate display check
Mistake in 1954baaed3
caused a near-zero FPS value to be used when animation playback started.
2023-08-25 17:01:16 +10:00
Campbell Barton
1954baaed3 Fix frame-rate display with multiple viewports open
Calculating the average FPS was done in the draw function which
also overwrote the old value. With multiple viewports the same
time-delta would be written multiple times causing the FPS display
not to use use REDRAW_FRAME_AVERAGE as intended.

Resolve by only calculating the average once per frame change across
multiple viewports.
2023-08-25 16:24:41 +10:00
Campbell Barton
09f61f6881 Cleanup: enforce documented convention for RNA enum naming
This was noted in code comments and checked in Python documentation
generation but not at build time.

Since these enums are identifiers that end up included in various places
enforce the `rna_enum_*_items` convention which was noted as
the convention but not followed strictly.

Partially reverts [0], avoids having to deal with multiple prefix types.

[0]: 3ea7117ed1
2023-08-25 13:35:58 +10:00
Campbell Barton
4d757510be Cleanup: remove unnecessary context arg to transform drawing functions 2023-08-25 10:46:24 +10:00
Campbell Barton
89c2e3c9dc Cleanup: remove unnecessary context argument to drawSnapping 2023-08-25 10:25:58 +10:00
Campbell Barton
2839e23a45 Fix sequencer snap failing to draw with drag & drop
TransInfo wasn't initialized, causing drawSnapping to depend on
uninitialized stack memory. When `t.tsnap.flag & SCE_SNAP` happened
to be set - snap would draw.

Initialize the TransInfo struct and set SCE_SNAP explicitly.
2023-08-25 10:19:33 +10:00
Campbell Barton
7074c210cc Cleanup: format 2023-08-25 09:40:42 +10:00
Campbell Barton
3de8900ed6 Cleanup: spelling in comments 2023-08-25 09:40:42 +10:00
Almaz-Shinbay
ed5110c0ef Outliner: Port pose channel 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 a new class for pose channel elements.

Pull Request: https://projects.blender.org/blender/blender/pulls/111167
2023-08-24 23:18:20 +02:00
Eitan Traurig
584d5dbb20 UI: Rename Realtime GPU in compositor to GPU
The "Realtime GPU" name can be misleading if the GPU compositor is not
real-time, or if the Viewport Compositor uses the CPU back-end.

Pull Request: https://projects.blender.org/blender/blender/pulls/111357
2023-08-24 21:10:51 +02:00
Hans Goudey
f5b7813f3c Cleanup: Remove unnecessary mesh C API function 2023-08-24 13:10:41 -04:00
Hans Goudey
119fbba47d Cleanup: Simplify PBVH update of mesh pointers
- User higher level access to mesh normals
- Avoid duplicating the retrieval of visibility layers
2023-08-24 12:41:28 -04:00
Bastien Montagne
7e7edc4d8e Readfile: Fix existing memleak in case an Armature Object loses its armature ObData.
The situation at this stage of readfile process is now sane enough, that
the regular Pose freeing code can be called, avoiding potential
memleaks.

Note that this whole 'non-Empty object with NULL obdata' case should now
be very hypothetical, since in case a linked obdata goes missing,
Blender will generate and empty place-holder for it at read time.

Tested by artificially setting all Armature objects' obdata pointer to
null in read_data code, and loading some complex production files from
Pets Project.
2023-08-24 17:30:12 +02:00
Hans Goudey
111e586424 Cleanup: Sculpt: Avoid unnecessarily changing vertex normals
Keeping a mutable reference to vertex normals for the entire lifetime
of the PBVH structure makes caching the normals and sharing the cache
harder than it should be. Generally code is safer when we reduce the
number of mutable references to data.

Currently the normals are modified in two places. First is the sculpt
mesh normal recalculation. There we can just retrieve the normals from
the mesh each time. Second is the restore from an undo step. That is
unnecessary because the normals are marked for recalculation anyway.
It doesn't even make much sense to store the normals in an undo step
when we can easily recalculate them based on new positions.

This change helps with #110479. These were also the last place that
kept a mutable reference to normals. I tested undo and redo after
sculpting, and it works well for each PBVH type.

Pull Request: https://projects.blender.org/blender/blender/pulls/111470
2023-08-24 16:47:55 +02:00
Bastien Montagne
b53c7a804a Readfile: Replace the 'lib_link' specific code by generic usage of foreach_id.
The `lib_link` callback cannot always be fully replaced/removed, as in
some case it is also doing some validation checks, or data editing based
on the result of lib_linking internal ID pointers.

The callback has been renamed for that purpose, from `read_lib` to
`read_after_liblink`. It is now called after all ID pointers have been
fully lib-linked for the current ID, but still before the call to
`do_versions_after_linking`.

This change should not have any behavioral effect. Although in theory
the side-effect of this commit (to split lib linking itself, and the
validation/further processing code) into two completely separated steps
could have some effects, in practice none are expected, and tests did
not show any changes in behavior either..

Part of implementing #105134: Removal of readfile's lib_link & expand code.
2023-08-24 16:33:31 +02:00
Amelie Fondevilla
6ef40a3e9f Fix: GPv3: Editable channels filtering was inverted for grease pencil channels
As pointed out in #111426, the filtering for only editable channels
was wrongly set for grease pencil layers,
the layer being editable if it is not locked, and not the other way around.

Pull Request: https://projects.blender.org/blender/blender/pulls/111475

Co-authored-by: Pratik Borhade <PratikPB2123>
2023-08-24 16:01:19 +02:00
Hans Goudey
34e4bedcd8 Nodes: Move rotation socket out of experimental
See #92967.

Pull Request: https://projects.blender.org/blender/blender/pulls/111448
2023-08-24 15:28:07 +02:00
Nate Rupsis
2cb5f83940 Fix #97049: Auto-keyframe Status Message Overlaps Navigation Gizmo
"Auto Keying On" display now respects users MINI_AXIS preferences (default, minimal, none), as well as the navigation (en)disable option. No more text overlapping.

Co-authored-by: Abhinav Chennubhotla
Pull Request: https://projects.blender.org/blender/blender/pulls/111356
2023-08-24 15:25:45 +02:00
Julian Eisel
8941739d75 Fix unused variable warning 2023-08-24 15:20:53 +02:00
Philipp Oeser
686ffaaed9 Fix #111174: dropped nodegroups from the asset browser show selector
There was a difference between drag&drop assets from the asset browser
vs. using the search menu (in that doing it from the menu would
correctly hide the data-block selector on the nodegroup).

Since drag&drop in the Node Editor uses `NODE_OT_add_group` (not
`NODE_OT_add_group_asset` as the menu does), we have to add the hiding
here too (for this, an operator property is added which is set in
`node_group_drop_copy` if we are dropping an asset.

Alternatively, we could use `NODE_OT_add_group_asset`, too, but that
would require somehow setting the "asset" context pointer from the
dropbox copy function [how to do this wasnt obvious for me]. In that
case, we would need to set up a separate dropbox with appropriate poll
functions (so there would be one for asset groups and for the the other
groups).

Pull Request: https://projects.blender.org/blender/blender/pulls/111427
2023-08-24 15:12:00 +02:00
Philipp Oeser
8992e7ab2a Fix: missing update when library override editable is toggled
If this is not a system override, this leads to the override actually
being reset (which might affect the 3Dview and most probably affects the
Properties Editor).

Now use the same modifiers as used elsewhere for resetting a library
override.

Pull Request: https://projects.blender.org/blender/blender/pulls/111469
2023-08-24 15:11:37 +02:00
Miguel Pozo
f63a0e670a Workbench-Next: Workaround lack of texture views support
Extract a mask from the stencil buffer and use that texture instead
when texture views are not available.
Needed for supporting the Windows ARM software driver.

The workaround is isolated on its own class so it's easy to remove once
it's no longer needed.

Note that while this adds a function to check if texture views are available
(`GPU_texture_view_support`), at the moment this always returns true in
practice, since OpenGL 4.3 is the minimum supported version.
A separate patch will be needed to allow Blender to run using
OpenGL 4.2 + extensions.

Pull Request: https://projects.blender.org/blender/blender/pulls/111402
2023-08-24 15:10:33 +02:00
Hans Goudey
45d8a8b0c3 Geometry Nodes: Initial basic rotation socket nodes
This PR adds an initial set of nodes using the new rotation socket.
6 nodes build rotations or convert them to other formats, a 7th rotates
a vector with a rotation, and the last inverts rotations.

The design task #109965 describes the choice to use separate nodes
for the rotation construction and separation operations. In the future,
a "Switch Node" operator (#111438) will help to make working with
these separated nodes faster.

- **Axis Angle to Rotation**
- **Rotation to Axis Angle**
- **Combine Quaternion**
- **Separate Quaternion**
- **Euler to Rotation**
- **Rotation to Euler**
- **Rotate Vector**
- **Invert Rotation**

See #92967

Pull Request: https://projects.blender.org/blender/blender/pulls/109030
2023-08-24 14:58:55 +02:00
Almaz-Shinbay
81eb7edc8b Outliner: Port view collection base 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 a new class for view collection base elements.

Pull Request: https://projects.blender.org/blender/blender/pulls/111230
2023-08-24 14:44:43 +02:00
Christoph Lendenfeld
3f7eceea93 Fix: Memory leak in Graph editor keyframe jump
Introduced with #108549
Simply forgot to free the AnimData list

Pull Request: https://projects.blender.org/blender/blender/pulls/111464
2023-08-24 14:33:12 +02:00
Hans Goudey
d8757236e0 Cleanup: Remove unused sculpt function declaration
The function is static, it doesn't need to be declared in the header.
2023-08-24 08:21:10 -04:00
Michael Kowalski
5bbeb927a1 Fix: USD export: missing animation frames.
This fixes a bug where only the time sample for the first frame
is written to a USD animation.

Replaced the hard-coded USDExporterContext::time_code value with a
USDExporterContext::get_time_code function wrapper which is called
from USDAbstractWriter::get_export_time_code() to query the current
frame when writing an animation.

Pull Request: https://projects.blender.org/blender/blender/pulls/111248
2023-08-24 14:12:07 +02:00
Hans Goudey
7fc7441a7b Cleanup: Separate sculpt undo restore into types
Though this means a few loops are duplicated, overall the code is
easier to reason about because the cases are separated more. This
makes potential changes to the way normals are stored clearer
(related to !110479), and makes potential optimizations easier too.
2023-08-24 07:37:07 -04:00
Hans Goudey
4a0581eca2 Fix: Missing multires to faces visibility sync after box hide
The operator handled faces visibility change correctly but not
multires. Use the existing PBVH API function for that, also remove
a redundant call to the function that fetched the attribute pointers
again after the change.
2023-08-24 07:37:07 -04:00
Hans Goudey
4d82e1a7ee Cleanup: Simplify, parallelize multires to mesh visibility propagation
After undoing a visibility change, the visibility is propagated from
multires grids to mesh faces and vertices. This progress was completely
single threaded and more complicated than necessary. Simplify it
using newer C++ data structures and APIs.
2023-08-24 07:37:07 -04:00
Hans Goudey
a1dceeec00 Fix #110516: Geometry nodes use attribute toggle boolean values broken
The toggle was added before boolean IDProperties were added. The fix is
to support both integer types and boolean types, similar to a recent
change for other inputs, 9f30555faf.

Pull Request: https://projects.blender.org/blender/blender/pulls/111433
2023-08-24 13:36:25 +02:00
Hans Goudey
4b26fbbd02 Nodes: Change rotation socket color
The current color was just temporary. The new color
is meant to be in between "Vector" and "Boolean"--
close to the vector color but distinct enough to allow
seeing the difference at a glance.

Pull Request: https://projects.blender.org/blender/blender/pulls/111446
2023-08-24 13:34:36 +02:00
casey bianco-davis
5bed3ef827 GPv3: Dissolve Operator
Adds the Dissolve operator.

note that this pull request contains some of the same menu code also included in #110938

Pull Request: https://projects.blender.org/blender/blender/pulls/111079
2023-08-24 11:06:18 +02:00
Jeroen Bakker
bce23aa0f5 Fix: Crash On Exit When Using Vulkan
Vulkan device was deallocated, but when destroying the GHOST context
the GPU context is reactivated and want to allocate buffers lazilly.

This is solved by de-initializing the device on platform exit, resetting
buffer pointers so double free can be detected.

Pull Request: https://projects.blender.org/blender/blender/pulls/111462
2023-08-24 10:23:21 +02:00
Campbell Barton
24a8d6425a CMake: include missing files in source files 2023-08-24 11:51:25 +10:00
Campbell Barton
a56200c1ed Cleanup: sort cmake file lists 2023-08-24 11:38:41 +10:00
Campbell Barton
a13823057c Cleanup: format 2023-08-24 11:37:29 +10:00
Campbell Barton
4492742487 License headers: manually integrate existing copyright into SPDX text
Some GLSL files already contained copyright information,
manually merge this into existing SPDX headers.

Ref !111247
2023-08-24 10:57:19 +10:00
Campbell Barton
0148293520 License headers: add SPDX licenses for '*.glsl' files
When GLSL sources were first included in Blender they were treated as
data (like blend files) and had no license header.
Since then GLSL has been used for more sophisticated features
(EEVEE & real-time compositing)
where it makes sense to include licensing information.

Add SPDX copyright headers to *.glsl files, matching headers used for
C/C++, also include GLSL files in the license checking script.

As leading C-comments are now stripped,
added binary size of comments is no longer a concern.

Ref !111247
2023-08-24 10:57:03 +10:00
Campbell Barton
8d1ffe14b2 Cleanup: use a bool for BKE_mesh_orco_verts_transform invert argument 2023-08-24 10:45:34 +10:00
Campbell Barton
3ec489000f Cleanup: spelling in comments 2023-08-24 10:43:45 +10:00
Almaz-Shinbay
668b31c5d8 Outliner: Port layer collection 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 a new class for layer collection elements.

Pull Request: https://projects.blender.org/blender/blender/pulls/111220
2023-08-23 18:17:14 +02:00
Bastien Montagne
110eb666ca Fix #111439: liboverride object cannot be made local from 3DView, if it has a local parent.
The code ensuring that an object (or obdata) is not made local if it is
used by linked data that is not tagged to be made local was blatantly
buggy, leading to over-detecting such cases.

Note that this code remains fairly fragile imho, think the whole Main
data-base of IDs should be checked, other data-types than Objects can
use objects! But this is for another day.
2023-08-23 17:27:54 +02:00
Bastien Montagne
445fabeae9 Fix (unreported) crash when loading files with py-defined ID IDProperties.
New code exposing ID Pointers CustomProperties to the UI (b3c7f3c8a9)
would cause invalid data access when calling `as_dict()` on py-defined ID
pointers ID properties, since these have no ID type defined by default.

The code of `as_dict()` will now forcefully generate a valid ID type
value, either by using the type of the currently assigned ID, or falling
back to the Object ID type.

Found while opening some lighting production files from the Pets
Project.
2023-08-23 16:44:56 +02:00
Bastien Montagne
8bb5916183 Readfile: Replace the 'expand' specific code by generic usage of foreach_id.
The `expand` callback is 'trivial' to replace, since it is only iterating
over ID pointers and calling a callback.

The only change in behavior here is that some pointers that were not
processed previously will now be.

In practice this is not expected to have any real effect (usually
the IDs used by these pointers would have been expanded through other
usages anyway). But it may solve a few corner cases, undocumented issues
though.

Part of implementing #105134: Removal of readfile's lib_link & expand code.
2023-08-23 16:44:56 +02:00