Commit Graph

81 Commits

Author SHA1 Message Date
Harley Acheson
639272ef77 Fix #100784: Truncate Text with Ellipsis inside Number Inputs
When a property name is shown inside of a numerical input, truncate
with ellipsis if it cannot fit.

Pull Request: https://projects.blender.org/blender/blender/pulls/115958
2023-12-08 23:40:09 +01:00
Harley Acheson
0fbc3e956f Fix #115601: Clamp Color Picker Vertical Value Slider Position
The position of the vertical value slider has to be clamped to be
within the area of that slider, otherwise it can draw outside the
range when a value is over 1.

Pull Request: https://projects.blender.org/blender/blender/pulls/115680
2023-12-01 20:01:22 +01:00
Campbell Barton
27c660707d Cleanup: spelling in comments, variables 2023-11-27 09:54:36 +11:00
Leon Schittek
42ddc13033 Fix #95709: Improve pulldown menu corner rounding
Improve corner rounding of menus and popup blocks.

Pull Request: https://projects.blender.org/blender/blender/pulls/111554
2023-11-24 23:55:43 +01:00
Leon Schittek
0335b6a3b7 UI: Improve menu dropshadow
Improvements to the drawing of shadows, used with blocks, menus, nodes,
etc. Improvements to shape, especially at the top corner or at extremes
of widget roundness. Allows transparent objects to have shadows. This
is a nice refactor that removes a lot of code.

Pull Request: https://projects.blender.org/blender/blender/pulls/111794
2023-11-24 22:50:20 +01:00
Harley Acheson
c11d5b4180 UI: Color Picker Position Indication
Changes to how the current positions in the color picker are shown.

Pull Request: https://projects.blender.org/blender/blender/pulls/113753
2023-11-17 19:18:28 +01:00
Hans Goudey
3d57bc4397 Cleanup: Move several blenkernel headers to C++
Mostly focus on areas where we're already using C++ features,
where combining C and C++ APIs is getting in the way.

Pull Request: https://projects.blender.org/blender/blender/pulls/114972
2023-11-16 11:41:55 +01:00
Campbell Barton
611930e5a8 Cleanup: use std::min/max instead of MIN2/MAX2 macros 2023-11-07 16:33:19 +11:00
Julian Eisel
72a8851a95 UI Code Quality: Rename UI_ACTIVE button flag to UI_HOVER
Calling this state "active" has been confusing for a long time for a number of reasons:
- It's not clear that this is essentially a mouse hover state.
- Easy to confuse with "select" state (`UI_SELECT`), both terms are vague.
- Buttons can be "inactive" (`UI_BUT_INACTIVE`) which is totally related to this "active" state.
- Button handling can consider a button as active that doesn't have this flag set (e.g. during text input).
- Active and selected are well established terms in Blender, but they mean a different thing there.

See #112160.

Pull Request: https://projects.blender.org/blender/blender/pulls/114113
2023-10-25 18:36:27 +02:00
Harley Acheson
d0e6f894fe Merge branch 'blender-v4.0-release' 2023-10-16 10:18:41 -07:00
Harley Acheson
ffe980afad Fix #113766: Incorrect Cursor With Offset Position
Next character left edge position incorrect when string has
an offset positioning (scrolled within the input box).

Pull Request: https://projects.blender.org/blender/blender/pulls/113784
2023-10-16 19:17:28 +02:00
Harley Acheson
d578170131 Cleanup: Make format
Format changes resulting from Make Format
2023-10-15 09:09:30 -07:00
Harley Acheson
03655189d7 Fix #113735: Space Characters in UI Text Entry #113749
With #113707 text cursor position is set using the character's visible
bounds, so special care is needed for those without bounds like space.
Forgot this also applies to 4.0.
2023-10-15 09:06:44 -07:00
Harley Acheson
b6131cc338 Cleanup: Make format
Formatting changes resulting from Make Format
2023-10-15 08:45:11 -07:00
Harley Acheson
c6c86b555d Fix #113735: Space Characters in UI Text Entry
With #113707 text cursor position is set using the character's visible
bounds, so special care is needed for those without bounds like space.

Pull Request: https://projects.blender.org/blender/blender/pulls/113749
2023-10-15 17:42:28 +02:00
Harley Acheson
13de143ba8 Merge branch 'blender-v4.0-release' 2023-10-14 12:00:08 -07:00
Harley Acheson
b772603843 Fix #113682: Improved Text Caret Position
For regular UI text entry, place the text caret exactly between
adjacent glyph bounds instead of just using partial text length to
position it.

Pull Request: https://projects.blender.org/blender/blender/pulls/113707
2023-10-14 20:58:50 +02:00
Campbell Barton
2e0b844b36 Cleanup: spelling in comments 2023-10-14 13:53:00 +11:00
Julian Eisel
14d6891efe Merge branch 'blender-v4.0-release' 2023-10-13 19:05:13 +02:00
Leon Schittek
7017a9880e Fix: UI: Scale list item highlight with zoom
Fix the row highlight in list views not scaling properly by taking
the zoom into account.

Pull Request: https://projects.blender.org/blender/blender/pulls/113645
2023-10-13 19:04:42 +02:00
Harley Acheson
f7a8536112 Merge branch 'blender-v4.0-release' 2023-10-13 08:36:19 -07:00
Harley Acheson
a9dc7a4719 Cleanup: Comment for Assert in UI_text_clip_middle_ex
Just an added detailed comment for the reason for the assert in
UI_text_clip_middle_ex and why it has wriggle room.
2023-10-13 08:35:04 -07:00
Harley Acheson
4320f1a217 Merge branch 'blender-v4.0-release' 2023-10-12 11:56:24 -07:00
Harley Acheson
1c4b2ad17f Fix #113352: UI: Round Pen When Subpixel AA is Off
Testing to see if rounding the advancing pen seems to give slightly
nicer spacing when subpixel anti-aliasing is turned off.

Pull Request: https://projects.blender.org/blender/blender/pulls/113399
2023-10-12 20:54:54 +02:00
Harley Acheson
3c4f84e0fc UI: Input Placeholders
Optional inline hint describing the expected value of an input field.

Pull Request: #112104
2023-10-12 11:44:08 -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
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
Pratik Borhade
b5ebf31fb1 Fix #113022: Disabled menu item's text uses inner color
This fails to differentiate between active buttons and disabled buttons
for some custom themes (and also in blender light theme)

Instead use text color with 0.5 alpha value for disabled item's text.
(Don't blend between text and inner color)

Pull Request: https://projects.blender.org/blender/blender/pulls/113082
2023-10-06 12:54:14 +02:00
Campbell Barton
b4d3bd134b Cleanup: quiet ASAN warning with invalid value for eButGradientType
-1 was assigned to eButGradientType which isn't a valid value,
add UI_GRAD_NONE to resolve this.
2023-09-27 14:28:47 +10:00
Julian Eisel
427bdc8dcf UI: Remove dead space between tree view items
Part of #107742.

There used to be a small margin between items since the layout feels a
bit crammed otherwise. But this meant the mouse could be between items,
with no item highlighted or reacting to interactions. This was
especially annoying when dragging over items for drag and drop: in
between items dropping wasn't possible, and the drag-tooltip would
disappear, causing notable flickering during motions over the tree view.

The view item is now slightly enlarged to keep a look that is not too
crammed, and still remove the space between items. Item highlights are
still drawn with a smaller height (matching the normal widget height),
since anything else looked odd to me.

This now feels quite consistent with similar UIs (e.g. File Browser list
view or the Outliner), even though we give the items a bit more space.
2023-09-22 17:34:11 +02:00
Leon Schittek
0edd60b4c7 Fix: UI: Don't show padding buttons in menus
Padding buttons are supposed to be invisible but were drawn like
regular menu items.

For the most part it doesn't make a difference, since most themes
use transparent menu items anyway.
But e.g. the "White" theme is using opaque menu items, which
would causes the padding button to overlap at the corner when
the roundness of the menu background is very high.

Pull Request: https://projects.blender.org/blender/blender/pulls/112731
2023-09-22 17:19:33 +02:00
Harley Acheson
a0b4ead737 BLF: Subpixel Positioning, Anti-aliasing, Hinting
Text output using subpixel positioning, subpixel anti-aliasing, and
typographically-correct hinting.

Pull Request: https://projects.blender.org/blender/blender/pulls/105441
2023-09-21 22:43:17 +02:00
Campbell Barton
ab4562738c Cleanup: add asserts, improve wmEvent::utf8_buf doc-string
- rna_Event_unicode_length would return -1 if utf8_buf wasn't a valid
  unicode sequence, while this shouldn't happen, assert and return zero
  instead of returning a bad length.
- Move comment on wmEvent::utf8_buf null termination to a doc-string.
2023-09-18 14:32:15 +10:00
Campbell Barton
ed552e9e4f Cleanup: add suffix to clarify unicode functions that return an error
There were enough cases of callers ignoring a potential the error value,
using the column width for e.g. to calculate pixel sizes, or the size in
bytes to calculate buffer offsets.

Since text fields & labels can include characters that return an error
from BLI_str_utf8_as_unicode, add the suffix to make this explicit.
2023-09-18 13:41:03 +10:00
Pablo Vazquez
2ec2e52a90 UI: Theme: Allow transparency when editing text in widgets
Allow transparency in both text and background color, to allow blending
the selected color with whatever is underneath. Making theming more
flexible, especially since the same property is used in different backgrounds.

Note: this doesn't affect the default themes since all of them have the alpha
component in inner at `1.0`.

Pull Request: https://projects.blender.org/blender/blender/pulls/112090
2023-09-14 19:28:30 +02: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
Campbell Barton
b7f3e0d84e Cleanup: spelling & punctuation in comments
Also remove some unhelpful/redundant comments.
2023-09-14 13:25:24 +10:00
Harley Acheson
930dadd600 Fix #111831: Proper Highlighting of Inactive Buttons
Deal separately with menu states of Disabled and Inactive buttons,
since we want different hover highlighting for inactive.

Pull Request: https://projects.blender.org/blender/blender/pulls/112159
2023-09-08 19:42:47 +02:00
Leon Schittek
cc1c38f74d UI: Fix inconsistent menu background padding
Remove slight (2 pixels) extra padding at bottom of menus.

Pull Request: https://projects.blender.org/blender/blender/pulls/111826
2023-09-08 17:43:33 +02:00
Campbell Barton
3b0ced2e31 BLI_math: add add_v3_uchar_clamped (previously color_add_v3_i)
Move color_add_v3_i to a public function,
useful for making minor color adjustments.
2023-09-07 15:54:53 +10:00
Harley Acheson
d49c3d4d07 UI: Fixes for the highlighting of Selected Enums
Remove need for adding UI_BUT_LIST_ITEM, and replace use
of UI_BUT_ACTIVE_DEFAULT with UI_SELECT_DRAW

Pull Request: https://projects.blender.org/blender/blender/pulls/111938
2023-09-06 17:55:56 +02:00
Pablo Vazquez
9c1d9b6a82 UI: Hide widget emboss if inner color is fully transparent
Allows themes to have fully transparent widgets when the inner and
outline theme colors are set to 0.0f alpha.

Pull Request: https://projects.blender.org/blender/blender/pulls/111980
2023-09-06 17:53:43 +02:00
Harley Acheson
8a3766e241 Fix #111017: Improvements to the drawing of Color Ramps
Color Ramp widget with themed outline, handling of line width changes,
padding fixes, scaling fixes, etc.

Pull Request: https://projects.blender.org/blender/blender/pulls/111903
2023-09-06 00:00:40 +02:00
Harley Acheson
9f4b28bba8 UI: Highlight Selected Enum
Highlight the currently-selected item in enum, and some other, lists.

Pull Request: https://projects.blender.org/blender/blender/pulls/111074
2023-09-01 21:33:03 +02:00
Rawalanche
0e090369d6 Fix #109439: Use List Item widget colors for View Item widgets
As concluded in discussion under #109439, the View Item widgets are
supposed to use List Item widget theme colors. This patch does that.

Co-authored-by: Harley Acheson <harley.acheson@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/111584
2023-09-01 20:02:20 +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
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
Julian Eisel
5dcf704324 Refactor: Solve invalid icon-id enum values, use type alias
Some code attempted to use `BIFIconID` instead of `int` to pass around
icon-ids. Problem is, that this is just a subset of the allowed ids,
more icons may be created at runtime and extend the range of valid
icon-ids. Such icons could give runtime warning prints.

Idea is to use a `using BIFIconID = int;` instead. This way there is
still a descriptive type name, while the whole dynamic range of possible
icon-ids is supported.

Additionally multiple `using BIFIconID = int;` declarations are valid,
so we can place these in multiple headers and use the type name in APIs
instead of just `int`, whithout having to include a single header
defining them. A type mismatch (one instance differs from the others)
will result in a compiler error.

Pull Request: https://projects.blender.org/blender/blender/pulls/111052
2023-08-14 12:06:35 +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