Commit Graph

131760 Commits

Author SHA1 Message Date
Damien Picard
17b32e1d0d Python API: Add new method to move view layers
This commit adds a new method Scene.view_layers.move(). It acts the
same as Object.modifiers.move(), taking two arguments from_index
and to_index.

Pull Request: https://projects.blender.org/blender/blender/pulls/117037
2024-01-12 16:34:37 +01:00
Christoph Lendenfeld
37421d12bd Fix #73524: Autokey inserts keyframes into the driver FCurve
When autokeying a property with a driver, the code added
the keyframe into the drivers FCurve.

Judging by the code the intention was to be able to quickly
set up driven keys by modifying the driven value and have that
reflected in the driver curve.

However that idea was blocked by the fact that you can't actually
change the value of a property that is driven.
In addition to that it's quite unexpected and the result is hardly
communicated to the user.

The solution is to not insert keyframes to drivers using the
autokeying system.

Also Fixes #95866

This was discussed in the A&R module meeting
https://devtalk.blender.org/t/2024-01-11-animation-rigging-module-meeting/32888#patch-review-decision-time-5
and the consensus was the feature to set up driven keys would be great,
 but since it's not working at all currently it's better to get rid of the bugs.

Pull Request: https://projects.blender.org/blender/blender/pulls/116927
2024-01-12 16:33:43 +01:00
Bastien Montagne
4fe4a52cd7 Fix missing tagging of collections in some BKE_collections codepath.
In particular, while Object (un)linking was already tagged in relevant
BKE code, collection (un)linking was not in several cases.

This was (partially) done by user code, though almost never for the
whole hierarchy of parents.

Technically, the tag is done as part of
`collection_object_cache_free_parent_recursive`/`collection_object_cache_free`,
since currently clearing this cache is done everytime to collection
hierarchy or their content is modified.

It also removes `collection_tag_update_parent_recursive`, which was
already doing something similar, but was only called from code
adding/removing objects to collections, and was walking the same parent
hierarchy as `collection_object_cache_free_parent_recursive`.

This commit implements the decision made in #116601, to tag modified
data as close as possible from the code modifying it.

---------------------

This has an impact on deg tagging, which takes over twice as much cycles
with this commit compared to previous code  when opening a Pets production
file with several liboverrides (`deggraph_id_tag_update_single_flag` goes
from less than 0.03% to over 0.06%).

The overhead remains extremely low though, and is totally unmeasurable in
global execution timing. Timing of the liboverride processing on opening
the production file also did not show any measurable differences.

Pull Request: https://projects.blender.org/blender/blender/pulls/116986
2024-01-12 16:24:22 +01:00
Eugene Kuznetsov
d47f1fa1e8 Fix: more meaningful error when autopep8 is missing
Instead of getting a Python UnboundLocalError.

Pull Request: https://projects.blender.org/blender/blender/pulls/116613
2024-01-12 16:14:20 +01:00
Brecht Van Lommel
679721ed64 Fix: make update fails in some cases after recent changes
After defaulting to the Python binary from the precompiled libraries,
what could happen was that an older Python lib folder stuck around because
of pycache files, but there was no actual working Python binary for that
version.

Check for the existence of the binary instead of the lib files to solve it.
Also allow Python 3.10 binary for make update.
2024-01-12 16:13:15 +01:00
Thomas Barlow
2a97516610 RNA: Use PROP_RAW_BOOLEAN with single-byte PROP_BOOLEAN raw types
The PROP_RAW_BOOLEAN raw type exists, but was only used as a fallback in
bpy_rna.cc#foreach_getset to help construct an input RawArray for
PROP_BOOLEAN properties without raw access.

Using the PROP_RAW_BOOLEAN raw type for PROP_BOOLEAN properties where
possible will make it so that almost all PROP_BOOLEAN properties are
considered compatible with bool buffers in bpy_rna.cc#foreach_getset,
which should simplify efficient access to bool properties of collection
items with bpy_rna.cc#foreach_getset.

Only about 50 PROP_BOOLEAN properties have raw access because most
either don't use #RNA_def_property_boolean_sdna or use a bitmask, which
disables raw access. Even fewer of these properties belong to a
StructRNA used by a collection property with raw access.

PROP_BOOLEAN properties with raw access, but which use a type larger
than a single byte are rarer still, and will remain using their existing
raw type because they cannot have raw access as bool.

Pull Request: https://projects.blender.org/blender/blender/pulls/116673
2024-01-12 16:04:47 +01:00
Tomoaki Kawada
da685008be Fix: Align buttons context's dir with actually present attributes
Pull Request: https://projects.blender.org/blender/blender/pulls/116556
2024-01-12 16:02:19 +01:00
Bastien Montagne
5877d1e396 Fix #116029: Regression: Ctrl+Z breaks vertex paint.
In the end it was a dummy mistake in own 94e6ab6d71 refactor, which
broke the 'restore on undo' case for ID pointers when the old and new
pointers remain exactly the same.

Many thanks to Campbell (@ideasman42) for investigating and identifying
the actual issue.
2024-01-12 15:54:54 +01:00
Philipp Oeser
0061f2f650 PyAPI: add preferences.filepaths.asset_libraries.new/remove methods
Can be convenient to do this from python (e.g. afaict, these preferences
are not used from Application Templates userpref.blend, but could now at
least be configured via the template script __init__.py)

Pull Request: https://projects.blender.org/blender/blender/pulls/116381
2024-01-12 15:42:37 +01:00
Philipp Oeser
5f26858931 Fix #116848 : Mask handles set to "Free" ignore theme color
Reason is that `.handle_free` and `.handle_sel_free` are never really
defined as RGBA defaults in `U_theme_default` `.space_image` (nor
`.space_clip` and `.space_graph` ) with full alpha (as opposed to the
other handle types).

If we read these with `immUniformThemeColor` then we are ending up with
with zero alpha.

So in the Image Editor or Movie Clip Editor, we only see the grey
"Outline" (if the mask display is set to this - which is by default),
the handles themselves are in visible, making it look like those were
always drawn in grey and the Preference would have no effect.

We also dont really have a preference color defined for free handles
(they are set to black).

So there are two possible solutions:
- [1] come up with a good color, define as RGBA default in
`U_theme_default` and overwrite user Preferences in `do_versions_theme`
(with a version bump)
- [2] read existing Preferences with `immUniformThemeColor3` (instead of
`immUniformThemeColor`) to work around the alpha problem

This patch uses the second (and less disruptive) solution.

Pull Request: https://projects.blender.org/blender/blender/pulls/116898
2024-01-12 15:42:00 +01:00
Christoph Lendenfeld
f24b7749b5 Refactor: keyingsets.cc
No functional changes.

Clean up the code by:
* renaming variable `ks` to `keyingset`
* renaming variable `ksi` to `keyingset_info`
* renaming variable `ksp` to `keyingset_path`
* moving variables closer to where they are used
* making variables const if possible
* use `LISTBASE_FOREACH_MUTABLE` where applicable
* Fix comment style
* Remove comments that provide no extra information

Pull Request: https://projects.blender.org/blender/blender/pulls/117062
2024-01-12 15:14:09 +01:00
Jeroen Bakker
d6f98dbd3f Cleanup: Make format 2024-01-12 15:14:00 +01:00
Jonas Holzman
15c0a1eaf5 Python API: Make Screen.show_fullscreen true also in fullscreen mode
Previously it would only do this in maximized mode, not the full fullscreen
mode which was confusing.

Pull Request: https://projects.blender.org/blender/blender/pulls/116788
2024-01-12 15:09:24 +01:00
Jason Fielder
7eee954d9d Fix #116216: Only support Memoryless texture flag on TBDR GPUs
Change limits MTLStorageModeMemoryless to device which
support this feature.

Authored by Apple: Michael Parkin-White
Pull Request: https://projects.blender.org/blender/blender/pulls/116250
2024-01-12 15:08:46 +01:00
Hans Goudey
3da4df6856 Fix: Broken sculpt face set undo restore after recent cleanup
Mistake in a76b2bfbcc. Resolves #117022
2024-01-12 08:54:37 -05:00
Hans Goudey
bf6eda3073 Fix: Build error from renamed header 2024-01-12 08:37:27 -05:00
Iliya Katushenock
37b2c12cfa Geometry Nodes: Sort Elements node
Implements the design in #109983

Pull Request: https://projects.blender.org/blender/blender/pulls/114194
2024-01-12 14:30:34 +01:00
Jeroen Bakker
4ac0267567 OpenGL: Specialization Constants
This PR adds support for specialization constants for the OpenGL
backend. The minimum OpenGL version we are targetting doesn't
have native support for specialization constants. We simulate this
by keeping track of shader programs for each set of specialization
constants that are being used.

Specialization constants can be used to reduce shader complexity
and improve performance as less registry and/or spilling is done.

This requires the ability to recompile GLShaders. In order to do this
we need to keep track of the sources that are used when the shader
was compiled. For static sources we only store references
(`GLSource::source_ref`), for dynamically generated sources we keep
a copy of the source (`GLSource::source`).

When recompiling the shader GLSL source-code is generated for the
constants stored in `Shader::constants`. When compiling the previous
GLSource that contains specialization constants is then replaced
by the new version.

Pull Request: https://projects.blender.org/blender/blender/pulls/116926
2024-01-12 14:28:50 +01:00
Iliya Katushenock
23122338cb Nodes: debug print for bNodeTreeZones
Pull Request: https://projects.blender.org/blender/blender/pulls/116903
2024-01-12 13:56:28 +01:00
Jeroen Bakker
024e12b53e Cleanup: Make format 2024-01-12 13:49:06 +01:00
Antonio Vazquez
814ff41ed5 GPv3: Add Assign material menu
Adds a menu to assign a material from a list as is in GPv2.

Related to #114190.

Pull Request: https://projects.blender.org/blender/blender/pulls/114637
2024-01-12 13:40:00 +01:00
Damien Picard
3bd41cf9bc I18n: Go over TIP_ and IFACE_ usages, change to RPT_ when relevant
The previous commit introduced a new `RPT_()` macro to translate
strings which are not tooltips or regular interface elements, but
longer reports or statuses.

This commit uses the new macro to translate many strings all over the
UI.

Most of it is a simple replace from `TIP_()` or `IFACE_()` to
`RPT_()`, but there are some additional changes:
- A few translations inside `BKE_report()` are removed altogether
  because they are already handled by the translation system.
- Messages inside `UI_but_disable()` are no longer translated
  manually, but they are handled by a new regex in the translation
  system.

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

Pull Request: https://projects.blender.org/blender/blender/pulls/116804
2024-01-12 13:37:32 +01:00
Damien Picard
5db82be74f Fix #76101: I18n: add new preference to translate reports
Translation of the UI is currently split into 3 preferences:
interface, tooltips, and new data. The distinction between interface
and tooltips is currently unclear as tooltips also include a lot of
messages not displayed in the actual tooltips on mouse hover.

These include reports to the Info Editor, information in editor
headers and footers, and statuses in panels.

In order to limit the use of `TIP_()` to actual tooltips, this commit
introduces a new preference for this extra information: "Reports".

New translation macros are introduced: `RPT_()` and `CTX_RPT_()`, as
well as their equivalent for the Python API, `pgettext_rpt_()`, to be
imported as `rpt_()`.

Pull Request: https://projects.blender.org/blender/blender/pulls/116804
2024-01-12 13:37:29 +01:00
Iliya Katueshenock
ff38836c93 GP3: Select Alternate: Speedup
Implementation change to better use cache by using simpler operation in main loop.
Also avoiding module operations from the loop over all points (module is costly).
On small drawings, the increase can reach 2x.

- Small size of curves / low amount of points (50 curves, size = curve_index) (50 repeats):
  - Timer 'Old': (Average: 2277 ns, Min: 1900 ns, Last: 2000 ns).
  - Timer 'New': (Average: 1314 ns, Min: 1000 ns, Last: 1200 ns).
- 5000 curves, 1000 points. Multithreading is used (50 repeats):
  - Timer 'Old': (Average: 1.1 ms, Min: 0.9 ms, Last: 1.1 ms).
  - Timer 'New': (Average: 0.7 ms, Min: 0.5 ms, Last: 0.6 ms).
- 5000 curves, 1000 points. Multithreading is disabled (50 repeats):
  - Timer 'Old': (Average: 9.2 ms, Min: 5.6 ms, Last: 15.5 ms).
  - Timer 'New': (Average: 7.7 ms, Min: 4.4 ms, Last: 8.5 ms).

Benchmark branch: 1a7d622483/source/blender/editors/curves/intern/curves_selection.cc (L267)

Pull Request: https://projects.blender.org/blender/blender/pulls/110279
2024-01-12 13:06:30 +01:00
Omar Emara
e84dc990b1 Realtime Compositor: Implement Vector Blur node
This patch implements the Vector Blur node for the Realtime Compositor.
The implementation is a direct and mostly identical port of the EEVEE
motion blur implementation with the necessary adjustments to make it
work with the compositor.

The exposed parameters in the node does not match those exposed in
EEVEE, so only the parameters shared between both are currently
implemented. In the future, we should make a decision to either unify
both, or just consider them independent implementations, with the
possibility of sharing the full or part of the code.

Further, it would also make sense to port the implementation to the CPU
compositor, since the new implementation is higher in quality while also
being faster.

The default value of the node shutter setting was changed to 0.25 to
approximately match the default settings of EEVEE and Cycles, since in
their default settings, they evaluate the previous and next frames at
plus and minus 0.25.

Pull Request: https://projects.blender.org/blender/blender/pulls/116977
2024-01-12 12:12:01 +01:00
Antonio Vazquez
c964b79edf GPv3: Copy Materials to Selected operator
Conversion of GPv2 operator to duplicate materials between grease pencil objects.

Pull Request: https://projects.blender.org/blender/blender/pulls/115535
2024-01-12 11:20:35 +01:00
Bastien Montagne
da1ed32f76 Fix #116734: Measure Tool Undo crash.
The ruler code would add new (GP) ID and link it to current scene outside
of any depsgraph tagging and/or undo step writing.

Now always add this 'util' GP data earlier, in a context where there is a clear
undo step written. Also fixes the missing tagging and relations updates.

Pull Request: https://projects.blender.org/blender/blender/pulls/116751
2024-01-12 11:13:41 +01:00
Casey Bianco-Davis
33b4964c0c GPv3: Sample color
This adds the ability to use the `sample color` operator in GPv3

Pull Request: https://projects.blender.org/blender/blender/pulls/116235
2024-01-12 11:11:55 +01:00
Falk David
13ed151e3d Cleanup: GPv3: Use enum values for cap defaults instead of int 2024-01-12 10:38:22 +01:00
Falk David
ff12ee890d GPv3: Rendering "hardness" curve attribute
This adds support for rendering the hardness curve attribute.
The attribute cannot be written from within GPv3, but is added when
converting from the legacy Grease Pencil type.
2024-01-12 10:38:22 +01:00
Weizhen Huang
8bdb97e5ff EEVEE-Next: implement less noisy GGX VNDF sampling for reflections
from paper "Bounded VNDF Sampling for Smith–GGX Reflections"

Pull Request: https://projects.blender.org/blender/blender/pulls/116773
2024-01-12 10:32:40 +01:00
Weizhen Huang
ea669cb8dc EEVEE-Next: implement more efficient GGX VNDF sampling
from paper "Sampling the GGX Distribution of Visible Normals"
2024-01-12 21:20:28 +13:00
Guillermo Venegas
950759a526 Cleanup: Move Text Editor runtime data to a separate allocation
The struct `SpaceText_Runtime` already separates runtime data from
`SpaceText`, however it is still allocated inside `SpaceText`, read and
write file operations still copy this data, but is override on read.

This changes separate allocation of `SpaceText_Runtime` from
`SpaceText`.

Ref !115418
2024-01-12 14:00:59 +11:00
Campbell Barton
e202c81b41 Fix #115117: Crash displaying status info on undo with subsurf mesh
After undo, a depsgraph update could free run-time modifier data.

In the case of the subsurf modifier a reference to this is held
in the meshes run-time data which also needs to be cleared.
2024-01-12 12:16:49 +11:00
Campbell Barton
3aa3743b6e Fix hang on startup under Wayland & LIBDECOR with the VULKAN backend
Create a dummy buffer so LIBDECOR initializes the window configuration.
2024-01-12 11:31:10 +11:00
Richard Antalik
16741e735b Fix: Uninitialized variable in retiming drawing
Caused by a7d641eb58.
2024-01-11 22:04:14 +01:00
Hans Goudey
a76b2bfbcc Cleanup: Small change to face set scupt undo
Flip condition to un-indent code, change order of variable declarations.
2024-01-11 15:59:32 -05:00
Hans Goudey
1406cdd7b3 Fix #117022: Incorrect sculpt undo values when creating face sets
When the "before" state of the face set brush gets stored in an undo step
and there is no face set attribute yet, 0 was stored instead of 1. 0 currently
has special meaning and isn't the default white color.
2024-01-11 15:59:32 -05:00
Richard Antalik
f33e476004 VSE: Set speed operator usability improvement
Pre set speed operator property with speed of selected segment or strip.
If more than 1 item is selected, speed is pre set to 100%
2024-01-11 21:58:01 +01:00
Hans Goudey
13377dd423 Cleanup: Fix variable name from copy and paste
This function isn't specific to vertices since it's been generalized.
2024-01-11 15:29:47 -05:00
Richard Antalik
a7d641eb58 Fix: Incorrect retiming key type
Right "fake key" was shown as transition type. This was used for
debugging, but forgot to change it back.
2024-01-11 21:17:02 +01:00
Richard Antalik
c2a2e422ad Fix: Frist retiming key can not be selected.
Area for clicking on keys was wider than strip which caused problems.
Instead of finding best strip candidate and then a key, make clickable
area wider, but inside of the strip itself.
2024-01-11 21:12:53 +01:00
Julian Eisel
766cec9e9a Assets: Don't load previews when fetching asset list for menus
These UIs don't display previews, now need to load them.

Currently the UI code doesn't actually know which previews will be
visible, so it loads them all. This adds quite some memory overhead.

Likely fixes #115372.

Pull Request: https://projects.blender.org/blender/blender/pulls/116987
2024-01-11 21:05:28 +01:00
Michael Kowalski
3fc97a3ed4 Fix: USD import: lazily create cache file
This fixes an issue where a CacheFile was always created for the USD
file, causing USD_create_handle() to be called unnecessarily even if the
USD does not have animating meshes or transforms.

This bug would sometimes result in the stage remaining open in a
CacheArchiveHandle after import (because the CacheFile is never
freed), preventing the USD from being reloaded from disk.

The cache file is now accessible to readers through an
ImportSettings::get_cache_file function wrapper which creates a
CacheFile as needed, the first time the function is called.

The allocated CacheFile pointer is now stored in a new
ImportJobData::cache_file member.

Pull Request: https://projects.blender.org/blender/blender/pulls/116242
2024-01-11 20:54:03 +01:00
Miguel Pozo
935ed0791f Fix #116709: EEVEE-Next: Missing gbuffer closure writes
Outdated subpass_transition layout after f4275cc4df
2024-01-11 20:01:32 +01:00
Jacques Lucke
8896446f7e Python: add Python API for layout panels
This adds a Python API for layout panels that have been introduced in #113584.
Two new methods on `UILayout` are added:
* `.panel(idname, text="...", default_closed=False) -> Optional[UILayout]`
* `.panel_prop(owner, prop_name, text="...") -> Optional[UILayout]`

Both create a panel and return `None` if the panel is collapsed. The difference lies
in how the open-close-state is stored. The first method internally manages the
open-close-state based on the provided identifier. The second one allows for
providing a boolean property that stores whether the panel is open. This is useful
when creating a dynamic of panels and when it is difficult to create a unique idname.

For the `.panel(...)` method, a new internal map on `Panel` is created which keeps
track of all the panel states based on the idname. Currently, there is no mechanism
for freeing any elements once they have been added to the map. This is unlikely to
cause a problem anytime soon, but we might need some kind of garbage collection
in the future.

```python
import bpy
from bpy.props import BoolProperty

class LayoutDemoPanel(bpy.types.Panel):
    bl_label = "Layout Panel Demo"
    bl_idname = "SCENE_PT_layout_panel"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "scene"

    def draw(self, context):
        layout = self.layout
        scene = context.scene

        layout.label(text="Before")

        if panel := layout.panel("my_panel_id", text="Hello World", default_closed=False):
            panel.label(text="Success")

        if panel := layout.panel_prop(scene, "show_demo_panel", text="My Panel"):
            panel.prop(scene, "frame_start")
            panel.prop(scene, "frame_end")

        layout.label(text="After")

bpy.utils.register_class(LayoutDemoPanel)
bpy.types.Scene.show_demo_panel = BoolProperty(default=False)
```

Pull Request: https://projects.blender.org/blender/blender/pulls/116949
2024-01-11 19:08:45 +01:00
Nate Rupsis
d499710218 Fix #115978: FCurve extrapolation ignored in NLA.
The fix in 9da88301ef forgot to add the `NLASTRIP_FLAG_NO_TIME_MAP` flag, and thus FCurve extrapolation on actions is ignored.

Pull Request: https://projects.blender.org/blender/blender/pulls/116382
2024-01-11 11:49:54 -06:00
Hans Goudey
6438d0ad1f Cleanup: Grammar in comments 2024-01-11 11:01:50 -05:00
Miguel Pozo
2bbf65f6e5 Fix #116985: Workbench: Skip volume depth test in Wireframe mode 2024-01-11 16:35:44 +01:00
Sergey Sharybin
c78a0f3aa6 Fix #114692: Sculpt on certain modifiers does not update normals
Caused bu 5af8b839cf.

This solution tags both mesh positions and normals for update when
drawing happens from the modifier stack evaluation result.

This is needed because the sculpt session modifies original mesh
positions, and the modifier stack is not guaranteed to modify them
further (and hence tag normals for update).

Pull Request: https://projects.blender.org/blender/blender/pulls/117033
2024-01-11 16:15:35 +01:00