Commit Graph

66 Commits

Author SHA1 Message Date
Harley Acheson
63f56fee91 Merge branch 'blender-v4.0-release' 2023-10-11 10:28:13 -07:00
Harley Acheson
d6a6c3e1fc UI: Highlight Selected Item in View3D Mode Menu
Allow the View3D "Mode" menu to highlight the currently-selected mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/112058
2023-10-11 19:27:02 +02:00
Harley Acheson
e00bd55576 Merge branch 'blender-v4.0-release' 2023-10-11 08:26:58 -07:00
Harley Acheson
aa88d9a8e3 Revert "UI: Input Placeholders"
This reverts commit b0515e34f9.
Unintentionally added to 4.0
2023-10-11 08:01:24 -07:00
Harley Acheson
61dc86b0eb Merge branch 'blender-v4.0-release' 2023-10-10 15:48:29 -07:00
Harley Acheson
b0515e34f9 UI: Input Placeholders
Optional inline hint describing the expected value of an input field.

Pull Request: https://projects.blender.org/blender/blender/pulls/112104
2023-10-11 00:47:13 +02:00
Jacques Lucke
663aa3538d UI: allocate panel runtime data separately
This results in better separation for what is stored in .blend files and what is not.
Also allows us to potentially use C++ in panel run-time data.

Pull Request: https://projects.blender.org/blender/blender/pulls/113502
2023-10-10 18:17:31 +02:00
Harley Acheson
35d3d52508 UI: Search All Menus with Space Bar
Allow initiating the search of any named menu by pressing space bar.

Pull Request: https://projects.blender.org/blender/blender/pulls/113299
2023-10-09 16:56:16 +02:00
Julian Eisel
e3d4cf9b3d UI: Allow popover panels to register own notifier listeners
This is necessary to let popovers redraw when asynchronously loading
data. For example to display assets or asset catalogs as they get
loaded. Needed for the asset shelf catalog selector popover. Menus
already do the same to allow populating the menu with assets as they get
loaded.
2023-09-27 11:31:21 +02:00
Hans Goudey
916d4c9d9b Cleanup: Move BKE_screen.h to C++
See #103343
2023-09-25 17:53:11 -04:00
Campbell Barton
e38ff7c06d Cleanup: use C++ comments for disabled code 2023-09-25 17:06:04 +10:00
Campbell Barton
fb5629adb3 Cleanup: reduce right shift in ui_litem_layout_radial 2023-09-21 20:15:09 +10:00
Campbell Barton
70dff0670b Fix #112610: Nested pie menu items can't be selected
Regression in [0] caused pie menus that contain layouts with buttons
not to be selectable.

[0]: a8db828618
2023-09-20 17:29:06 +10:00
Campbell Barton
b3f9663011 Cleanup: use a mask combining all pie menu directions
Avoid looping over buttons to check which directions are in use.
2023-09-14 16:10:36 +10:00
Thomas Barlow
6dd3c90185 UI: Change menu icons of single-choice enums to radio buttons
Show radio buttons for enum list items that are not multi-select (not
PROP_ENUM_FLAG).

Pull Request: https://projects.blender.org/blender/blender/pulls/111796
2023-09-13 19:24:16 +02:00
Jacques Lucke
7f9d51853c UI: support searching in menus
The basic idea is very simple. Whenever a supported menu is open, one can just
start typing and this opens a search that contains all the (nested) menu entries.

The main downside is that this collides with accelerator keys. Those are the
underlined characters in each menu. For now, we just enable this new searching
behavior in a few selected menus: Node Add Menu, View3D Add Menu and
Modifier Add Menu.

This new functionality can be enabled for a menu by setting
`bl_options = {'SEARCH_ON_KEY_PRESS'}` to true in the menu type.

The status bar shows `Type to search...` when a menu is opened that supports search.

Pull Request: https://projects.blender.org/blender/blender/pulls/110855
2023-09-06 18:16:45 +02: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
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
Harley Acheson
2dc1dcc43e UI: Slight reduction and centering of UI_BTYPE_SEPR_LINE
A small reduction in the vertical space used by the menu separating
rule. Also centers the line within its space. Looks more balanced when
used between titles and content.

Pull Request: https://projects.blender.org/blender/blender/pulls/111764
2023-09-01 17:12:48 +02:00
Harley Acheson
b122faf705 UI: Consistent Menu/Block/Popup Content Ordering
All Content is shown in natural top-down order regardless of where it
is initiated.

Pull Request: https://projects.blender.org/blender/blender/pulls/109798
2023-08-31 20:24:53 +02:00
Hans Goudey
ceb3d75c18 Cleanup: Use const for context store variables
Generally the context store is owned by `uiBlock`. Other pointers
to the store (in `bContext` and other operator data) shouldn't change
it, so those variables are now const. One exception is the pointer in
`uiLayout`, but that has a clearly short lifetime, so that's okay.
2023-08-31 12:00:04 -04:00
Hans Goudey
1763a46cbf Cleanup: UI: Store uiBlock context stores in vector instead of list
Also fix an issue where contest stores were copied with the "used"
flag set after 7d7e90ca68.
2023-08-31 12:00:04 -04:00
Sybren A. Stüvel
998136f7a7 Anim: replace Bone Groups & Armature Layers with Bone Collections
Armature layers (the 32 little dots) and bone groups are replaced with
Bone Collections:

- Bone collections are stored on the armature, and have a name that is
  unique within that armature.
- An armature can have an arbitrary number of bone collections (instead
  of the fixed 32 layers).
- Bones can be assigned to zero or more bone collections.
- Bone collections have a visibility setting, just like objects in scene
  collections.
- When a bone is in at least one collection, and all its collections in
  are hidden, the bone is hidden. In other cases (in any visible
  collection, or in no collection at all), the bone visibility is
  determined by its own 'hidden' flag.
- For now, bone collections cannot be nested; they are a flat list just
  like bone groups were. Nestability of bone collections is intended to
  be implemented in a later 4.x release.
- Since bone collections are defined on the armature, they can be used
  from both pose mode and edit mode.

Versioning converts bone groups and armature layers to new bone
collections. Layers that do not contain any bones are skipped. The old
data structures remain in DNA and are unaltered, for limited forward
compatibility. That way at least a save with Blender 4.0 will not
immediately erase the bone group and armature layers and their bone
assignments.

Shortcuts:

- M/Shift+M in pose/edit mode: move to collection (M) and add to
  collection (shift+M). This works similar to the M/Shift+M menus for
  objects & scene collections.
- Ctrl+G in pose mode shows a port of the old 'bone groups' menu. This
  is likely to be removed in the near future, as the functionality
  overlaps with the M/Shift+M menus.

This is the first commit of a series; the bone collections feature will
be improved before the Blender 4.0 release. See #108941 for more info.

Pull request: https://projects.blender.org/blender/blender/pulls/109976
2023-08-29 14:31:18 +02:00
Campbell Barton
e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00
Campbell Barton
86c4ce66af Cleanup: pass ICON_NONE instead of zero to UI functions 2023-08-12 16:29:49 +10:00
Hans Goudey
f0467b4615 Cleanup: Return std::string from operator name and description callbacks
With the end goal of simplifying ownership and memory management,
and allowing the use of `get_name` in contexts without statically
allocated strings, use `std::string` for the return values of these two
operator type callbacks instead of `const char *` and `char *`.

In the meantime things get uglier in some places. I'd expect `std::string`
to be used more in the future elsewhere in Blender though.

Pull Request: https://projects.blender.org/blender/blender/pulls/110823
2023-08-11 19:11:27 +02:00
Jacques Lucke
cc4d5c432c RNA: move headers to C++
Also see #103343.

Pull Request: https://projects.blender.org/blender/blender/pulls/111022
2023-08-10 22:40:27 +02:00
Aras Pranckevicius
d973355b3a Cleanup: reduce amount of math-related includes
Using ClangBuildAnalyzer on the whole Blender build, it was pointing
out that BLI_math.h is the heaviest "header hub" (i.e. non tiny file
that is included a lot).

However, there's very little (actually zero) source files in Blender
that need "all the math" (base, colors, vectors, matrices,
quaternions, intersection, interpolation, statistics, solvers and
time). A common use case is source files needing just vectors, or
just vectors & matrices, or just colors etc. Actually, 181 files
were including the whole math thing without needing it at all.

This change removes BLI_math.h completely, and instead in all the
places that need it, includes BLI_math_vector.h or BLI_math_color.h
and so on.

Change from that:
- BLI_math_color.h was included 1399 times -> now 408 (took 114.0sec
  to parse -> now 36.3sec)
- BLI_simd.h 1403 -> 418 (109.7sec -> 34.9sec).

Full rebuild of Blender (Apple M1, Xcode, RelWithDebInfo) is not
affected much (342sec -> 334sec). Most of benefit would be when
someone's changing BLI_simd.h or BLI_math_color.h or similar files,
that now there's 3x fewer files result in a recompile.

Pull Request #110944
2023-08-10 14:51:40 +03:00
Hans Goudey
ffe4fbe832 Cleanup: Move editors headers to C++
See #103343

Pull Request: https://projects.blender.org/blender/blender/pulls/110820
2023-08-05 02:57:52 +02:00
Hans Goudey
bc8c892c65 Cleanup: Move WM headers to C++
Also move a few more headers that included WM headers.

Pull Request: https://projects.blender.org/blender/blender/pulls/110815
2023-08-04 23:11:22 +02:00
Campbell Barton
adf58a77ff Cleanup: use LISTBASE_FOREACH & LISTBASE_FOREACH_BACKWARD macros 2023-08-04 08:51:13 +10:00
Campbell Barton
52acf6a6ec Cleanup: correct file names in comments after C -> C++ renaming
Use back-tick quotes to differentiate these from plain text.
2023-07-31 13:02:30 +10:00
Campbell Barton
fd0977284b Cleanup: simplify typedefs
Also remove unused `buffer_struct`.
2023-07-30 16:14:09 +10:00
Campbell Barton
cfffd813c1 Cleanup: use typed enum for UI_ITEM_* flags
Using an int lead to confusion with other flags often used with buttons.
For e.g. these flags could be easily confused with uiItem::flag.
2023-07-29 15:32:45 +10:00
Campbell Barton
acbf16d91a Cleanup: correct invalid flag types
- wmOperatorCallContext was used to store UI_ITEM_* flags.
- Collada export use passed invalid UI_ITEM_* flag as an argument.
2023-07-29 14:52:47 +10:00
Campbell Barton
98f848dc4b Cleanup: use typed flag for uiItem::flag 2023-07-29 14:48:13 +10:00
Julian Eisel
9d0907560a UI: Refactor quick label tooltip implementation for buttons
No user visible changes expected. Used in the asset shelf branch,
see #104831.

These tooltips only show a label string and appear after a shorter timeout
than the regular tooltips. After the regular tooltip timeout they expand to
the full tooltip. The toolbar and properties editor navigation tabs make use
of this already.

The changes here enable more control over quick label tooltips, making them
usable in more cases, and less ad-hoc. Main changes:
- Refactors internal logic so a single `UI_BUT_HAS_TOOLTIP_LABEL` button flag
  can be used to enable quick label tooltips. This decentralizes logic in a
  way that's more consistent and extensible.
- Custom callback to return a quick label. This is useful when a label tooltip
  should be displayed even when there is no button string set. E.g. in the
  asset shelf with "Show Names" disabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/110200
2023-07-25 16:22:31 +02:00
Campbell Barton
68fbdda77f UI: remove recently added PIE progress display type
PIE was too similar to RING, as there is no need for two similar display
styles - make only one available.

Removal based on replies to !109882.
2023-07-15 16:14:10 +10:00
Jacques Lucke
3f33e0c6cd Cleanup: clang format in disabled code segments
This formats code that is disabled using `#if 0`. Formatting was achieved
by temporarily changing `#if 0` to `#if 1 /*something*/`, then formatting,
and then changing it back to `#if 0`.
2023-07-12 14:18:59 +02:00
Harley Acheson
c6adafd8ef UI: add progress indicator variations & RNA API
Add pie and ring styles of progress indicators. Exposes progress bar to
the Python API and adds a "type" property to allow style variation.

This can be used for scripts & add-ons to show progress in the UI.

Ref !109882.

Co-authored-by: Campbell Barton <campbell@blender.org>
2023-07-12 14:00:39 +10:00
Hans Goudey
0b71a1f054 Cleanup: Move UI RNA files to C++
See #103343

Pull Request: https://projects.blender.org/blender/blender/pulls/109090
2023-06-18 01:39:21 +02:00
Brecht Van Lommel
bca3839749 Revert "Cleanup: consistently use rnaindex -1 to mean the no or entire array"
This reverts commit 8ed65fe6de.

Fix #108553: Alt + value change doesn't work for various inputs
Fix #108621: Driven values are no longer marked in purple
2023-06-06 11:34:22 +02:00
Sergey Sharybin
c1bc70b711 Cleanup: Add a copyright notice to files and use SPDX format
A lot of files were missing copyright field in the header and
the Blender Foundation contributed to them in a sense of bug
fixing and general maintenance.

This change makes it explicit that those files are at least
partially copyrighted by the Blender Foundation.

Note that this does not make it so the Blender Foundation is
the only holder of the copyright in those files, and developers
who do not have a signed contract with the foundation still
hold the copyright as well.

Another aspect of this change is using SPDX format for the
header. We already used it for the license specification,
and now we state it for the copyright as well, following the
FAQ:

    https://reuse.software/faq/
2023-05-31 16:19:06 +02:00
Campbell Barton
8ed65fe6de Cleanup: consistently use rnaindex -1 to mean the no or entire array
Re-apply [0] with the assert on startup resolved & doc-string updated.

[0]: 9ad7ad4323.
2023-05-27 19:36:16 +10:00
Campbell Barton
9ad7ad4323 Revert "Cleanup: consistenly use rnaindex -1 to mean the no or entire array"
This reverts commit 9a9209d8e0.

This commit caused an assert on factory startup,
needs further investigation.
2023-05-27 16:00:31 +10:00
Brecht Van Lommel
9a9209d8e0 Cleanup: consistenly use rnaindex -1 to mean the no or entire array 2023-05-26 21:33:37 +02:00
Campbell Barton
13c815085b Cleanup: spelling in comments 2023-05-24 11:21:18 +10:00
Campbell Barton
3958ae7241 Cleanup: use STRNCPY, SNPRINTF macros 2023-05-09 14:08:19 +10:00
Campbell Barton
42d3df25f3 Cleanup: pass a const context to menu UI funcitons 2023-05-05 00:19:31 +10:00
Campbell Barton
6859bb6e67 Cleanup: format (with BraceWrapping::AfterControlStatement "MultiLine") 2023-05-02 09:37:49 +10:00