Age | Commit message (Collapse) | Author |
|
|
|
Fix an issue where a `UI_BTYPE_CHECKBOX_N` button couldn't be toggled.
When toggling the value of a property, the `UI_BTYPE_TOGGLE_N`,
`UI_BTYPE_ICON_TOGGLE_N`, and `UI_BTYPE_CHECKBOX_N` types shouldn't
matter. These determine the inverted display of the value, but toggles
of that value should still happen once.
For these button types, the toggle happened twice, effectively making it
a no-op. The code for individual values is now also consistent with the
code for handling bit-flags.
Actually found & over-the-shoulder-reviewed by @Severin
|
|
|
|
Refactor of `BLF_boundbox_foreach_glyph` and simplification of its
usage by only passing translated glyph bounds to callbacks.
See D15765 for more details.
Differential Revision: https://developer.blender.org/D15765
Reviewed by Campbell Barton
|
|
|
|
|
|
Early exit when the button has no extra icons, avoiding a redundant
transformation from mouse to button coordinates.
|
|
|
|
Replace verbose ELEM(..) usage, now each kind of mouse event has it's
own macro.
|
|
The ISMOUSE macro was used in situations only button events
needed to be checked.
The only functional difference would be MOUSEMOVE events were
previously accepted for these checks.
|
|
No user visible changes expected.
Merges the tree row and grid tile button types, which were mostly doing
the same things. The idea is that there is a button type for
highlighting, as well as supporting general view item features (e.g.
renaming, drag/drop, etc.). So instead there is a view item button type
now. Also ports view item features like renaming, custom context menus,
drag controllers and drop controllers to `ui::AbstractViewItem` (the new
base class for all view items).
This should be quite an improvement because:
- Merges code that was duplicated over view items.
- Mentioned features (renaming, drag & drop, ...) are much easier to
implement in new view types now. Most of it comes "for free".
- Further features will immediately become availalbe to all views (e.g.
selection).
- Simplifies APIs, there don't have to be functions for individual view
item types anymore.
- View item classes are split and thus less overwhelming visually.
- View item buttons now share all code (drawing, handling, etc.)
- We're soon running out of available button types, this commit merges
two into one.
I was hoping I could do this in multiple smaller commits, but things
were quite intertwined so that would've taken quite some effort.
|
|
|
|
The `ascii` member was only kept for historic reason as some platforms
didn't support utf8 when it was first introduced.
Remove the `ascii` struct members since many checks used this as a
fall-back for utf8_buf not being set which isn't needed.
There are a few cases where it's convenient to access the ASCII value
of an event (or nil) so a function has been added to do that.
*Details*
- WM_event_utf8_to_ascii() has been added for the few cases an events
ASCII value needs to be accessed, this just avoids having to do
multi-byte character checks in-line.
- RNA Event.ascii remains, using utf8_buf[0] for single byte characters.
- GHOST_TEventKeyData.ascii has been removed.
- To avoid regressions non-ASCII Latin1 characters from GHOST are
converted into multi-byte UTF8, when building X11 without
XInput & X_HAVE_UTF8_STRING it seems like could still occur.
|
|
|
|
|
|
Part of T98560.
See https://wiki.blender.org/wiki/Source/Interface/Views
Adds all the basic functionality needed for grid views. They display
items in a grid of rows and columns, typically with a preview image and
a label underneath. Think of the main region in the Asset Browser.
Current features:
- Active item
- Notifier listening (also added this to the tree view)
- Performance: Skip adding buttons that are not scrolled into view
(solves performance problems for big asset libraries, for example).
- Custom item size
- Preview items (items that draw a preview with a label underneath)
- Margins between items scale so the entire region width is filled with
column, rather than leaving a big empty block at the right if there's
not enough space for another column (like the File and current Asset
Browser does it).
- "Data-View Item" theme colors. Not shown in the UI yet.
No user visible changes expected since the grid views aren't used for
anything yet.
This was developed as part of a rewrite of the Asset Browser UI
(`asset-browser-grid-view` branch), see T95653. There's no reason to
keep this part in a branch, continuing development in master makes
things easier.
Grid and tree views have a lot of very similar code, so I'm planning to
unify them to a degree. I kept things separate for the start to first
find out how much and what exactly makes sense to override.
|
|
The value of disabled buttons shouldn't be changed through dropping onto
it. Check for the disabled state in the drop operator poll, so the
dragging code will change the cursor to show that dropping isn't
possible at the given cursor location.
|
|
Moves code for managing dragging data from buttons to a separate file.
This way all this closely related code is in one location, making it
easier to see how it all relates, and easier to find.
|
|
|
|
Removal of BLT_lang_is_ime_supported which is always returns true and
is no longer needed.
See D11800 for more details.
Differential Revision: https://developer.blender.org/D11800
Reviewed by Campbell Barton
|
|
|
|
This should decrease cognitive load because:
- Intention is more explicit
- Shorter visual scope of branches (no need to search for matching
closing brackets and `else` blocks)
- Visually less busy code because condition-checks and code that
"actually does things" are separated, with less indentation
- Avoids chaining together a bunch of conditions to a single `if`
Also: Use `const`, correct comment placement, whitespace improvements.
|
|
|
|
* Rename ambiguous rgb to scene_linear in some places
* Precompute matrices to directly go to scene instead of through XYZ
* Make function signatures more consistent
|
|
This flag was used to activate the hotkey input buttons (e.g. for
"Assign Shortcut") when opened in a popup. Since this was added, other
more generalized ways of getting this same behavior were implemented.
Had to tweak the hotkey button event handling a bit, but it seems to
behave exactly as before now.
|
|
The button returned from `UI_region_active_but_get()` is not guaranteed
to have active button data, so code can't rely on that.
|
|
Steps to reproduce were:
- Factory startup
- Right-click in 3D View
- Move the mouse over "Shade Flat", wait for the tooltip
The changed logic in 4680331749aa to lookup an active button was
incorrect. It didn't respect the priority of active button candidates.
|
|
Issue is that the operator acts on the active button, and also uses that in the
poll. So the actually active button would affect the poll of a different
button. For the superimposed icons we need to be able to execute these polls
properly for non-active buttons.
This enables temporarily overriding the active button for lookups via context.
While a bit of a hack it makes sense conceptually.
Reviewed By: Campbell Barton
Maniphest Tasks: T97518
Differential Revision: https://developer.blender.org/D14880
|
|
The button returned from `UI_region_active_but_get()` is not guaranteed
to have active button data, so code can't rely on that.
|
|
Steps to reproduce were:
- Factory startup
- Right-click in 3D View
- Move the mouse over "Shade Flat", wait for the tooltip
The changed logic in 4680331749aa to lookup an active button was
incorrect. It didn't respect the priority of active button candidates.
|
|
Issue is that the operator acts on the active button, and also uses that in the
poll. So the actually active button would affect the poll of a different
button. For the superimposed icons we need to be able to execute these polls
properly for non-active buttons.
This enables temporarily overriding the active button for lookups via context.
While a bit of a hack it makes sense conceptually.
Reviewed By: Campbell Barton
Maniphest Tasks: T97518
Differential Revision: https://developer.blender.org/D14880
|
|
|
|
Regression caused by [0] which made `ui_but_is_interactive` consider
label buttons with tool-tips to be interactive. This prevented
the clicks to pass through to the nodes for selecting/dragging.
Resolve this by allowing buttons to be activated for the purpose
of showing tool-tips but otherwise considering them disabled
(as if the UI_BUT_DISABLED is set when handling events).
[0]: 484a9146479e05946d291e9886cdf3febca6d05d
Reviewed By: Severin
Ref D14932
|
|
`uiBut` contained a variable that was only used for these hot-key
buttons. This may also help getting rid of the `UI_BUT_IMMEDIATE` flag,
which is also only used for this button type. We are running out of
available bits for flags, so this would be useful.
Continuing the work from 49f088e2d093. Part of T74432.
|
|
Internally many offsets for BLF were integers but exposed as floats,
since these are used in pixel-space, many callers were converging them
back to integers. Simplify logic by using ints.
|
|
This is a general issue exposed by moving from tweak to click-drag
events [0], however this bug would have existed for both click &
click-drag events beforehand.
Since [1] the following behavior could occur:
- Click-drag the cursor away from the button.
- Leaving the button would flag it as disabled.
- The disabled button would then break
causing the event to be considered handled.
- Once handled no click / click-drag action would be tested.
The bug would only happen if the cursor left the button before the drag
threshold was reached which tended to happen with an UI-scale 2 or more.
Or with an increased drag threshold.
Revert [1] (fix for T78503), which is no longer needed since as of [2].
[0]: 4986f718482b061082936f1f6aa13929741093a2
[1]: 6f96dd85766a8159d5ffb761cbb4dbd20b7cad00
[2]: 87c13ac68c477486adecd8d548a016309fc2b54d
|
|
Lets `makesrna` generate a `RNA_prototypes.h` header with declarations for all
RNA properties. This can be included in regular source files when needing to
reference RNA properties statically.
This solves an issue on MSVC with adding such declarations in functions, like
we used to do. See 800fc1736748. Removes any such declarations and the related
FIXME comments.
Reviewed By: campbellbarton, LazyDodo, brecht
Differential Revision: https://developer.blender.org/D13837
|
|
Activating a gizmo used the windows eventstate which may have values
newer than the event used to activate the gizmo.
This meant transforms check for the key that activated transform
could be incorrect.
Support passing an event when calling operators to avoid this problem.
|
|
|
|
This avoids transform jumping which is a problem when tweaking values a
small amount. A fix for T40549 was made box-select used the location
when the key was pressed.
While it's important for box-select or any operator where it's expected
the drag-start location is used, this is only needed in some cases.
Since the event stores the click location and the current location,
no longer overwrite the events real location. Operators that depend on
using the drag-start can use this location if they need.
In some cases the region relative cursor location (Event.mval) now needs
to be calculated based on the click location.
- Added `WM_event_drag_start_mval` for convenient access to the region
relative drag-start location (for drag events).
- Added `WM_event_drag_start_xy` for window relative coordinates.
- Added Python property Event.mouse_prev_click_x/y
Resolves T93599.
Reviewed By: Severin
Ref D14213
|
|
|
|
|
|
Just use the image-buffer size and the already provided scale to
determine the size, not the button size (which would always have to
match the scaled image-buffer size or it would give unexpected results).
|
|
Supporting two kinds of dragging is redundant, remove tweak events as
they only supported 3 mouse buttons and added complexity from using the
'value' to store directions.
Support only click-drag events (KM_CLICK_DRAG) which can be used with
any keyboard or mouse button.
Details:
- A "direction" member has been added to keymap items and events which
can be used when the event value is set to KM_CLICK_DRAG.
- Keymap items are version patched.
- Loading older key-maps are also updated.
- Currently the key-maps stored in ./release/scripts/presets/keyconfig/
still reference tweak events & need updating. For now they are updated
on load.
Note that in general this wont impact add-ons as modal operators don't
receive tweak events.
Reviewed By: brecht
Ref D14214
|
|
Use a flag for events to avoid adding struct members every time a new
kind of tag is needed - so events remain small.
This also simplifies copying settings as flags can be copied at once
with a mask.
|
|
Using flags makes checking multiple modifiers at once more convenient
and avoids macros/functions such as IS_EVENT_MOD & WM_event_modifier_flag
which have been removed. It also simplifies checking if modifier keys
have changed.
|
|
|
|
Reset Defaults left the undo stack in an invalid state,
with the active undo step left at the previous state then it should
have been.
Now the buttons own undo logic is used to perform undo pushes.
|
|
Use a shorter/simpler license convention, stops the header taking so
much space.
Follow the SPDX license specification: https://spdx.org/licenses
- C/C++/objc/objc++
- Python
- Shell Scripts
- CMake, GNUmakefile
While most of the source tree has been included
- `./extern/` was left out.
- `./intern/cycles` & `./intern/atomic` are also excluded because they
use different header conventions.
doc/license/SPDX-license-identifiers.txt has been added to list SPDX all
used identifiers.
See P2788 for the script that automated these edits.
Reviewed By: brecht, mont29, sergey
Ref D14069
|
|
Convert Ideographic Full Stop, used in Simplified Chinese and Japanese,
to Decimal Point when entering numbers into numerical inputs.
See D13903 for more details
Differential Revision: https://developer.blender.org/D13903
Reviewed by Brecht Van Lommel
|