Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-07-19UI: Port view item features to base class, merge view item button typesJulian Eisel
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.
2022-07-14Correct error with IME from d6fef73ef110eb43756b7b87c2cba80abae3b39fCampbell Barton
2022-07-14WM: Remove ASCII members from wmEvent & GHOST_TEventKeyDataCampbell Barton
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.
2022-07-11Cleanup: Remove unused operator name storage in UI listsJulian Eisel
2022-06-17Cleanup: compiler warningsBrecht Van Lommel
2022-06-16UI: Add initial "grid view"Julian Eisel
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.
2022-06-14Fix T98715: Crash drag-dropping collection from outliner to ID propertyJulian Eisel
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.
2022-06-13Cleanup: Move dragging code for buttons to own fileJulian Eisel
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.
2022-06-09Cleanup: use const variables & argumentsCampbell Barton
2022-06-07IME Cleanup: Removal of BLT_lang_is_ime_supportedHarley Acheson
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
2022-06-07Cleanup: spelling in comments, minor formatting tweaksCampbell Barton
2022-05-23Cleanup: Early-exit in button handling code, minor cleanupsJulian Eisel
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.
2022-05-23Merge remote-tracking branch 'origin/blender-v3.2-release'Dalai Felinto
2022-05-23Cleanup: clarify what is scene linear color space in conversion conversionBrecht Van Lommel
* 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
2022-05-20UI: Get rid of redundant UI_BUT_IMMEDIATE button flagJulian Eisel
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.
2022-05-13Fix possible null-pointer dererence for active button dataJulian Eisel
The button returned from `UI_region_active_but_get()` is not guaranteed to have active button data, so code can't rely on that.
2022-05-13Fix crash when displaying some button tooltipsJulian Eisel
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.
2022-05-13Fix T97518: All buttons with eyedropper highlight if one is hoveredJulian Eisel
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
2022-05-13Fix possible null-pointer dererence for active button dataJulian Eisel
The button returned from `UI_region_active_but_get()` is not guaranteed to have active button data, so code can't rely on that.
2022-05-13Fix crash when displaying some button tooltipsJulian Eisel
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.
2022-05-13Fix T97518: All buttons with eyedropper highlight if one is hoveredJulian Eisel
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
2022-05-13Merge branch 'blender-v3.2-release'Campbell Barton
2022-05-13Fix T97386: Node socket labels swallow click/drag eventsCampbell Barton
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
2022-05-12UI Code Quality: Use derived struct for hot-key buttonsJulian Eisel
`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.
2022-04-13Cleanup: avoid redundant float/int conversions in BLFCampbell Barton
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.
2022-03-21Fix T96255: Node socket fails to dragCampbell Barton
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
2022-03-14RNA: Generate property declerations header, solving msg-bus C++ incompatibilityJulian Eisel
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
2022-03-11Fix out of order event handling when calling operators from gizmosCampbell Barton
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.
2022-03-09Cleanup: use ELEM macroCampbell Barton
2022-03-09Event System: drag events no longer default to the drag start locationCampbell Barton
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
2022-03-04Cleanup: remove outdated references to tweakCampbell Barton
2022-03-04Cleanup: spelling in comments, function nameCampbell Barton
2022-03-03Cleanup: Remove redundant drag image size parametersJulian Eisel
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).
2022-03-02Event System: remove tweak events in favor of click-dragCampbell Barton
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
2022-03-01Cleanup: move Event.is_repeat & is_direction_inverted to flagsCampbell Barton
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.
2022-02-25Cleanup: use flags for wmEvent modifier keysCampbell Barton
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.
2022-02-22Merge branch 'blender-v3.1-release'Campbell Barton
2022-02-22Fix T93629: Reset to defaults undoes all steps when applied twiceCampbell Barton
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.
2022-02-11File headers: SPDX License migrationCampbell Barton
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
2022-01-29Win IME: Ideographic Full Stop to Decimal PointHarley Acheson
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
2022-01-18UI: fix a precision issue with float field step size.Alexander Gavrilov
Fix a precision issue when stepping down from 1 to 0 via the left decrement button and step 100 results in a small nonzero value. The reason is that 0.01 can't be precisely represented in binary and converting to double before multiplication reveals this. Ref D13753
2022-01-10UI: Allow AltGr Key + C,V,X Text InputHarley Acheson
Slight change to our processing of Ctrl-C, Ctrl-V, and Ctrl-X so that they will not be triggered if Alt is also pressed. This allows entry of AltGr-C, -V, -X when using International keyboard layouts. See D13781 for more details Differential Revision: https://developer.blender.org/D13781 Reviewed by Brecht Van Lommel
2022-01-06Cleanup: spelling in commentsCampbell Barton
2022-01-03Fix T94316: Asset catalog tree scrolls away when renaming a catalogJulian Eisel
The activation of the text button is a bit special, since it happens during drawing, the layout isn't computed yet then. Comparable cases where the button is added on top don't use the layout system, so this didn't become an issue until now. Trigger a delayed call to `UI_but_ensure_in_view()`.
2021-12-16UI: deduplicate code for Copy To Selected and Alt-button tweakingPhilipp Oeser
This resolves an old TODO to deduplicate code in copy_to_selected_button & ui_selectcontext_begin. This is also in hindsight of adding id-property support [incl. Geometry Nodes modifier properties] for this in the next commit. No behavior change expected here. ref T93983 & D13573
2021-12-09Fix T93519: handle prefix names in autocompletesAzeem Bande-Ali
Autocomplete entires keep track of the length of the prefix in `name_prefix_offset`. However, the name matching logic was comparing the string including the prefix which resulted in tab-completion not working (when the user didn't also type in the prefix, typically two whitespaces). This is fixed by passing in a char pointer after the end of the prefix. Additionally, some searchbox logic is moved. Previously, `ui_searchbox_apply` would clear the entry which would mean that `ui_searchbox_find_index` would never succeed. Now the search box is only cleared if no match was found. Differential Revision: https://developer.blender.org/D13483
2021-12-08Cleanup: move public doc-strings into headers for 'editors'Campbell Barton
Ref T92709
2021-12-02Fix T93410: Crash hiding a region from Python used by a popoverCampbell Barton
Close all active buttons when hiding a region as this can be called from Python a popover is open from that region. Failure to do this causes the popover to read from the freed button. Also rename UI_screen_free_active_but to UI_screen_free_active_but_highlight since it only frees highlighted buttons.
2021-11-25Merge branch 'blender-v3.0-release'Bastien Montagne
Conflicts: source/blender/windowmanager/intern/wm_files_link.c
2021-11-25Fix T89996, T90063: bugs with multi-button reset and entering values in popupsBrecht Van Lommel
This reverts the changes to fix T87448, where entering the same value in number buttons causes an unnecessary update. This is not stable enough for 3.0 and so is being reverted, better to have an unnecessary update than no update in other cases. This effectively reverts the changes from rBeb06ccc32462 and follow up fixes rBe1a9ba94c599, rBbbb52a462ef9, rBec30cf0b742f, and rB071799d4fc44. The code is disabled with a comment on how it could be implemented better.