`ActionSlot::idtype` needs some extra care when reading from a blend
file. Blender's generic endian switching needs to be un-done, as the
ID type values are not numerically the same between little and big
endian machines. Due to the way they are defined, they are always in
the same byte order, regardless of hardware/platform endianness.
This is the same for Action Slots as #128129 does for Actions, except
that Action Slots use a `int16_t` instead of `short` and thus don't
need a cast.
Pull Request: https://projects.blender.org/blender/blender/pulls/128438
Instead of setting the directory empty so it's initialized to the root,
use a variable which can be set when there are problems expanding the
path. This is then checked once at the end.
Also avoid inlining platform specific root directory access.
This was already done in GHOST, but not BKE_appdir_folder_home.
Also null check the return value from getpwuid() as it's not
guaranteed to be non-null.
Using `//` for unsaved files isn't meaningful, instead of replacing
with a "default" directory, clear the input to avoid confusing
users as to the meaning of the prefix.
Also pass arguments Main & FileSelectParams to file_expand_directory
instead of the context as this is a lower level function thats
only ever called when these values are known & doesn't run
the appropriate refresh functions needed to be called on it's own.
The `transformEvent` function is becoming increasingly complex due to
the inclusion of operation-specific code.
To improve this, remove the `handled` boolean and allow each
`TransModeInfo::handle_event_fn` to determine how to handle already
processed events.
Additionally, move some operation-specific logic to the operators file.
Note:
The `handled` boolean was added in aef307cf31 to fix a bug with the
custom events of the Edge and Vertex Slide operators;
It was possible to navigate to a CWD relative path if it was entered
in the directory and it happened to exist
(or entering relative paths: `./`, `../` etc).
After this, navigation in the file selector didn't work well, any paths
loaded would depend on the directory Blender was started in.
While CWD relative paths aren't prevented & can even be useful when
using paths passed in by scripts - there is no need for the file
selector to expose them to the user - potentially forwarding CWD
relative paths to operators where they can cause further problems.
Entering a single word (for example) in the file selectors directory
would ask to create the director, which then created the directory
relative to the processes CWD, then set a CWD relative path.
From the users perspective this is strange as it's unclear where
the directory was created the path would not show the CWD prefix.
Resolve by checking the path is absolute and at least one of the parent
paths exists before prompting the user to create the path.
Resolve part of the strange behavior from #128567.
The paths `C:` (on WIN32) and `/` on other systems was detecting as
relative. This meant `BLI_path_abs_from_cwd` would make both paths
CWD relative. Also remove duplicate call to BLI_path_is_unc.
Regression in [0] which didn't account for entering paths in the
file selector which would create paths without confirming,
warning that the "confirm" property was missing.
Entering `*.*` would create `_._` for e.g in the users CWD for example.
Ref !128568
[0]: 6dd0f6627e.
This is due to wrong `is_pad` is passed as argument. It should be false
for gizmo tooltips. For menus when fields size is zero i.e. no
element is appended yet, the python message will be at the top of
tooltip region.
Pull Request: https://projects.blender.org/blender/blender/pulls/128243
This renames the mode identifiers to be consistent with e.g. the context mode identifiers and other names used for the new Grease Pencil.
For `object.mode`:
* `PAINT_GPENCIL` -> `PAINT_GREASE_PENCIL`
* `SCULPT_GPENCIL` -> `SCULPT_GREASE_PENCIL`
* `VERTEX_GPENCIL` -> `VERTEX_GREASE_PENCIL`
* `WEIGHT_GPENCIL` -> `WEIGHT_GREASE_PENCIL`
For the internal `ob->mode` flag:
* `OB_MODE_PAINT_GPENCIL_LEGACY` -> `OB_MODE_PAINT_GREASE_PENCIL`
* `OB_MODE_SCULPT_GPENCIL_LEGACY` -> `OB_MODE_SCULPT_GREASE_PENCIL`
* `OB_MODE_VERTEX_GPENCIL_LEGACY` -> `OB_MODE_VERTEX_GREASE_PENCIL`
* `OB_MODE_WEIGHT_GPENCIL_LEGACY` -> `OB_MODE_WEIGHT_GREASE_PENCIL`
Resolves#127374.
Pull Request: https://projects.blender.org/blender/blender/pulls/128604
Instead of calling `BKE_nlastrip_new()` (which, due to backward compat
reasons automatically picks a slot), the Push Down operator now calls
`BKE_nlastrip_new_for_slot()`, which explicitly assigns the given slot.
On top of that, the frame range of the slot is used to set the strip's
frame range (instead of the range of the entire Action).
Pull Request: https://projects.blender.org/blender/blender/pulls/128444
Instead of using direct property manipulation to enter tweak mode, use
the regular `animrig::assign_…` functions. When used in the right order,
as introduced in this commit, the "disallow assigning an Action in tweak
mode" logic can just stay simple as it is.
This changes the include directive to use the standard C preprocessor
`#include` directive.
The regex to applied to all glsl sources is:
`pragma BLENDER_REQUIRE\((\w+\.glsl)\)`
`include "$1"`
This allow C++ linter to parse the code and allow easier codebase
traversal.
However there is a small catch. While it does work like a standard
include directive when the code is treated as C++, it doesn't when
compiled by our shader backends. In this case, we still use our
dependency concatenation approach instead of file injection.
This means that included files will always be prepended when compiled
to GLSL and a file cannot be appended more than once.
This is why all GLSL lib file should have the `#pragma once` directive
and always be included at the start of the file.
These requirements are actually already enforced by our code-style
in practice.
On the implementation, the source needed to be mutated to comment
the `#pragma once` and `#include`. This is needed to avoid GLSL
compiler error out as this is an extension that not all vendor
supports.
Rel #127983
Pull Request: https://projects.blender.org/blender/blender/pulls/128076
The `paint.brush_colors_flip` option was not exposed in the vertex color
panel.
This adds the toggle in the panel and also adds the keymap `X` to flip
the colors.
The tint color and panel was not used consistently.
In Vertex Paint mode we're using the unified paint settings,
but in Draw mode, we only use the brush color for tinting.
This fixes the issue by using the unified paint settings
for all the uses of the vertex color.