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-05-07XR: Expose the OpenXR user paths in the event data for XR eventsShashank Shekhar
The use-case is to allow an event handler (in C or a plugin) to distinguish which hand produced the XR event. The alternative is to register separate actions for each hand (e.g. "trigger_left" and "trigger_right"), and duplicate the device bindings (Oculus, HTC Vive, etc) for each action. Other than the problem of code duplication, this isn't conceptually efficient since "trigger_left" and "trigger_right" both represent the same event "trigger", and the identity of the hand that produced that event is just a property of that event. Adds two string fields to the XrEventData called user_path and user_path_other. The user_path_other field will be populated if the event is a bimanual one (i.e. two-handed). This follows the pattern used by the rest of the XrEventData struct for bimanual events (e.g. state, state_other). Reviewed By: muxed-reality
2022-05-03Cleanup: spelling in commentsCampbell Barton
2022-04-28VSE: Add precise drag and drop and strip previewsSebastian Parborg
This patch adds the drag and drop strip previews in the VSE. It also adds two new functions to the drag and drop API. 1. "draw_in_view" for callbacks that wants to draw elements in local viewport coordinates 2. "on_drag_start" that can be used for prefetching data only once at the start of the drag. Reviewed By: Julian, Campbell Differential Revision: http://developer.blender.org/D14560
2022-04-07Cleanup: spelling in comments, minor reformatting changesCampbell Barton
2022-04-04Cleanup: ensure space after file named in headersCampbell Barton
Add blank lines after file references to avoid them being interpreted as doc-strings the following declarations.
2022-03-17Cleanup: include argument names for drop-box callbacksCampbell Barton
Indicates typical names for callbacks and allows them to be documented.
2022-03-10Event System: key-press while dragging now activates drag firstCampbell Barton
When dragging with a large threshold (using a tablet for example), it's possible to press another key before the drag threshold is reached. So tweaking then pressing X would show the delete popup instead of transforming along the X-axis. Now key presses while dragging cause the drag event to be evaluated before the key press. Note that to properly base the mouse-move event on the previous state the last handled event is now stored in the window. Without this the inserted mouse-move event may contain invalid values from the next event (it's modifier state or other `prev_*` values). Requested by @JulienKaspar.
2022-03-09Cleanup: rename wmEvent.prev_click_* to prev_press_*Campbell Barton
At the time of naming these members only some event types generated click events so it made some sense to differentiate a click. Now all buttons support click & drag it's more logical to use the prefix "prev_press_" as any press event will set these values. Also update doc-strings.
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-08Event System: add ISKEYBOARD_OR_BUTTON macroCampbell Barton
This simplifies checking for event types that support press & release.
2022-03-04Cleanup: remove outdated references to tweakCampbell 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-02Cleanup: rename direction enum as it's part of the key-map itemCampbell Barton
Also improve doc-strings for key-map item constants.
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-01Fix incorrect drag-event threshold when releasing modifiers earlyCampbell Barton
db4313610cab18933c1b1b1348720ea241b9d91e added support for modifier keys to be released while dragging. The key release events set wmEvent.prev_type which is used select the drag threshold, causing the wrong threshold to be used. Add wmEvent.prev_click_type which is only set when the drag begins.
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-28Event System: drag events now use modifier state on drag startCampbell Barton
Now drag & tweak can have modifier keys to be released while dragging. without this, modifier keys needs to be held which is more noticeable for tablet input or whenever the drag threshold is set to a large value. Resolves T89989.
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-18Curves: add initial edit mode supportKévin Dietrich
This adds initial support for edit mode for the experimental new curves object. For now we can only toggle in and out of the mode, no real interraction is possible. This patch also adds empty menus in edit mode. Those were added mainly to quiet warnings as the menus are programmatically added to the edit mode based on the object type and context. Ref T95769 Reviewed By: JacquesLucke, HooglyBoogly Maniphest Tasks: T95769 Differential Revision: https://developer.blender.org/D14136
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-28Drag & drop: Support using context of hovered button when droppingJulian Eisel
Buttons can hold context and it's very useful to use this as a way to let buttons provide context for drop operators. For example, with this D13549 can make the material slot list set the material-slot pointer for each row, and the drop operator can just query that.
2022-01-13Outliner: Compile all Outliner files in C++Julian Eisel
We want to refactor quite some of the Outliner code using C++, this is a logical step to help the transition to a new architecture. Includes plenty of fixes to make this compile without warnings, trying not to change logic. The usual stuff (casts from `void *`, designated initializers, compound literals, etc.).
2021-12-14Cleanup: use typed enum for wmDrag.flagsCampbell Barton
Also use 'e' prefix for enum type name.
2021-11-05Cleanup (UI): Add/use type for operator context enumJulian Eisel
Adds a `wmOperatorCallContext` typedef for the existing `WM_OP_XXX` operator context enum. This adds type safety, allows the compiler to produce better warnings and helps understanding what a variable is for. Differential Revision: https://developer.blender.org/D13113 Reviewed by: Campbell Barton
2021-11-04Cleanup: Remove operator context override for drop-box operatorsJulian Eisel
Drop-boxes should act on the context determined through the exact cursor location. There should be no need to override that, basically by the nature of how drop-boxes work. So Campbell and I agreed on removing this. If we wanted to support it, we'd have to restore the operator context when drawing drop-boxes, see https://developer.blender.org/T92501#1247581.
2021-11-04Fix T92501: Crash when dragging material assets over 3D View regionsJulian Eisel
Issue was that the context used for dropbox handling and polling didn't match the one used for drawing the dropbox and generating the tooltip text (which would determine the material slot under the cursor, requiring context). The mismatch would happen with overlapping regions. Actually, this patch includes two fixes, each fixing the crash itself: * Store the context from handling & polling and restore it for drawing. * Correct the hovered region lookup for drawing to account for overlayed regions. Note that to properly set up context for drawing, we should also account for the operator context, which isn't done here, see https://developer.blender.org/T92501#1247581.
2021-10-27Asset Browser: Support dragging catalogs to move them in the hierarchyJulian Eisel
Uses the additions to the UI tree-view API from the previous commit to enable drag & drop of asset catalogs. The catalogs will be moved in the tree including children. A remaining issue is that a catalog with children will always be collapsed when dropping. I need to find a way to fix that in the tree-view API. There are a few improvements I can think of for the tree-item drag & drop support, but time for these is too short. These can be done as normal cleanups at some point.
2021-10-26UI: Improved feedback when dropping is not possible on drag 'n dropJulian Eisel
* Allow operators to show a "disabled hint" in red text explaining why dropping at the current location and in current context doesn't work. Should greatly help users to understand what's the problem. * Show a "stop" cursor when dropping isn't possible, like it's common on OSes. Differential Revision: https://developer.blender.org/D10358
2021-10-25Assets: Snapping with visual feedback while draggingGermano Cavalcante
The drag and drop feature of objects in 3D View has been modified to include: - Snap the object being dragged. - Visual feedback through a box and the placement tool grid. Maniphest Tasks: T90198 Differential Revision: https://developer.blender.org/D12912
2021-10-25UI Drag Drop: allow customizable drawingGermano Cavalcante
No functional changes. This commit adds 3 callbacks for `wmDropBox` which allow custom drawing without affecting the internal dropbox API. Differential Revision: https://developer.blender.org/D12948
2021-10-21Cleanup: use underscore separators for event struct membersCampbell Barton
Improve readability using underscores for separators, e.g. prev_click_time instead of prevclicktime.
2021-10-20Cleanup: use an array for wmEvent cursor position variablesAaron Carlisle
Use arrays for wmEvent coordinates, this quiets warnings with GCC11. - `x, y` -> `xy`. - `prevx, prevy` -> `prev_xy`. - `prevclickx, prevclicky` -> `prev_click_xy`. There is still some cleanup such as using `copy_v2_v2_int()`, this can be done separately. Reviewed By: campbellbarton, Severin Ref D12901
2021-10-19Asset Browser: Improved workflow for asset catalog savingSybren A. Stüvel
No longer save asset catalogs on blendfile save. Instead: - extend the confirmation prompt for unsaved changes to show unsaved catalogs. - In the confirmation prompt, make catalog saving explicit & optional, just like we do it for external images. {F10881736} - In the Asset Browser catalog tree, show an operator icon to save the catalogs to disk. It's grayed out if there are no changes to save, or if the .blend wasn't saved yet (required to know where to save the catalog definitions to). {F10881743} Much of the work was done by @Severin and reviewed by me, then we swapped roles. Reviewed By: Severin Differential Revision: https://developer.blender.org/D12796
2021-10-18WM: support setting the operators idle cursorCampbell Barton
Support setting a cursor when an operator is waiting for input.
2021-10-07Fix screenshot editor showing status text in the editorCampbell Barton
This caused problems calling screenshot from menu-search which included the status text in the screenshot. Now the status text is shown in the global status bar for any operators called from a screen context.
2021-10-06Cleanup: spelling in commentsCampbell Barton
2021-10-05XR: Add runtime window area for XR eventsPeter Kim
This adds an offscreen View3D window area for the VR view in order to execute XR events/operators in the proper context. The area is created as runtime data before XR events are dispatched and set as the active area during XR event handling. Since the area is runtime-only, it will not be saved in files and since the area is offscreen, it will not interfere with regular window areas. The area is removed with the rest of the XR runtime data on exit, file read, or when stopping the VR session. Note: This also adds internal types (EVT_DATA_XR, EVT_XR_ACTION) and structs (wmXrActionData) for XR events. Reviewed By: Severin Differential Revision: https://developer.blender.org/D12472
2021-10-04Asset Browser: Support dragging assets into catalogsJulian Eisel
With this it is possible to select any number of assets in the Asset Browser and drag them into catalogs. The assets will be moved to that catalog then. However, this will only work in the "Current File" asset library, since that is the only library that allows changing assets, which is what's done here. While dragging assets over the tree row, a tooltip is shown explaining what's going to happen. In preparation to this, the new UI tree-view API was already extended with custom drop support, see 4ee2d9df428d. ---- Changes here to the `wmDrag` code were needed to support dragging multiple assets. Some of it is considered temporary because a) a proper #AssetHandle design should replace some ugly parts of this patch and b) the multi-item support in `wmDrag` isn't that great yet. The entire API will have to be written anyway (see D4071). Maniphest Tasks: T91573 Differential Revision: https://developer.blender.org/D12713 Reviewed by: Sybren Stüvel
2021-10-03Cleanup: spelling in commentsCampbell Barton
2021-09-29Fix T89864: Adding an asset referencing other objects adds it to scene but ↵Bastien Montagne
only adds data-blocks of referenced objects. Link/append code needs proper access to scene/view3d data to handle collections/objects instantiation. Note that this is a temporary hack more than a proper fix, which would require a deeper redesign of drag&drop code. Also note that this will not handle 'properly' (i.e. as user would expect it) cases like implicitely appended parent objects, in that only the explicitely appended object will be dropped to the nes location, the others will remain at their original coordinates. Differential Revision: https://developer.blender.org/D12696
2021-09-17WM: expose the "any" state of KeyMapItem modifiersCampbell Barton
Change KeyMapItem.alt/ctrl/shift/oskey to integer types, where -1 is used to ignore the modifier when matching key-map items. It was only possible to set all modifiers to -1 at once from RNA using the 'any' property. Afterwards individual modifiers could be set back to true/false. Although these key-map items could not be exported/imported. Exposing the values directly avoids the need for cumbersome workarounds.
2021-09-17Cleanup: remove KM_MOD_SECOND & KM_SHIFT2, KM_CTRL2.. etcCampbell Barton
These were added in a1c8543f2acd7086d412cb794b32f96794b00659 (2007) but never used. Nor did they have any meaning in practice. Note that versioning keymap items isn't needed as these values were never set. The code-paths that set these values also set KM_MOD_FIRST causing `keymap_event_set` to only ever assign values of 0 or 1. These flags complicate further exposing KM_ANY (-1) which is also a valid value for modifiers.
2021-09-17UI: wait for input for operators that depend on cursor locationCampbell Barton
Support waiting for input so operators that depend on the cursor location are usable from menus / buttons. Use an operator type flag which the user interface code checks for, waiting for input when run from a menu item. This patch only supports this feature, there are no functional changes. The motivation for this change is discoverability since some actions were either hidden or broken when accessed from menus (where the behavior of the operator depended on the menu location). In general, waiting for input is *not* an efficient way to access tools, however there are over 50 operators with a "wait_for_input" property so this isn't introducing a new kind of interaction, rather exposing this in a way that does not need to be hard-coded into each operator, or having modal callbacks added for the sole purpose of waiting for input. Besides requiring boiler plate code using a "wait_for_input" property has the added down-side of preventing key shortcuts from showing. Only the menu items will enable the property, causing them not to match key-map items. Reviewed By: Severin Ref D12255
2021-09-15Cleanup: spellingCampbell Barton
2021-08-26Cleanup: sort struct blocksCampbell Barton
2021-08-17Cleanup: unused definesCampbell Barton
2021-08-04T90371: Asset: Drop Material Tooltip.Jeroen Bakker
This patch changes the drop named material tooltip to give feedback to the user what is going to happen when they invoke the change. There are 3 states: * "": Operator will be canceled as not all data is present (dropping on background.) * "Drop <named material> on <object name> (slot <slot number>, replacing <current material in slot>). * "Drop <named material> on <object name> (slot <slot number). Reviewed By: Severin Maniphest Tasks: T90371 Differential Revision: https://developer.blender.org/D12106
2021-08-02WindowManager: Support Dynamic tooltips when dragging.Jeroen Bakker
Originally the operator name was drawn next to the dragging content. After that there was an option to add custom, static text with the dragging content. This patch allows dynamic text to be drawn. The custom text was implemented as out parameter of the poll function what made the code unclear. This patch introduces a tooltip function that separates tooltip generation from the poll function. NOTE: the text should always be returned in its own memory block. This block will be freed after it is copied in the drag struct. Reviewed By: Severin Differential Revision: https://developer.blender.org/D12104
2021-07-30Fix T90318: Dragging asset while Asset Browser is still loading crashesJulian Eisel
This partially reverts cb0b017d8f51: We can't store the asset handle in the drag data, because the file pointer it wraps may be freed as the Asset Browser generates its file list.
2021-07-20Cleanup: Store asset-handle in drag dataJulian Eisel
Would previously pass a few properties that are available via the asset-handle now. This asset-handle is also required for some of the asset API, e.g. the temporary ID loading. This will probably be needed before too long.