Age | Commit message (Collapse) | Author |
|
|
|
Alternative to D13291 (description partially copied from there).
New drag & drop reordering code would call constraints reordering
operator with the generic context, and not the one from the panel's
layout. missing the "constraint" member which is mandatory for poll
function to properly deal with override vs. local constraints.
For this to work in a decent way, there needs to be some panel-wide
context that we can restore when executing callbacks outside of the
normal draw context. So similar to uiLayoutSetContextPointer() to set
context on a layout level, this introduces
UI_panel_context_pointer_set() for panel level context (this calls the
former for the current panel root layout as well).
Differential Revision: https://developer.blender.org/D13308
|
|
Use a map to speed up search for UI block names.
Time to redraw the node editor was decreased from
around 75-120ms to 40-70ms in a tree with many
Geometry Nodes.
Differential Revision: https://developer.blender.org/D13225
|
|
|
|
Addresses T77127 (Controller Drawing).
Adds VR controller visualization and custom drawing via draw
handlers. Add-ons can draw to the XR surface (headset display) and
mirror window by adding a View3D draw handler of region type 'XR' and
draw type 'POST_VIEW'. Controller drawing and custom overlays can be
toggled individually as XR session options, which will be added in a
future update to the VR Scene Inspection add-on.
For the actual drawing, the OpenXR XR_MSFT_controller_model extension
is used to load a glTF model provided by the XR runtime. The model's
vertex data is then used to create a GPUBatch in the XR session
state. Finally, this batch is drawn via the XR surface draw handler
mentioned above.
For runtimes that do not support the controller model extension, a
a simple fallback shape (sphere) is drawn instead.
Reviewed By: Severin, fclem
Differential Revision: https://developer.blender.org/D10948
|
|
Match eSpace_Type.
|
|
|
|
|
|
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.
|
|
This new layout type is meant for the upcoming asset view UI template.
With it it is possible to show big asset previews with their names in a
responsive grid layout.
Notes:
* The layout is only available for C defined UI lists. We could expose
it to Python, but I think there are still some scrolling issues to be
fixed first. (The asset view template doesn't use scrolling for the UI
list.)
* I'd consider this a more usable version of the existing `GRID` layout
type. We may remove that in favor of the new one in future.
|
|
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.
|
|
Also use doxy style function reference `#` prefix chars when
referencing identifiers.
|
|
|
|
|
|
Some DNA headers already did this, most did not. Even though many of them would
be included in C++ files and thus compiled as C++. This would be confusing and
developers may think they have to add `extern "C"` too a whole lot of
(indirect) includes to be able to use a C header in C++.
However, this is a misconception.
`extern "C"` does not cause code to be compiled with C rather than C++! It only
causes the linker to not use C++ function name mangling. See
https://stackoverflow.com/a/1041880.
Because extern DNA headers don't have function declarations, using `extern "C"`
actually should not have any effect. On the other hand, adding it causes no
harm and avoids confusion. So let's just have it consistently in C header
files.
Differential Revision: https://developer.blender.org/D9578
Reviewed by: Bastien Montagne, Sybren Stüvel
|
|
Since this flag isn't saved in files and PanelType itself is defined in
BKE, the flag makes more sense there.
|
|
|
|
This was a remnant of floating panels from the horizontal layout in
pre 2.5 horizontal panels.
|
|
There should not be much user visible here (other than T73668 being addressed).
I added the writing code already for the initial implementation of workspaces,
but we decided to keep it disabled until the top-bar design is more clear. It
was never planned to keep this disabled for so long.
Fixes T73668.
|
|
This commit uses an enum to access expansion for specific panels for
each modifier, constraint, etc. Even though these values are quite simple,
this can help make the code more explicit when the ui_expand_flag is
accessed directly. Also update comments about this bitfield to make
them consistent.
|
|
This commit makes the panel expansion set based on the search results
when the active tab in the properties editor changes. The multi-tab
search patch (D8859) actually doesn't handle this because it uses a
different code path.
This feature uncovered a subtle but fairly significant issue with the
implementation of property search (More details in T81113). Basically,
the search needed multiple redraws to properly display the expansion of
panels based on the search results. Because there is no animation of
panel expansion when switching tabs, the problem was exposed only now.
With this commit, hiding of "search only" buttons and panel size
calculation happens in a single final step of the panel layout pass.
The "search only" layout root flag is removed. Instead every button
inside a panel header is in a single "uiButtonGroup" marked with a
specific "in header" flag, an idea which could be generalized in the
future.
Differential Revision: https://developer.blender.org/D9006
|
|
Define enum `eContextResult` and use its values for returns, instead of
just returning 1, 0, or -1 (and always having some comment that explains
what -1 means).
This also cleans up the mixup between returning `0` and `false`, and `1`
and `true`. An inconsistency was discovered during this cleanup, and
marked with `TODO(sybren)`. It's not fixed here, as it would consititute
a functional change.
The enum isn't used everywhere, as enums in C and C++ can have different
storage sizes. To prevent issues, callback functions are still declared
as returning`int`. To at least make things easier to understand for
humans, I marked those with `int /*eContextResult*/`.
This is a followup of D9090, and is intended to unify how context
callbacks return values. This will make it easier to extend the approach
in D9090 to those functions.
No functional changes.
Differential Revision: https://developer.blender.org/D9095
|
|
|
|
This adds a search bar to the properties editor. The full search for
every tab isn't included in this patch, but the interaction with
panels, searching behavior, UI, region level, and DNA changes are
included here.
The block-level search works by iterating over the block's button
groups and checking whether they match the search. If they do, they
are tagged with a flag, and the block's panel is tagged too. For
every update (text edit), the panel's expansion is set to whether
the panel has a result or not. The search also checks for matching
strings inside enums and in panel labels.
One complication to this that isn't immediately apparent is that
closed panel's subpanels have to be searched too. This adds some
complexity to the area-level panel layout code.
Possible Future Improvements:
- Use the new fuzzy search in BLI
- Reset panels to their expansion before the search started if
the user escape out of the text box.
- Open all child panels of a panel with expansion.
Differential Revision: https://developer.blender.org/D8856
|
|
For modifier shortcuts we added a "custom_data" field to panels.
This commit uses the same system for accessing the list data that
corresponds to each panel. This way the context is only used once
and the modifier for each panel can be accessed more easily later.
This ends up being mostly a cleanup commit with a few small changes
in interface_panel.c. The large changes in the UI functions are due
to the fact that the panel custom data is now passed around as a
single pointer instead of being created again for every panel.
The list_index variable in Panel.runtime is removed as it's now
unnecessary.
Differential Revision: https://developer.blender.org/D8559
|
|
Horizontal panel alignment hasn't been used for years, and we have no
plans to use it in the future. It adds a fair amount of complexity to
the panel code which makes adding features take longer.
This code removes the X closing flag, and all of the logic / variables
unused without it.
This commit includes a file subversion bump.
Differential Revision: https://developer.blender.org/D8601
|
|
This RNA/BPY function was removed in c08d84748804. For understandable
reasons really-- getting scene statistics from a string displayed in the
status bar is not exactly the best design. But we have committed to not
changing the RNA API too much for the 2.90 release, so we would like to
keep this functionality.
Differential Revision: https://developer.blender.org/D8604
Reviewd by: Julian Eisel
|
|
Checks for header alignment didn't account for tool-header & header
having different alignment.
There is no reason to use a lookup function on the area
(ED_area_header_alignment) as we already have region.
Check the regions alignment directly, remove access functions.
|
|
The existing header flip detection didn't account for mixed
tool-header and header flipping & visibility between space-types.
Now alignment syncing handles any combination of header,
tool-header & footer flipped state, in a way that can be extended
to other region types in the future.
|
|
This replaces header include guards with `#pragma once`.
A couple of include guards are not removed yet (e.g. `__RNA_TYPES_H__`),
because they are used in other places.
This patch has been generated by P1561 followed by `make format`.
Differential Revision: https://developer.blender.org/D8466
|
|
Status Bar can show scene statistics, memory usage, version, etc set by context menu. Part two of T75672.
Differential Revision: https://developer.blender.org/D7557
Reviewed by Julian Eisel
|
|
Some code delt with panel merging in earlier versions of Blender,
which is no longer needed. Other code delt with controls that aren't
used anymore, and in some cases have region-level equivalents.
There's a surprising amount of this unused code in this file, so removing it
will be helpful for the future.
Differential Revision: https://developer.blender.org/D7938
|
|
|
|
The shortcuts act on the modifier with its panel under the mouse.
The following shortcuts are enabled by default:
- Remove modifier: X, Delete
- Apply modifier: Ctrl A
- Duplicate modifier: Shift D
More shortcuts can be added in the keymap.
Each panel can now store a custom data RNA pointer, and a new
function is added to get the custom data for the panel under the
cursor. This custom data could be used to refactor the "List Panel
System" to generalize it and integrate it further with RNA.
The same functionality will be added in further commits where it
applies to constraints, grease pencil modifiers, and effects.
Differential Revision: https://developer.blender.org/D8031
|
|
To make a better distinction with region overlay.
|
|
Function used int for everything.
|
|
This implements a general system to implement drag and drop, subpanels,
and UI animation for the stack UIs in Blender. There are NO functional
changes in this patch, but it makes it relatively trivial to implement
these features for stacks.
The biggest complication to using panels to implement the UI for lists
is that there can be multiple modifiers of the same type. Currently there
is an assumed 1 to 1 relationship between every panel and its type, but
there can be multiple list items of the same type, so we have to break
this relationship. The mapping between panels and their data is stored
with an index in the panel's runtime struct.
To make use the system for a list like modifiers, four components
must be added:
1. A panel type defined and registered for each list data type, with a
known mapping between list data types and panel idnames.
1. A function called by interface code to build the add the panel
layouts with the provided helper functions.
- UI_panel_list_matches_data will check if the panel list needs to
be rebuilt.
- UI_panels_free_instanced will remove the existing list panels
- UI_panel_add_instanced adds a list panel of a given type.
3. An expand flag for the list data and implementations of
get_list_data_expand_flag and set_list_data_expand_flag.
4. For reordering, the panel type's reorder callback. This is called
when the instanced panels are drag-dropped. This requires
implementing a "move to index" operator for the list data.
Reviewed By: Severin, brecht
Differential Revision: https://developer.blender.org/D7490
|
|
Avoids accidents when adding/removing items from an enum.
|
|
|
|
The old convention was easy to confuse with ScrArea.
Part of https://developer.blender.org/T74432.
This is mostly a batch rename with some manual fixing. Only single word
variable names are changed, no prefixed/suffixed names.
Brecht van Lommel and Campbell Barton both gave me a green light for
this convention change.
Also ran clan clang format on affected files.
|
|
Avoids having to check the current area is NULL.
|
|
|
|
|
|
NOTE: This change shouldn't have any visible effect. It's just the
first (easiest) step towards decoupling gizmo redraws from viewport
redraws.
We currently redraw the entire region whenever a gizmo needs redrawing,
which would be nice to avoid in the future, see T73198. The first step
towards this would be having a separate tag for them, which is what
this patch implements.
The term "editor-overlays" was chosen because for the forseeable future,
we'll also have to redraw non-gizmo overlays in-between drawing 3D and
2D gizmos. Namely annotations.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D6838
|
|
Panel alignment was only updated when panel size changed. Now we can
also recognize changes in the category tabs offset and tag panels
for alignment updates.
|
|
This should only be used to change and recalculate region sizes in a DPI
independent way. To get the size with DPI applied, ARegion.winx/y should
be used instead.
Added note on this in comment.
|
|
Previously the decimation would take the whole curve into account when
decimating and not just the selected part.
This also contains various smaller bug fixes for the fcurve decimation.
Reviewed By: Sybren
Differential Revision: http://developer.blender.org/D6286
|
|
To recreate the main issue:
* Set render and file browser to show in full-screen in the preferences
* Default scene, press F12 in 3D View
* Press Alt+S to save the image
* Escape the file browser
* Escape the image editor
The former 3D View would now show the image editor. This is a common
use-case that should work.
Full-screen code is a hassle to get to work as expected. There are
reports from 2.5, I did lots of work years ago to get these kind of
use-cases to work fine. But apparently I broke this one with a fix for
another common use-case in March (0a28bb14222c).
This now stores hints in the space, rather than the area, which should
make things much more controlable and hopefully help us fix issues like
this.
Here are a few references describing further common issues (all should
work fine now): 0a28bb14222c, e61588c5a544, T19296
Checked over this with Bastien, we agreed that at some point we should
do a big rewrite of all of this, for now this is acceptable.
|
|
|
|
Avoids calculating the visible part of a region whenever
on-screen overlays are drawn.
|