This unifies vertex and texture data formats
into a single base enum class.
`TextureFormat` and `VertexFormat` then mask
the invalid format for their respective usage.
Having a base enum allows casting between
`TextureFormat` and `VertexFormat` possible
(needed for Buffer Textures).
It also makes it easier to write and read data
to buffers/textures as each format will have an
associated host type.
These enum is generated from MACRO expansion.
This allow to centralize all information about
the formats in one place. This avoid duplicating
the list of enums for each backend.
This only creates the new enum. Porting older enums will
be done in other PRs.
Normalized integer CPU format are missing and waiting for #130640
Rel #130632
Pull Request: https://projects.blender.org/blender/blender/pulls/138069
Adjust the logic in `view_zoomstep_apply_ex` to ensure that spaces
without the new flag `V2D_ZOOM_IGNORE_KEEPOFS` will still zoom if they
do not also have `keepofs` flags set.
This means spaces like Geometry Nodes can zoom again.
Create an option in `View2D.flag` that allows us to have separate
behavior for area resizing (left aligned with `V2D_KEEPOFS_X`) and
zooming (centered with the keepofs flags disabled). Add this to the
versioning code.
Pull Request: https://projects.blender.org/blender/blender/pulls/138041
Previously spell checker ignored text in single quotes however this
meant incorrect spelling was ignored in text where it shouldn't have
been.
In cases single quotes were used for literal strings
(such as variables, code & compiler flags),
replace these with back-ticks.
In cases they were used for UI labels,
replace these with double quotes.
In cases they were used to reference symbols,
replace them with doxygens symbol link syntax (leading hash).
Apply some spelling corrections & tweaks (for check_spelling_* targets).
We can apply the `V2D_KEEPZOOM` and `V2D_KEEPOFS_Y` flags to the main VSE
region to make sure this happens. If `V2D_KEEPZOOM` is set, we should update
the view2d's `oldwinx` and `oldwiny` in `ui_view2d_curRect_validate_resize`
just like the `V2D_KEEPASPECT` case.
Divide-by-zero is a real possibility here, since initialization status of
`oldwinx/y` cannot be determined from the `resize` boolean alone (e.g. loading
regions from disk on startup yields a `true` `resize` parameter, so any old
regions that have `KEEPZOOM` added through versioning will get this error since
their `oldwinx/y` is uninitialized). Avoid by initializing `oldwinx/y` if it is zero in
`ui_view2d_curRect_validate_resize`.
Addresses #136508.
Pull Request: https://projects.blender.org/blender/blender/pulls/137802
It's safer to pass a type so that it can be checked if delete should be
used instead. Also changes a few void pointer casts to const_cast so that
if the data becomes typed it's an error.
Pull Request: https://projects.blender.org/blender/blender/pulls/137404
Masks for scrollbars were properly shrunk to match their drawn
representation in #135021, however, click logic was not updated
alongside this change.
For one, `mouse_in_scroller_handle` incorrectly assumed that if the
slider filled up the entire scrollbar extents, we would only be able to
select the bar. This code never ran in practice since `scrollers` were
always smaller than their mask, but now that they're the right size,
it's being run. Fix by removing the case.
It is also guaranteed that the "scroller"/"bubble"/"thumb" is not out of
view of the scrollbar track itself because it is clamped at the end of
`view2d_scrollers_calc` (which always runs before
`mouse_in_scroller_handle`), so this is dead code that can be removed.
Finally, rename `mouse_in_scroller_handle` to `scrollbar_zone_get` to
better represent its function.
Pull Request: https://projects.blender.org/blender/blender/pulls/137437
Currently scroll bars that are in regions that are set to "region
overlap" (like Tool Bar and Side Bar using a transparent background)
will fully hide when your mouse is not near them. This PR removes that
feature so that they are treated like in other areas. This way you can
always see that there are portions of the region scrolled away and what
proportion. A less jarring transition since it is only 0.4 - 1.0,
rather than 0.0 - 1.0.
Pull Request: https://projects.blender.org/blender/blender/pulls/136571
This fixes most "One Definition Rule" violations inside blender proper
resulting from duplicate structures of the same name. The fixes were
made similar to that of !135491. See also #120444 for how this has come
up in the past.
These were found by using the following compile options:
-flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing
Note: There are still various ODR issues remaining that require
more / different fixes than what was done here.
Pull Request: https://projects.blender.org/blender/blender/pulls/136371
Use enum types for event modifier and types,
`wmEventModifierFlag` & `wmEventType` respectively.
This helps with readability and avoids unintended mixing with other
types. To quiet GCC's `-Wswitch` warnings many `default` cases needed
to be added to switch statements on event types.
Ref !136759
Callbacks: exec invoke & modal now use a typed enum wmOperatorStatus.
This helps avoid mistakes returning incompatible booleans or other
values which don't make sense for operators to return.
It also makes it more obvious functions in the WM API are intended
to be used to calculate return values for operator callbacks.
Operator enums have been moved into DNA_windowmanager_enums.h
so this can be used in other headers without loading other includes
indirectly.
No functional changes expected.
Ref !136227
Mouse and action zone interaction for scrollbars depend on `v2d->vert`
and `v2d->hor`, which are updated through `view2d_masks`. However,
scrollbar drawing through `UI_view2d_scrollers_draw` calls
`view2d_scrollers_calc`, which pads these sizes further, meaning that
drawn scrollbars are slightly out of sync with their hotspots. This is
noticeable at track edges for shrinking scrollers or when tracks are
opaque. Fix by moving the extra (noticeable) padding code from
`view2d_scrollers_calc` to `view2d_masks`.
Pull Request: https://projects.blender.org/blender/blender/pulls/135021
The general idea is to keep the 'old', C-style MEM_callocN signature, and slowly
replace most of its usages with the new, C++-style type-safer template version.
* `MEM_cnew<T>` allocation version is renamed to `MEM_callocN<T>`.
* `MEM_cnew_array<T>` allocation version is renamed to `MEM_calloc_arrayN<T>`.
* `MEM_cnew<T>` duplicate version is renamed to `MEM_dupallocN<T>`.
Similar templates type-safe version of `MEM_mallocN` will be added soon
as well.
Following discussions in !134452.
NOTE: For now static type checking in `MEM_callocN` and related are slightly
different for Windows MSVC. This compiler seems to consider structs using the
`DNA_DEFINE_CXX_METHODS` macro as non-trivial (likely because their default
copy constructors are deleted). So using checks on trivially
constructible/destructible instead on this compiler/system.
Pull Request: https://projects.blender.org/blender/blender/pulls/134771
This patch registers scrollbars with handles so that they shrink just
like their non-handle counterparts.
To avoid user errors related to clicking into the handle track instead
of the underlying view, if the final alpha of the track is invisible (0)
then it will range up to 0.25 instead.
Pull Request: https://projects.blender.org/blender/blender/pulls/135023
Move the code dealing with converting float3 to GPU normals
out of the vertex format header into a separate header. Use a
proper C++ namespace and remove duplication by only using
the more recently added C++ templated conversions.
Most of the diff comes from the removal of the indirect includes
from GPU_vertex_format.hh. A lot of files ended up mistakenly
depending on that.
Pull Request: https://projects.blender.org/blender/blender/pulls/134873
Also correct argument handling when Python arguments were passed in,
which were attempting to handle the following parameters as arguments
instead of skipping them.
As proposed in #98518, this moves all `View2D` files into
a `source/blender/editors/inteface/view2d/` directory. This helps
keeping the `interface/` directory clean. In general I think we should
promote a more modular thinking, where coherent parts of the code form a
module or sub-module. The directory structure and its files can reflect
that nicely.
Pull Request: https://projects.blender.org/blender/blender/pulls/132853