Commit Graph

1848 Commits

Author SHA1 Message Date
Campbell Barton d5d1025e94 Cleanup: use const pointer arguments 2024-04-03 10:22:05 +11:00
Campbell Barton 7e5a712e58 Cleanup: remove redundant null pointer checks
Based on the surrounding context these checks aren't needed.
2024-04-01 22:20:09 +11:00
Harley Acheson 6dd0f6627e UI: Removal of Five Operator Confirmations
Removal of confirmation dialogs for the following five operators. For
each of these the UI module felt that they are all either very explicit
actions and/or are easily undone.
* ARMATURE_OT_separate (Move selected bones to a separate armature)
* CURVE_OT_separate - “Move selected points to a new object”
* OBJECT_OT_vertex_parent_set (Parent selected ob to selected vertices)
* OBJECT_OT_parent_no_inverse_set (Make Parent w/o inverse correction)
* FILE_OT_directory_new - (Create New Directory)

Pull Request: https://projects.blender.org/blender/blender/pulls/120036
2024-03-29 01:09:15 +01:00
Campbell Barton da49873e89 Fix buffer overflow with BLI_str_format_uint64_grouped
Caused by cd4328dd82.
2024-03-28 11:40:23 +11:00
Hans Goudey 8b514bccd1 Cleanup: Move remaining GPU headers to C++
Pull Request: https://projects.blender.org/blender/blender/pulls/119807
2024-03-23 01:24:18 +01:00
Harley Acheson d0eacbd6ba Merge branch 'blender-v4.1-release' 2024-03-20 09:07:40 -07:00
Harley Acheson afbd733047 Fix #119635: File Browser Horizontal Display Never Compact
File Browser listings can clip content, remove columns, etc as the
available space narrows. This PR just makes this never happen for
the horizontal display mode, where files are shown in multiple columns,
as this is not applicable.

Pull Request: https://projects.blender.org/blender/blender/pulls/119673
2024-03-20 17:06:38 +01:00
Harley Acheson 061a9ee885 UI: Add Optional Flags for Tooltip Image Fields
Add more flexibility to tooltip images by adding the ability to specify
if (one of two) checkerboards are added, border, premultiplied
blending, or recoloring.

Pull Request: https://projects.blender.org/blender/blender/pulls/119437
2024-03-18 22:17:45 +01:00
Julian Eisel 0d7ac2542e Merge branch 'blender-v4.1-release' 2024-03-18 19:37:56 +01:00
Julian Eisel 745fd2a2cb Fix: Tree-view items always collapsed by default
Since 660867fa00, having tree-view items uncollapsed by default using
the `set_collapsed()` functions wouldn't work anymore. An attempt to do
this would assert even, so eb71d9f7bc disabled the assert.

I think a function designed to handle exactly this is the best solution,
it makes the intent & behavior more clear than before, and highlights
that this is a special case.

Mitigates #117957, in that it solves the regression, but tree-views still
don't remember their state on screen-layout changes. This is a known
limitation and not supported.

Pull Request: https://projects.blender.org/blender/blender/pulls/119166
2024-03-18 19:32:53 +01:00
Brecht Van Lommel 7a395e2e7f Revert changes from main commits that were merged into blender-v4.1-release
The last good commit was f57e4c5b98.

After this one more fix was committed, this one is preserved as well:
67bd678887.
2024-03-18 15:04:12 +01:00
Harley Acheson 08cd80a284 Fix #118066: File Browser List View Tooltips
In File Browser list view show tooltips for both the icon and the name
portion of the line to consistently show them no matter where you hover

Pull Request: https://projects.blender.org/blender/blender/pulls/118071
2024-03-14 20:20:50 +01:00
Harley Acheson bc70b597fc UI: Use New Internet Icon
We recently added a new "Internet" icon, meant to represent internet
services and protocols generally, in contrast with the existing "url"
icon which can be seen as being http (web link) specifically.  This
PR just uses this icon for cloud storage uses and for remote extension
repository.

Pull Request: https://projects.blender.org/blender/blender/pulls/119409
2024-03-13 02:39:36 +01:00
Harley Acheson 443ea628c5 UI: Changes to Small Operator Confirmations
Small operator confirmations get separate confirm and cancel buttons,
better descriptions and configurable confirm button text. But still
popup at cursor location and can be cancelled with mouse movement.

Pull Request: https://projects.blender.org/blender/blender/pulls/118346
2024-03-12 23:12:45 +01:00
Hans Goudey 8b014b34aa Cleanup: Move some asset browser code to proper namespace
Also remove an unnecessary C wrapper of a C++ class.
2024-03-07 16:23:35 -05:00
Hans Goudey 840307c59a Fix: Build error on MSVC after recent cleanup, make format
captured structured bindings are a C++20 extension [-Wc++20-extensions]
2024-03-01 14:54:01 -05:00
Hans Goudey d29ce3d531 UI: Remove uiBut a1 and a2 values
Over the last couple years (!) UI buttons have moved to derived classes,
meaning we don't need to use the same "a1" and "a2" variables to store
different information. At this point, that information is set specifically
by internal UI code, or functions like `UI_but_*_set`.

These values are only set to their default 0 values now (or -1 in some
non-meaningful cases). This commit removes the values from buttons
and removes the remaining a1 and a2 arguments from the UI API.
2024-03-01 14:27:57 -05:00
Hans Goudey 365966d51d Cleanup: UI: Use derived struct for label buttons, remove a1, a2 usage 2024-03-01 14:27:56 -05:00
Julian Eisel 4cc1c65272 Refactor: Make asset catalog service non-public, access through API
Making the member private (or at least protected) makes threat safety
more tangible, and we don't need to expose locking in the API. Generally
we need to make data more encapsulated, so we can make edits more
controlled and threat safe.

Asset libraries also always have a catalog-service, so it can accessed
by reference, rather than pointer that would have to be null-checked.
2024-02-29 17:12:08 +01:00
Julian Eisel 2bfaf94fa7 Refactor: Lazy create & update asset catalog trees
Rebuilding the tree immediately after changes could cause the tree to be
rebuilt multiple times. More importantly, it made it harder to reason
about thread safety, since we would touch the tree within a whole bunch
of API functions. Now tree building is simplified and managed in a
single place, so making the tree building thread safe can be made
trivially in a follow-up.

Note, this means the initial catalog tree building doesn't happen in a
background thread together with loading the asset library and catalogs
anymore. But we would already do all further rebuilds on the main thread
anyway, this shouldn't have any notable impact.
2024-02-26 10:35:15 +01:00
Julian Eisel 57dfc2a885 Cleanup: Make catalog tree const-correct
Basic motivation is that `AssetCatalogService::get_catalog_tree()`
should return a const tree, since this tree is internal state and
shouldn't be modified from outside. This exposed a whole bunch of const
incorrectnesses and just generally allows to make much more of the API
const (as it should be).

Also use references instead of pointers in testing functions, where null
is not an expected value.
2024-02-23 18:13:10 +01:00
Sebastian Parborg 8aed44471e Merge branch 'blender-v4.1-release' 2024-02-22 14:28:04 +01:00
Sebastian Parborg b5c8505f5a Fix: Always print warnings when file/folder renaming fails
Rewrite the code so that users get an error message when trying to
rename something to an existing file in the file browser. Before this
change Blender would not print any notifications on why the rename
failed if a file with the same name already existed.

Pull Request: https://projects.blender.org/blender/blender/pulls/118571
2024-02-22 14:24:33 +01:00
Julian Eisel 99673edd85 Cleanup: Add method to get UUID as std::string
Avoids having to use the C-style `BLI_uuid_format()` function with
manual buffer management, and makes it easy to get a `std::string` from
a UUID.
2024-02-20 15:20:11 +01:00
Brecht Van Lommel 0f2064bc3b Revert changes from main commits that were merged into blender-v4.1-release
The last good commit was 4bf6a2e564.
2024-02-19 15:59:59 +01:00
Hans Goudey 921ce2fae8 Cleanup: Consistent use of "this" keyword in asset code
Follow the style guide for using `this->` to access non-private variables.
2024-02-16 11:01:17 -05:00
Hans Goudey c4d0e88e6e Fix: Asset browser crash after recent cleanup
After 57586df687. Turns out the library can be null here.
2024-02-14 17:41:17 -05:00
Hans Goudey 57586df687 Cleanup: Remove unnecessary asset system functions
These functions appear to be thin wrappers around the C++ classes
that previously weren't accessible in C code.
2024-02-14 17:23:01 -05:00
Bastien Montagne 5baef63a20 BKE ID remap: Refactor: Remove C API around CPP `IDRemapper`.
The ID remapper code was already largely defined in a CPP struct
(IDRemapper). Make this an actual class, and remove the C API wrapper
around.

This makes the code cleaner, easier to follow, and easier to extend or
modify in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/118146
2024-02-13 15:36:38 +01:00
Campbell Barton b372ebae68 Cleanup: unused headers for source/blender/editors
Remove 1317 includes from editors.
2024-02-13 10:02:53 +11:00
Campbell Barton 22b382fc84 Cleanup: replace PATH_MAX with FILE_MAX_LIBEXTRA for file drawing 2024-02-13 09:43:04 +11:00
Bastien Montagne 29fe777445 Cleanup: Make `BKE_report.h` a full Cpp header. 2024-02-10 18:34:29 +01:00
Bastien Montagne 54618dbae3 Cleanup: Make `BKE_global.h` a Cpp header. 2024-02-10 18:25:14 +01:00
Bastien Montagne 45e7827898 Clenup: Move BLT headers to Cpp.
Noisy but fairly straight forward.
2024-02-09 18:59:42 +01:00
Hans Goudey 91e54fdd83 Cleanup: Move BLO_readfile.h to C++
I added a new BLO_userdef_default.h header to contain declarations of
two global variables that are still defined in C files. Use of designated
initializers for large structs make those files harder to change.
Arguably this is a better header for them anyway.

Pull Request: https://projects.blender.org/blender/blender/pulls/118015
2024-02-09 13:41:30 +01:00
Hans Goudey df8c85d3f9 Cleanup: UI Remove more unnecessary a1 and a2 parameters
Similar to 5155feeeb8. These had values without any meeting,
almost completely just 0 or -1 (which meant "find good values if possible"
anyway).
2024-02-05 14:38:11 -05:00
Jacques Lucke 442429a97c BLI: support formatting StringRef with the fmt library
People were manually converting it to `std::string_view` in many places already.
It's easy enough to allow using `StringRef` directly by providing a `format_as` function.

Also see https://fmt.dev/latest/api.html#udt.

Pull Request: https://projects.blender.org/blender/blender/pulls/117788
2024-02-03 19:14:51 +01:00
Ray Molenkamp fc409e4388 Cleanup: CMake: Modernize extern_fmtlib dependencies
Pretty straightforward

- Remove any fmtlib paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/117787
2024-02-03 18:55:09 +01:00
Hans Goudey f78d3a807a Cleanup: Store space types in vector of unique_ptr
- Use unique_ptr instead of raw pointers
- Use Vector instead of a linked list
- Use a destructor instead of a free function
- Remove the space type template-- it's much clearer to copy functional code

Pull Request: https://projects.blender.org/blender/blender/pulls/117766
2024-02-02 20:59:20 +01:00
Hans Goudey 266230dd88 Refactor: UI: Pass StringRef to more button definition functions
Similar to 9c3aa8b824. This time there is one null argument
that has to be changed. It was simple to just move the logic to that one
caller.
2024-02-01 14:40:40 -05:00
Hans Goudey 7fa5fc02b7 Cleanup: Move BLF headers to C++ 2024-01-31 14:04:56 -05:00
Hans Goudey 13d280b8d8 Cleanup: Rename function to ensure button operator properties
For some reason the "get" function actually allocates the button's
operator properties container. This may or may not make sense to
do, but while it happens, the function name might as well make
that clear.
2024-01-29 16:33:12 -05:00
Hans Goudey fb0d6198c0 Cleanup: Move remaining asset editors code to C++ namespace 2024-01-26 18:43:13 -05:00
Hans Goudey 2043df4816 Cleanup: Remove unnecessary AssetLibrary C wrapper type 2024-01-26 18:15:41 -05:00
Hans Goudey f08ce0a8ed Cleanup: Move AS_asset_library.h contents to C++ header 2024-01-26 18:15:41 -05:00
Hans Goudey 0e6aad4742 Cleanup: Remove remaining asset editor headers to C++ 2024-01-26 18:15:40 -05:00
Hans Goudey 1bb358f423 Fix: Tooltip memory leak
Use std::string for custom tooltip function return value.
2024-01-26 14:39:05 -05:00
Brecht Van Lommel e0ff7731e0 Core: make BKE_appdir functions thread safe, using optional<string>
The static variables can cause the wrong path to be used, for example
when asset indexing in a thread affects loading toolbar icons.

Fix #117416: toolbar icon randomly missing

Pull Request: https://projects.blender.org/blender/blender/pulls/117419
2024-01-23 18:38:15 +01:00
Hans Goudey 0618de49ad Cleanup: Replace MIN/MAX macros with C++ functions
Use `std::min` and `std::max` instead. Though keep MIN2 and MAX2
just for C code that hasn't been moved to C++ yet.

Pull Request: https://projects.blender.org/blender/blender/pulls/117384
2024-01-22 15:58:18 +01:00
Bastien Montagne d8d44a62f7 Cleanup: Move `BKE_appdir.h` to full Cpp header `BKE_appdir.hh`. 2024-01-21 19:42:13 +01:00