Commit Graph

6665 Commits

Author SHA1 Message Date
Campbell Barton
640e70b6e8 Cleanup: various non-functional changes for C++ 2025-02-13 13:33:09 +11:00
Brecht Van Lommel
c7a33a62a2 Cleanup: Directly include DNA_userdef_types.h and BLI_listbase.h
Instead of relying on them being included indirectly.

Pull Request: https://projects.blender.org/blender/blender/pulls/134406
2025-02-12 23:01:08 +01:00
Harley Acheson
497f2884e8 UI: Decrease Alert Dialog Icon Size
Decrease the size of the icons shown on the large dialogs and
confirmations from 64 pixels (at 1X resolution scale) to 40.

Pull Request: https://projects.blender.org/blender/blender/pulls/134302
2025-02-12 18:30:52 +01:00
IREXTIA
43b3c62a54 UI: Improve save report message
Currently, all save operations show the same `Saved "Filed.blend"` message.

Improve wording to tell apart different save actions such as:

* Save As
* Save Copy
* Save Incremental

Pull Request: https://projects.blender.org/blender/blender/pulls/134114
2025-02-11 16:39:12 +01:00
Campbell Barton
d251081448 Merge branch 'blender-v4.4-release' 2025-02-11 21:33:07 +11:00
Campbell Barton
f2a1c8d77c Fix writing a blend file to a directory "versioning" the path
Writing a blend file to a path that references a directory wasn't
being handled correctly.

When the save "versions" was greater than zero the directory would
be renamed (adding a 1), otherwise there would be a
"Version backup failed" error.

Resolve by exiting with an error in the unlikely event the user saves
over a directory.

Part of a fix for #134101.

Ref !134384
2025-02-11 21:32:06 +11:00
Bastien Montagne
87a4c0d3a8 Refactor: Make Library.runtime an allocated pointer.
Move `Library.runtime` to be a pointer, move the related
`LibraryRuntime` struct to `BKE_library.hh`. Similar to e.g.
Mesh.runtime, that pointer is expected to always be valid, and is
allocated at readtime or when creating a new Library ID.

Related smaller changes:
* Write code now uses standard ID writing codepath for Library IDs too.
  * Runtime pointer is reset to nullptr before writing.
* Looking up a library by its absolute path is now handled through a
  dedicated utils, `search_filepath_abs`, instead of using
  `BLI_findstring`.

Pull Request: https://projects.blender.org/blender/blender/pulls/134188
2025-02-07 17:47:16 +01:00
Harley Acheson
f2f43640b8 Merge branch 'blender-v4.4-release' 2025-02-06 11:17:20 -08:00
Harley Acheson
fd97a8f578 Fix #134166: Show Context Menus as "Options" on Status Bar
The Status Bar often shows context menu items as the name of that menu,
which is confusing in this context. For example in Object mode it shows
"Object" as the right-click operation. In Grease Pencil it shows this
as "Draw" even though you don't draw with it. In "Sculpt" mode you see
two items as "Sculpt", one on left click and the other on right click.
This PR makes all these show as "Options" instead. This seems like a
very succinct description of what is available on right-click.

Pull Request: https://projects.blender.org/blender/blender/pulls/134191
2025-02-06 20:15:44 +01:00
Hans Goudey
d216476458 Cleanup: Use StringRef for UI search menu code
Also use Vector to store menu search items instead of a linked
list. And extend the change into the autocomplete API slightly.
The main benefit is to avoid measuring the length of strings over
and over, but the code also gets simpler.
2025-02-05 18:27:44 -05:00
Hans Goudey
93ab2813a7 Cleanup: Remove unnecessary "using" statements 2025-02-05 18:27:43 -05:00
Guillermo Venegas
5a1e8de77b Fix: Pointer reseted to nullptr
The pointer is de-referenced few lines below

Pull Request: https://projects.blender.org/blender/blender/pulls/134154
2025-02-06 00:23:01 +01:00
Hans Goudey
190ea95ae6 Fix: Radial control operator crash after PointerRNA change
Caused by 45f231141d.

The non-trivial nature of `RadialControl` was hidden behind
C-style allocation. Now write the default values for `RadialControl`
explicitly since it isn't allocated by calloc anymore.
2025-02-05 13:54:11 -05:00
Bastien Montagne
45f231141d Core: Add info about chain of ancestors (owner data) of a PointerRNA.
The general idea is to store an array of (type, data) pointers of all
PointerRNA ancestors of the current one.

This will help solving cases in our code where the owner (or sometimes
even the owner of the owner) of a random PointerRNA needs to be
accessed. Current solution mainly relies on linear search from the owner
ID, which is sub-optimal at best, and may not even be possible in case a
same data is shared between different owners.

This lead to refactoring quite a bit of existing PointerRNA creation code.

At a high level (i.e. expected usages outside of RNA internals):
* Add `RNA_pointer_create_with_parent` and
  `RNA_pointer_create_id_subdata` to create RNA pointers with
  ancestors info.
* `RNA_id_pointer_create` and `RNA_main_pointer_create` remain
  unchanged, as they should never have ancestors currently.
* Add `RNA_pointer_create_from_ancestor` to re-create a RNA pointer
  from the nth ancestor of another PointerRNA.
* Add basic python API to access this new ancestors data.
* Update internal RNA/bpy code to handle ancestors generation in most
  common generic cases.
  - The most verbose change here is for collection code, as the owner of the
    collection property is now passed around, to allow collection items to get
    a valid ancestors chain.

Internally:
* `PointerRNA` now has an array of `AncestorPointerRNA` data to store
  the ancestors.
* `PointerRNA` now has constructors that take care of setting its data for
  most usual cases, including handling of the ancestor array data.
* Pointer type refining has been fully factorized into a small utils,
  `rna_pointer_refine`, that is now used from all code doing that operation.
* `rna_pointer_inherit_refine` has been replaced by
  `rna_pointer_create_with_ancestors` as the core function taking care of
  creating pointers with valid ancestors info.
  - Its usage outside of `rna_access` has been essentially reduced to custom
    collection lookup callbacks.

Implements #122431.

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

Some notes:
* The goal of this commit is _not_ to fully cover all cases creating
  PointerRNA that should also store the ancestors' chain info. It only
  tackles the most generic code paths (in bpyrna and RNA itself mainly).
  The remaining 'missing cases' can be tackle later, as needs be.
* Performances seem to be only marginally affected currently.
* Currently `AncestorPointerRNA` only stores PointerRNA-like data.
  This will help `StructPathFunc` callbacks to more efficiently generate
  an RNA paths when calling e.g. `RNA_path_from_ID_to_property`, but will
  not be enough info to build these paths without these callbacks. And some
  cases may still remain fuzzy. We'd have to add thinks like a `PropertyRNA`
  pointer, and for RNA collection ones, an index and string identifier, to store
  a complete unambiguous 'RNA path' info. This is probably not needed, nor
  worth the extra processing and memory footprint,  for now.

Pull Request: https://projects.blender.org/blender/blender/pulls/122427
2025-02-05 15:45:04 +01:00
Campbell Barton
613e34b559 Docs: cross reference progress enum for GHOST/WM API's
Note that these enums need to be kept in sync.
2025-02-05 21:53:52 +11:00
Campbell Barton
256f3cd52f Fix missing call to va_end(..)
Own regression in [0] replacing BLI_dynstr with BLI_vsprintfN.

[0]: 6fbe467021
2025-02-05 19:00:05 +11:00
Campbell Barton
e9de621159 Docs: improve doc-string for OPTYPE_REGISTER
Include another example where the REGISTER flag is set without UNDO.
2025-02-05 11:14:32 +11:00
Campbell Barton
4186175af8 Cleanup: improve code-comments & naming for window decoration styles
- Expand on the code-comment regarding tests & WM_capabilities_flag and
  move it from the caller into the functions body since this is useful
  for other callers, also mention in the doc-string.
- Use a common prefix for `WM_window_decoration_style_*` functions.
- Add a doxy-section for decoration style functions.
2025-02-05 10:56:54 +11:00
Campbell Barton
bc6dc89d50 Cleanup: quiet check_spelling_* warnings, use doxygen doc-strings 2025-02-05 10:29:00 +11:00
Jonas Holzman
ce42d92503 macOS: Colored Titlebar and WM Window Decoration Styles API - GSoC 2024
As part of the GSoC 2024 project "Improvements to the Blender macOS User
Interface Experience" [1], this patch implements colored titlebar window
decorations on macOS, based on the current Blender theme colors.

Additionally, this patch introduces a new WM/GHOST API for implementing
and enabling custom decoration styles on any system/desktop environment
that support customizing window decorations.

[1]: https://devtalk.blender.org/t/gsoc-2024-proposal-improvements-to-the-blender-macos-user-interface-experience/34022)

Pull Request: https://projects.blender.org/blender/blender/pulls/123982
2025-02-04 16:18:19 +01:00
Hans Goudey
73b25ba12e Cleanup: Use StringRef for some WM and UI APIs
Instead of const char * or StringRefNull.

Pull Request: https://projects.blender.org/blender/blender/pulls/134004
2025-02-04 13:53:30 +01:00
YimingWu
c4b4d62d96 Fix #129706: Guess keymap context from properties space
`WM_keymap_guess_from_context` did not handle properties space. This
simple fix made it respond the same way as if the current space is 3D
viewport, this enables brush asset sortcut assigning from tool
properties tab.

Pull Request: https://projects.blender.org/blender/blender/pulls/129717
2025-02-04 13:23:11 +01:00
Campbell Barton
007d46ef6d Cleanup: rename "opengl" to "gpu" for 3D viewport utilities 2025-02-04 21:19:28 +11:00
Pratik Borhade
dc90b65689 Fix #92406: Cannot set new hotkey to transfer sculpt mode
New shortcut assigned to operator goes inside "object mode" keymap
intead of `non-modal`. Now fixed with extra condition, since this
operator works in non-object modes. Reason it fails with "object
mode" keymap is the keymap->poll function `object_mode_poll`.

Pull Request: https://projects.blender.org/blender/blender/pulls/133796
2025-02-04 03:45:31 +01:00
Campbell Barton
b2dc852b1b Docs: note why operator "register" flag is set without "undo" 2025-02-02 15:25:34 +11:00
Campbell Barton
7f57f5c6d6 Unbreak build WITH_PYTHON=OFF
Also correct argument handling when Python arguments were passed in,
which were attempting to handle the following parameters as arguments
instead of skipping them.
2025-02-02 14:39:34 +11:00
Brecht Van Lommel
ae28102c3f Cleanup: Various clang-tidy warnings in windowmanager
Pull Request: https://projects.blender.org/blender/blender/pulls/133734
2025-01-31 17:03:17 +01:00
Hans Goudey
c2fd4eb9cc Cleanup: Deduplicate custom VectorSet identifier hash and equality
Add `CustomIDVectorSet` for this purpose.
Based on code from Jacques in #133778.

Pull Request: https://projects.blender.org/blender/blender/pulls/133821
2025-01-30 19:51:40 +01:00
Hans Goudey
ce5bdecf89 Refactor: Use VectorSet for panels, menus, gizmos, lists, operators
Previously, the global storage of these types either used a GHash or a
blender::Map. VectorSet is preferrable to GHash because it's type safe,
clearer, and faster. It's preferrable to Map because the key doesn't
have to be duplicated and because iteration is faster.

This PR moves these registered types to VectorSet, just like the
node, node socket, and node tree types. Note that none of these types
use RAII for allocation, so freeing is still done manually.

Testing was manually interacting with each of these systems, including
with addons that register their own types.

Pull Request: https://projects.blender.org/blender/blender/pulls/133778
2025-01-30 15:35:00 +01:00
Pratik Borhade
a1d31ca412 Core: Always Compress quit.blend file
Similar to !132685 / 2a85a27609, compress quit.blend that is generated
after closing blender.

Pull Request: https://projects.blender.org/blender/blender/pulls/133694
2025-01-30 11:43:13 +01:00
Pratik Borhade
2a85a27609 Fix #115697: Allow compression on auto-save files
After 0e8e219d71 / efb511a76d, memfile undo step is not used for writing
the autosave file, instead regular file saving function is used (`BLO_write_file`).
With that it is possible to compress the file when `G_FILE_COMPRESS`
flag is set.
As discussed in !132685, always compress auto-save .blend file
irrespective of `USER_FILECOMPRESS`

Pull Request: https://projects.blender.org/blender/blender/pulls/132685
2025-01-25 09:29:39 +01:00
Julian Eisel
f5b1a4625d UI: Allow drawing icons as drag previews, use for dragging assets
Instead of requiring an image buffer to draw a bigger preview image
while dragging, allow passing an icon ID and draw that as preview. This
is also how we draw previews elsewhere. Use this for attaching the asset
previews to draggable buttons.

A small user visible change is that previews from the asset browser will
always draw at the default size (multiplied by the interface scale)
while dragging. Previously it used the same size as the asset browser
preview size, which I don't think was useful really. With small sizes
the preview while dragging got unnecessarily small too, with big sizes
it got in the way.

Needed for #131871.
2025-01-24 22:32:27 +01:00
Bastien Montagne
9c237af041 Refactor: RNA: add discrete suffix to RNA_pointer_create.
This is a noisy preliminary step to the 'RNA ancestors' change. The
rename helps clearly tell what each `pointer_create` function does.

Pull Request: https://projects.blender.org/blender/blender/pulls/133475
2025-01-24 16:45:32 +01:00
Pratik Borhade
15e367f31a Fix #133434: No default tool for image editor view mode
Set sample tool as default for `view` mode of image editor.
Also expanded the condition in `toolsystem_key_ensure_check` so default
tool can be obtained inn view ui_mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/133471
2025-01-24 11:04:10 +01:00
Brecht Van Lommel
222d6b54cf Fix #112689: Copy image to clipboard doesn't use color management
Pull Request: https://projects.blender.org/blender/blender/pulls/133505
2025-01-23 21:41:16 +01:00
Brecht Van Lommel
426a9cdcbb Fix: Rendered animation player text too small on macOS 2025-01-23 13:32:50 +01:00
Brecht Van Lommel
e31077ca4c Fix #132148: Assert using rendered animation playback
Don't close file handle twice.
2025-01-22 15:52:09 +01:00
YimingWu
053d817a75 Fix (unreported): Assert when right clicking on image editor tools
When right clicking on any of the image editor tool buttons,
`WM_keymap_guess_from_context` would be called but lack of `space_type`
will cause `WM_keymap_find_all` to return `nullptr`. Assigning it to
`SPACE_IMAGE` fixes the issue.
2025-01-22 22:28:26 +08:00
Falk David
b9f253564e VSE: Python API: Deprecate sequence properties and replace with new ones
This PR adds new RNA properties that deprecate and replace any `sequence` property.
The old prooperties are still there and fully functional, but the description is changed
to indicate that these will be removed in the future and that the new properties should
be used instead.

| Deprecated property | Replacement property |
| --------------------------------- | ----------------------------------- |
| `context.active_sequence_strip` | `context.active_strip` |
| `context.selected_editable_sequences` | `context.selected_editable_strips` |
| `context.selected_sequences` | `context.selected_strips` |
| `context.sequences` | `context.strips` |
| `SequenceEditor.sequences` | `SequenceEditor.strips` |
| `SequenceEditor.sequences_all` |  `SequenceEditor.strips_all` |
| `MetaStrip.sequences` | `MetaStrip.strips` |

Previously, rna paths for animation data on strips started with `sequence_editor.sequences`.
This PRadds versioning for the rna paths to make sure to use
the new naming scheme. This does mean that in previous versions of blender,
the animations don't show but the data is not lost (even if the file is saved in the older version).

Also do some cleanup of existing python scripts inside the source to use the
new properties.

Part of #132963.

Pull Request: https://projects.blender.org/blender/blender/pulls/133156
2025-01-21 11:30:20 +01:00
Jonas Holzman
901119cf88 macOS: Main Window Title Improvements
Changes to the formatting of the OS window title for MacOS platform to
better follow their guidelines. Some refactoring, but there should be
no changes seen on other platforms.

Pull Request: https://projects.blender.org/blender/blender/pulls/132410
2025-01-21 03:17:50 +01:00
Jesse Yurkovich
3b08d8da22 Fix: Memory leak while clearing recent missing files
While the RecentFile struct itself was removed from the list of recent
files, the `filepath` field was not freed. Use the already existing
`wm_history_file_free` function to perform the cleanup.

Pull Request: https://projects.blender.org/blender/blender/pulls/133354
2025-01-21 02:11:02 +01:00
Eric Cosky
292b0c74d3 Fix #133239: Corrected inconsistent use of calloc/free vs new/delete to fix crash when disabling VR preview
Code at the XR actionmap level is using calloc/free, but later when
conditions trigger WM_operator_properties_alloc in
`windowmanager\intern\wm_operators.cc` it is using MEM_new, which is
the mismatch. XR actionmap code needed to be modified to be compatible
with the allocators it is using.

Pull Request: https://projects.blender.org/blender/blender/pulls/133274
2025-01-20 10:46:08 +01:00
Campbell Barton
d42b425ea9 Fix #131062: Active tool does not sync in Texture Painting workspace
Resolve an error where the brushes from the image/3D viewport
where shared but the tool was not. Causing the brush not to match
the appropriate tool when both an image & 3D viewport were displayed.

Resolve the issue by adding support for a "pending" tool,
a tool ID which is to be used.

This accounts for cases where it's not known if the requested tool
exists and uses the same code paths for initializing tools as is done
for initializing on file load for e.g.

Ref !133085
2025-01-20 11:21:33 +11:00
Harley Acheson
e8bc7ec68b Fix #83589: Remove Tooltips on Gizmo Mouse Down
Currently tooltips on gizmo parts can pop up while holding your mouse
down, unlike other UI elements. And they don't disappear until a few
pixels into a drag. This PR solves both by removing tooltips on mouse
down on a gizmo part.

Pull Request: https://projects.blender.org/blender/blender/pulls/132576
2025-01-17 22:44:21 +01:00
Campbell Barton
a586b537af Cleanup: various non-functional changes in C++ 2025-01-17 11:54:43 +11:00
Harley Acheson
1f33b401b3 Fix #49117: Larger Alternative for Frame Cursor
Internally our "Time" mouse cursor, it comprises up to four digits in
a 2x2 grid.  With each digit being just 7x7 pixels this is very small
on high DPI displays. This PR adds an alternative that shows 12x14
pixel digits, shown when the UI Scale > 1.45. It also changes both
small and large versions to not show a solid black background for
empty digit positions.

Pull Request: https://projects.blender.org/blender/blender/pulls/132767
2025-01-16 02:59:49 +01:00
jlalleve
2feadc623b Core: Environment variables for deployment
* BLENDER_SYSTEM_SCRIPTS support for multiple script paths, separated by
  ; on Windows and : on other platforms.
* New BLENDER_CUSTOM_SPLASH to replace the splash screen image.
* New BLENDER_CUSTOM_SPLASH_BANNER to overlay an image on the splash.

Contributed by Sony Interactive Entertainment: https://github.com/PlayStation-OpenSource
2025-01-14 20:57:31 +01:00
Jonas Holzman
0ee4ae89e4 UI: Capitalize default filenames from "untitled" to "Untitled"
Capitalize the default filename used for .blend files and other savable
and exportable file formats (like images, 3D formats, etc.) from
"untitled" to "Untitled".

Pull Request: https://projects.blender.org/blender/blender/pulls/132424
2025-01-13 20:06:27 +01:00
Damien Picard
49b45a95db I18n: Disambiguate "Space"
- "Space" can be the spacebar key. This uses the UIEvents context
  already. One instance is the event type enum item, where "Spacebar"
  is the label and "Space" is the description. Since there is no way
  to use contexts for descriptions since they are supposed to be more
  verbose, the label was renamed to "Space Bar" (acceptable according
  to Wikipedia), and the description to "Spacebar".
- In the context of the Grease Pencil, "Space" is a method of spacing
  brush strokes.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Damien Picard
54c0c5539a I18n: Disambiguate "Back"
- In the context of Grease Pencil, meaning "Overshoot".
- In the context of XR navigation, meaning "Going backwards".
  This introduces a "Navigation" context. Closest existing match is
  "View3D" but this is already used to refer to view axes.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00