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
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-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.
2021-07-15UI/Assets: Initial Asset View UI templateJulian Eisel
The asset view UI template is a mini-version of the Asset Browser that can be placed in regular layouts, regions or popups. At this point it's made specifically for placement in vertical layouts, it can be made more flexible in the future. Generally the way this is implemented will likely change a lot still as the asset system evolves. The Pose Library add-on will use the asset view to display pose libraries in the 3D View sidebar. References: * https://developer.blender.org/T86139 * https://code.blender.org/2021/06/asset-browser-project-update/#what-are-we-building * https://code.blender.org/2021/05/pose-library-v2-0/#use-from-3d-viewport Notes: * Important limitation: Due to the early & WIP implementation of the asset list, all asset views showing the same library will show the same assets. That is despite the ID type filter option the template provides. The first asset view created will determine what's visible. Of course this should be made to work eventually. * The template supports passing an activate and a drag operator name. The former is called when an asset is clicked on (e.g. to apply the asset) the latter when dragging (e.g. to .blend a pose asset). If no drag operator is set, regular asset drag & drop will be executed. * The template returns the properties for both operators (see example below). * The argument list for using the template is quite long, but we can't avoid that currently. The UI list design requires that we pass a number of RNA or custom properties to work with, that for the Pose Libraries should be registered at the Pose Library add-on level, not in core Blender. * Idea is that Python scripts or add-ons that want to use the asset view can register custom properties, to hold data like the list of assets, and the active asset index. Maybe that will change in future and we can manage these internally. As an example, the pose library add-on uses it like this: ``` activate_op_props, drag_op_props = layout.template_asset_view( "pose_assets", workspace, "active_asset_library", wm, "pose_assets", workspace, "active_pose_asset_index", filter_id_types={"filter_action"}, activate_operator="poselib.apply_pose_asset", drag_operator="poselib.blend_pose_asset", ) drag_op_props.release_confirm = True drag_op_props.flipped = wm.poselib_flipped activate_op_props.flipped = wm.poselib_flipped ```
2021-07-15UI: Support defining UI lists in CJulian Eisel
So far all UI lists had to be defined in Python, this makes it possible to define them in C as well. Note that there is a whole bunch of special handling for the Python API that isn't there for C. I think most importantly custom properties support, which currently can't be added for C defined UI lists. The upcoming asset view UI template will use this, which needs to be defined in C. Adds a new file `interface_template_list.cc`, which at this point is mostly a dummy to have a place for the `ED_uilisttypes_ui()` definition. I plan a separate cleanup to move the UI-list template to that file.
2021-07-15UI: New button/widget type for Asset Browser like preview tilesJulian Eisel
This button type shows a preview image above centered text, similar to the File Browser files in Thumbnail Display Mode or the default Asset Browser display. In fact we may want to port these over to use the new button type at some point. Will be used by the asset view UI template that will be added in a following commit. That is basically a mini version of the Asset Browser that can be displayed elsewhere in the UI.
2021-07-15UI: Auto-scroll to keep active text buttons in viewJulian Eisel
If a text button is activated that is not in view (i.e. scrolled away), the scrolling will now be adjusted to have it in view (with some small additional margin). While entering text, the view may also be updated should the button move out of view, for whatever reason. For the most part, this feature shouldn't be needed and won't kick in, except when a clicked on text button is partially out of view or very close to the region edge. It's however quite important for the previously committed feature, that is, pressing Ctrl+F to start searching in a UI list. The end of the list where the scroll button appears may not be in view. Plus while filtering the number of visible items changes so the scrolling has to be updated to keep the search button visible. Note that I disabled the auto-scrolling for when the text button spawned an additional popup, like for search-box buttons. That is because current code assumes the button to have a fixed position while the popup is open. There is no code to update the popup position together with the button/scrolling. I also think that the logic added here could be used in more places, e.g. for the "ensure file in view" logic the File Browser does.
2021-07-15UI: Internal support for custom UI list item drag & activate operatorsJulian Eisel
For pose libraries, we need to be able to apply a pose whenever activating (clicking) an item in the Pose Library asset view and blend it by dragging (press & move). And since we want to allow Python scripts to define what happens at least when activating an asset (so they can define for example a custom "Apply" operator for preset assets), it makes sense to just let them pass an operator name to the asset view template. The template will be introduced in a following commit.
2021-07-15UI: UI list refactor & preparations for asset view templateJulian Eisel
This is more of a first-pass refactor for the UI list template. More improvements could be done, but that's better done separately. Main purpose of this is to make the UI list code more manageable and ready for the asset view template. No functional changes for users. * Split the huge template function into more manageable functions, with clear names and a few structs with high coherency. * Move runtime data management to the template code, with a free callback called from BKE. This is UI data and should be managed at that level. * Replace boolean arguments with bit-flags (easily extendable and more readable from the caller). * Allow passing custom-data to the UI list for callbacks to access. * Make list grip button for resizing optional. * Put logic for generating the internal UI list identifier (stored in .blends) into function. This is a quite important bit and a later commit adds a related function. Good to have a clear API for this. * Improve naming, comments, etc. As part of further cleanups I'd like to move this to an own file.
2021-07-13Cleanup: improve BMEditMesh docstringsCampbell Barton
Also remove white-space added last commit.
2021-07-13Edit Mesh: use partial updates editing vertices with number buttonsCampbell Barton
Use the same partial-update functions used by transform when editing vertex locations with the number buttons. This avoids unnecessary calculations for normals and tessellation. This gives around 1.44x overall speedup on high poly meshes.
2021-07-13UI: support persistent state during number/slider interactionCampbell Barton
Support for begin/update/end callbacks allowing state to be cached and reused while dragging a number button or slider. This is done using `UI_block_interaction_set` to set callbacks. - Dragging multiple buttons at once is supported, passing multiple unique events into the update function. - Update is only called once even when multiple buttons are edited. - The update callback can detect the difference between click & drag actions so situations to support skipping cache creation and freeing for situations where it's not beneficial. Reviewed by: Severin, HooglyBoogly Ref D11861
2021-07-07Cleanup: spelling in commentsCampbell Barton
2021-07-05Cleanup: Use enum for UI block emboss typeHans Goudey
2021-07-05Cleanup: remove unused definesCampbell Barton
2021-07-03Cleanup: consistent use of tags: NOTE/TODO/FIXME/XXXCampbell Barton
Also use doxy style function reference `#` prefix chars when referencing identifiers.
2021-06-30UI: custom free function improvementsJacques Lucke
This changes `UI_but_func_tooltip_set` so that it allows passing a custom free function, which has two benefits: * The caller can pass `null` to indicate that the value should not be freed. * Arbitrary c++ data can be passed to the callback (before the struct had to be trivially destructible). I added `uiFreeArgFunc` and used it in other places where appropriate. Differential Revision: https://developer.blender.org/D11738
2021-06-29UI: Support setting operator properties for `UILayout.operator_menu_enum()`Julian Eisel
`UILayout.operator_menu_enum()` now returns the operator properties, just like `UILayout.operator()`. This makes it possible to set options for the operator displayed in the menu. In C it can be done through the new `uiItemMenuEnumFullO()` or `uiItemMenuEnumFullO_ptr()`. It's reasonable to have this, probably just a small thing never bothered to add. D10912 could use it, the following comment can be addressed now too: https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/space_nla/nla_buttons.c$583-586
2021-06-26Cleanup: full sentences in comments, improve comment formattingCampbell Barton
2021-06-25Spreadsheet: Dataset region for spreadsheet editorFabian Schempp
This patch adds a left aligned sidebar to the spreadsheet editor. This Sidebar can be used to navigate the geometry component types and attribute domains. It also provides a quick overview of domain sizes. It replaces the two dropdowns in the regions header. Next step will be to add the domain cycling shortcut using the CTRL + mouse wheel. Reviewer: Dalai Felinto (dfelinto), Julian Eisel (Severin), Hans Goudey (HooglyBoogly). Differential Revision: https://developer.blender.org/D11046
2021-06-15UI: Support right aligned non-shortcut hints in widgetsJulian Eisel
Widget drawing code already supported drawing right-aligned, grayed out shortcut strings. This patch generalizes things a bit so this can also be used to draw other hints in the same way. There have been a few instances in the past where this would've been useful, D11046 being the latest one. Note that besides some manual regression testing, I didn't check if this works yet, as there is no code actually using it (other than the shortcuts). Can be checked as part of further development for D11046. A possible further improvement would be providing a way to define how clipping should be done. E.g. sometimes the right-aligned text should be clipped first (because it's just a hint), in other cases it should be left untouched (like current code explicitly does it for shortcuts). Removes the `UI_BUT_HAS_SHORTCUT` flag, which isn't needed anymore.
2021-06-11Add option to link assets on drag & dropJulian Eisel
Note: Linking in this case as in link vs. append. Easily confused with linking a data-block to multiple usages (e.g. single material used by multiple objects). Adds a drop-down to the Asset Browser header to choose between Link and Append. This is probably gonna be a temporary place, T54642 shows where this could be placed eventually. Linking support is crucial for usage of the asset browser in production environments. It just wasn't enabled yet because a) the asset project currently focuses on single user, not production assets, and b) because there were many unkowns still for the workflow that have big impact on production use as well. With the recently held asset workshop I'm more confident with enabling linking, as design ideas relevant to production use were confirmed. Differential Revision: https://developer.blender.org/D11536 Reviewed by: Bastien Montagne
2021-04-29Cleanup: Use const argument for contextHans Goudey
2021-04-28Cleanup: Fix inconcistent array lengths in function declarationsHans Goudey
In some cases functions were defined with arguments of different array lengths in headers vs. implementations. This commit fixes some of the cases I ran into, but probably not all of them.
2021-04-20Cleanup: uiBut.flag had an internal flag out of the documented rangeCampbell Barton
Increase range of internal flags & order UI_SEARCH_FILTER_NO_MATCH within this range, so public button flags aren't accidentally added that overlap with internal flags.
2021-04-19Fix T85223: Some modifier panels can dissapear in old filesHans Goudey
The problem is that each uiBlock needs to be assigned a unique name, but when there can be multiple modifiers of the same type, we use the panel sort order for the unique part of the string. However, the most recent test file has 1200+ panels in the property editor, so 4 characters isn't enough for a unique string. That's not a situation I expected, but it makes sense, because we don't remove legacy panels with unused types when loading old files. So they tend to accumulate a bunch of unused panels. That's why this works fine with a new property editor, it doesn't all of the extra old panels. These panels must be stored for the expansion status and order, but arguably we could cull unused panels on save. However, simply increasing the length of the unique panel string is a valid fix in this situation. In the future, we can look into removing unused panels when saving.
2021-04-14Geometry Nodes: Add domain and data type to attribute searchHans Goudey
This patch adds domain and data type information to each row of the attribute search menu. The data type is displayed on the right, just like how the list is exposed for the existing point cloud and hair attribute panels. The domain is exposed on the left like the menu hierarchy from menu search. For the implementation, the attribute hint information is stored as a set instead of a multi-value map so that every item (which we need to point to descretely in the search process) contains the necessary data type and domain information by itself. We also need to allocate a new struct for every button, which requires a change to allow passing a newly allocated argument to search buttons. Note that the search does't yet handle the case where there are two attributes with the same name but different domains or data types in the input geometry set. That will be handled as a separate improvement. Differential Revision: https://developer.blender.org/D10623
2021-03-19Cleanup: rename x1/x2/y1/y2 to x/y/width/heightJacques Lucke
2021-03-16Compositor: Redesign Cryptomatte node for better usabilityJeroen Bakker
In the current implementation, cryptomatte passes are connected to the node and elements are picked by using the eyedropper tool on a special pick channel. This design has two disadvantages - both connecting all passes individually and always having to switch to the picker channel are tedious. With the new design, the user selects the RenderLayer or Image from which the Cryptomatte layers are directly loaded (the type of pass is determined by an enum). This allows the node to automatically detect all relevant passes. Then, when using the eyedropper tool, the operator looks up the selected coordinates from the picked Image, Node backdrop or Clip and reads the picked object directly from the Renderlayer/Image, therefore allowing to pick in any context (e.g. by clicking on the Combined pass in the Image Viewer). The sampled color is looked up in the metadata and the actual name is stored in the cryptomatte node. This also allows to remove a hash by just removing the name from the matte id. Technically there is some loss of flexibility because the Cryptomatte pass inputs can no longer be connected to other nodes, but since any compositing done on them is likely to break the Cryptomatte system anyways, this isn't really a concern in practise. In the future, this would also allow to automatically translate values to names by looking up the value in the associated metadata of the input, or to get a better visualization of overlapping areas in the Pick output since we could blend colors now that the output doesn't have to contain the exact value. Idea + Original patch: Lucas Stockner Reviewed By: Brecht van Lommel Differential Revision: https://developer.blender.org/D3959
2021-03-02UI: Rename search button variableHans Goudey
I landed D10527 in rB1a8aee0a7cec accidentally, and the version there was missing a name change discussed in review. This commit just renames the boolean variable controlling the special behavior for attribute search. Original message meant for this change: For geometry nodes we will use search buttons to display a list of attributes available the last time the node tree was executed (D10519). Because this list is just a hint, we need to be able to enter any string, not just strings from the search items. This patch adds a boolean option to string buttons to enable this. The change is quite simple, changes to behavior are only required in two places. The type-specific button struct changes help a lot here. Differential Revision: https://developer.blender.org/D10527
2021-03-02UI: Expose an "is first search" boolean to search button callbacksHans Goudey
Currently when you open an RNA collection search button, like a vertex group selector, the search filter isn't applied until you start typing, in order to display every option at the start. Otherwise they wouldn't be visible, since the search filter would run for the current text. Currently this check happens in one place, but it relies on the `changed` value of `uiBut`. This is fine in the interface directory, but anywhere else it would require exposing `uiBut.changed`, which is probably too low-level to expose. The solution is adding an `is_first` argument to the search callbacks, which is nice for a few reasons: - They work at a higher level of abstraction, meaning they don't have to worry about how exactly to tell if this is the first search. - It makes it easier to do special behavior when the search menu is first opened. - Then, obviously, it makes that state accessible without including `interface_intern.h`. Needed for attribute search: T85658 Differential Revision: https://developer.blender.org/D10528
2021-02-21UI: Correct the text alignment in the quick setup (splash screen) dialogYevgeny Makarov
The "quick setup" dialog is actually a 'menu', and the "splash screen" block contains the UI_BLOCK_LOOP flag which causes the buttons' text to align to the left, however, usually regular buttons have centered text. As a workaround, add the UI_BLOCK_QUICK_SETUP flag which prevents the text from being left-aligned. Differential Revision: https://developer.blender.org/D10486 Reviewed by: Julian Eisel
2021-02-18Fix failing "Edit Source" (asserts) while number slider was visibleJulian Eisel
E.g. steps to reproduce: * Enter Vertex Paint mode * In the tool settings, right-click > "Edit Source" When creating a number slider via `layout.prop(..., slider=True)`, the UI code would reallocate the number button to be a number-slider button. That's because we now actually have different button data-structures for these (see e6f0b60c2e911). The edit source code stored data based on the button pointers, which didn't get updated after changing the type. The fix just adds this updating.
2021-02-18Cleanup: Use const argument, decrease variable scopeHans Goudey
2021-02-13Cleanup: spellingCampbell Barton
2021-02-08Fix for T84038: Improved Report WarningsHarley Acheson
Improved contrast for Status Bar report warning messages. Differential Revision: https://developer.blender.org/D10242 Reviewed by Hans Goudey
2021-01-27UI: Tooltip for data-block selector menus, showing full name and library infoJulian Eisel
Long data-block names are clipped to fit into data-block selector menus. For linked data-blocks, there's also a hint indicating the source library, which takes further space and may get clipped too. So this commit adds a tooltip to the menu items, which displays the full, unclipped data-block name and the unclipped library name. Plus, the library path is shown too, which is also useful info. Adds helper functions for search menu item tooltips, so these are easier to add to other search menus in future. Part of T84188.
2021-01-27Cleanup: Use const parameters for active button lookups/testsJulian Eisel
Needed for const-correctness in the following commit.
2021-01-25Cleanup: pass 'rctf' rectangle to 2D box drawing functionsCampbell Barton
Passing 4x arguments for the rectangle, mixed in with round-box radius & color wasn't very readable. Instead, pass a `rctf` as the first argument to UI box drawing functions.
2021-01-25UI: Round-box drawing cleanupHarley Acheson
The new GPU_SHADER_2D_WIDGET_BASE shader allows us to draw many complex shapes with anti-aliasing. One thing it can do is draw an opaque rounded rectangle with colors that differ between its interior and outline. In order to do the above in a single pass I recently added an "_ex" version of UI_draw_roundbox that exposes most of that shaders features. This simplifies interface_draw.c by removing redundancy in the calling of this shader by using this new uber "_ex" version. Ref D10189
2021-01-25Cleanup: remove unused UI_draw_roundbox_shade_y functionCampbell Barton
Marked unused 2017 f69678482c849d873b9686cd6068946205db7c2b) Remove since this remains unused, split from D10189 to allow reverting if we ever need it back.
2021-01-24UI: Viewport Navigate Gizmo RefactorHarley Acheson
Simplification and changes to the Navigation gizmo. Better indication of negative axes, consistent use of color and size to indicate orientation, ability to be resized. Differential Revision: https://developer.blender.org/D9744 Reviewed by Campbell Barton
2021-01-20Cleanup: remove extra in trailing asteriskCampbell Barton
Comment blocks not conforming to convention.
2021-01-13UI: Revert design changes to data-block selector for the 2.92 releaseJulian Eisel
Partially reverts 2250b5cefee7. Removing the user count and fake user count icons was controversial (which was expected) and there are a few further changes needed, that won't make it in time for the release, see D9946. While there is a design to bring back the user count and fake user indicators, a new design idea was proposed that the UI team wants to follow. This came too late for the 2.92 release, the new design is targeted at the 2.93 release now. Meanwhile, UI team decision was to simply revert the design changes. The new design is being worked on in https://developer.blender.org/T84669. Note that this commit does not revert some internal changes done in 2250b5cefee7. Namely the introduction of `ed_util_ops.c` and data-block operators in there. These will still be needed in the new design.
2021-01-05Cleanup: remove redundant RNA_types.h header from UI_interface.hCampbell Barton
2021-01-05Cleanup: typos (repeated words)Campbell Barton
2020-12-28Cleanup: Typo: `overriden` -> `overridden`.Bastien Montagne
2020-12-19Cleanup: Use typedef for UI emboss type enumHans Goudey
Previously both `char` and `int` were used to represent this enum. Differential Revision: https://developer.blender.org/D9903
2020-12-19Fix T83868: Button animation states no longer visible without embossHans Goudey
This bug was caused by making it so that non-embossed modifier icon buttons could become an operator button and retain their red highlight for disabled modifiers. The icon button needs emboss turned off, but in earlier versions of Blender, `UI_EMBOSS_NONE` would be overridden by animation or red alert states. Instead of abusing "NONE" to mean "none unless there is animation or red alert", this commit adds a new emboss flag for that situation, `UI_EMBOSS_NONE_OR_STATUS`, which uses no emboss unless there is an animation state, or another status. There are only a few situations where this is necessary, so the change isn't too big. Differential Revision: https://developer.blender.org/D9902
2020-12-18UI: Redesigned data-block selectorsJulian Eisel
The previous design is rather old and has a couple of problems: * Scalability: The current solution of adding little icon buttons next to the data-block name field doesn't scale well. It only works if there's a small number of operations. We need to be able to place more items there for better data-block management. Especially with the introduction of library overrides. * Discoverability: It's not obvious what some of the icons do. They appear and disappear, but it's not obvious why some are available at times and others not. * Unclear Status: Currently their library status (linked, indirectly linked, broken link, library override) isn't really clear. * Unusual behavior: Some of the icon buttons allow Shift or Ctrl clicking to invoke alternative behaviors. This is not a usual pattern in Blender. This patch does the following changes: * Adds a menu to the right of the name button to access all kinds of operations (create, delete, unlink, user management, library overrides, etc). * Make good use of the "disabled hint" for tooltips, to explain why buttons are disabled. The UI team wants to establish this as a good practise. * Use superimposed icons for duplicate and unlink, rather than extra buttons (uses less space, looks less distracting and is a nice + consistent design language). * Remove fake user and user count button, they are available from the menu now. * Support tooltips for superimposed icons (committed mouse hover feedback to master already). * Slightly increase size of the name button - it was already a bit small before, and the move from real buttons to superimposed icons reduces usable space for the name itself. * More clearly differentiate between duplicate and creating a new data-block. The latter is only available in the menu. * Display library status icon on the left (linked, missing library, overridden, asset) * Disables "Make Single User" button - in review we weren't sure if there are good use-cases for it, so better to see if we can remove it. Note that I do expect some aspects of this design to change still. I think some changes are problematic, but others disagreed. I will open a feedback thread on devtalk to see what others think. Differential Revision: https://developer.blender.org/D8554 Reviewed by: Bastien Montagne Design discussed and agreed on with the UI team, also see T79959.
2020-12-16Cleanup: remove redundant struct declarationsCampbell Barton