BLI code for enums that are meant to be used as "bit flags" defined
an ENUM_OPERATORS macro in BLI_utildefines.h. This cleans up things
related to said macro:
- Move it out into a separate BLI_enum_flags.hh header, instead of
"random bag of things" that is the current place,
- Update it to no longer need manual indication of highest individual
bit value. This originally was added in a31a87f89 (2020 Oct), in
order to silence some UBSan warnings that were coming
from GPU related structures (looking at current GPU code, I don't
think this is happening anymore). However, that caused actual
user-visible bugs due to incorrectly specified max. enum bit value,
and today 14% of all usages have incorrect highest individual
bit value spelled out.
- I have reviewed all usages of operator ~ and none of them are
used for directly producing a DNA-serialized value; all the
usages are for masking out other bits for which the new ~
behavior that just flips all bits is fine.
- Make the macro define flag_is_set() function to ease check of bits
that are set in C++ enum class cases; update existing cases to use
that instead of three other ways that were used.
Pull Request: https://projects.blender.org/blender/blender/pulls/148230
This was caused by 3dfec1ff73
which introduce the new behavior. This was to fix workflows
using a lot of semi-transparent objects which made nagivation
difficult.
This patch first roll back to the previous behavior: The
unselectable object will affect depth-aware operators.
This patch introduces a new visibility property to remove
the influence of objects in all depth picking operations
and selection operations. However the object is still
selectable through non-drawing selection operators
(e.g. select by material) and through the outliner.
This is to adress the aforementionned navigation issues.
Pull Request: https://projects.blender.org/blender/blender/pulls/146706
Snap translation to the world grid when absolute grid increments is
enabled. Previously, absolute increment snap shifted in perspective
view, causing objects to misaligned with the world grid.
Resolves regression introduced since 3.6.
Ref !147246
Resolve regression in [0] which hid transform overlay in the image view.
The indicator now displays when overlays are enabled in the UV editor.
[0]: 1df4a09539
The flag that skips objects for snapping (`BA_SNAP_FIX_DEPS_FIASCO`) is
set for all objects that have a `DEG_OB_COMP_TRANSFORM` relation.
However, when the **Affect Only Parent** option is enabled, children
are not transformed and therefore could still be snapped to.
Despite this, the `DEG_OB_COMP_TRANSFORM` dependency remains present on
them.
To address this, a new callback was introduced that skips
Transform-to-Transform dependencies while preserving
Transform-to-Geometry dependencies in this scenario.
This approach may introduce some false positives, leading to spurious
dependency cycles (e.g., when constraints are involved).
Nevertheless, the trade-off favors accepting these false positives
rather than disabling the feature altogether.
Also make non-functional change that just removes a flag before the snap
loop, thus avoiding checking if the flag exists inside the loop.
Ref !142007
Move the selection flag for pose bones, from the (edit)bone to the
pose bone.
Previously having multiple instances of armatures in pose mode at the
same time caused issues because selecting a pose bone on one armature
would automatically select it on all instances of it.
This is now fixed since the selection state is stored on the pose bone
(Object level) Doing so breaks API compatibility with 4.5 since the
RNA property on the Bone no longer affects the pose bone. Instead,
there is a new property on the pose bone for that.
Due to this change, some runtime flags for the transform system also
had to be moved to the pose bone. This is due to the fact that these
flags are used by the transform system to pass information between
functions. If we keep the flag at the bone level, this wouldn't work
with armature instances. See `bPoseChannelRuntimeFlag`
Fixes#117892
Pull Request: https://projects.blender.org/blender/blender/pulls/146102
Support sync selection in the UV editor, with face-corner selection,
so it's possible to select individual UV vertices/edges in the UV editor
without UV's attached to the same underlying edge also becoming selected.
There is limited support for maintaining the UV selection when selecting
from the 3D viewport, common operations such as picking &
box/circle/lasso select support this, however other selection operations
such as "Select Random" or "Select Similar" will clear this data,
causing all UV's connected to selected mesh elements to become selected.
We may add support for additional operators as needed.
Details:
- UV Sync Selection is now enabled by default.
- In edit-mode the UV selection is stored in BMLoop/BMFace which are
written to custom-data layers when converted to a Mesh.
- To avoid unnecessary overhead - this data is created on demand.
Operators may clear this data - selecting all or none do so,
as there is no reason to store this data for a uniform selection.
- The Python API includes functions to synchronize the selection to/from
UV's as well as flushing based on the mode.
- Python scripts that manipulate the selection will either need to clear
this synchronized state or maintain it.
See:
- Design task: #78393.
- Implementation task: #131642.
Ref !138197
This happened if proportional editing was enabled in editmode, not
having an active object plus being in object mode.
The transform system `convert_type_get` assumes
`TransConvertType_Object` if we dont have an active view layer object.
Corresponding code for proportional editing detection [in
`initTransInfo` & `saveTransform`] wasnt though (it used `toolsettings`
`proportional_edit` -- not `proportional_objects` -- in that case).
This is now corrected.
Probably caused by e91d581167
Pull Request: https://projects.blender.org/blender/blender/pulls/147193
This is because `snap_obj_fn` checks `SnapObjectParams` `edit_mode_type`
for not being `SNAP_GEOM_FINAL` even if the curve is not in editmode.
Probably an oversight in [0] which changed this for
`nearest_world_object_fn` and `raycast_obj_fn` (but not `snap_obj_fn`).
The reason it worked in non-XRay-shading mode is that another codepath
is taken then (`raycastObjects` instead of `snapObjectsRay` where this
is not an issue -- the then used `raycast_obj_fn` had the correct check
already, see above).
[0]: ab3e470b35
Ref 147121
The check to draw transform constraints was returning too early and
skipping the later check for the `V3D_HIDE_OVERLAYS` flag.
This meant that transform constraints (e.g. when moving over X axis)
were always shown even when all overlays were turned off, which can
be very distracting.
Fix it by switching the check, so it returns false if the region is
not the same, but continues happily if it is.
See PR for details and screenshots.
Pull Request: https://projects.blender.org/blender/blender/pulls/147132
Operators that use BKE_unit_value_as_string results in numbers with a
changing fractional part which frequently jumps around.
The issue became more noticeable with centrally aligned status text,
see !139507.
Address this by disabling stripping of trailing zeros for:
- `translate_dist_to_str`
(used by object translation, extrude, rip region).
- Mesh bevel
- Inset faces
- Shrink/fatten
- Eyedropper depth sampling (e.g. in camera DOF)
Ref !140790
This PR adds an option "Affect Gizmo" for custom shape transforms to affect
the transform gizmos. If enabled, this will place the gizmo at the
location and orientation of the "Override Transform" (i.e. in its local space).
For Orientations: The gizmo mode *is* respected. I.e. global mode is aligned to the world etc.
There is a special case for "Gimbal" where it will not follow the orientation of the
"Override Transform" bone. I think it makes sense to keep it that way since this
is about the channels of the bone you are actually manipulating.
The other option is "Use as Pivot" with which the bone is actually rotated
around the override bone. This can be useful for rigs in which shapekeys and
armature deformation is combined
Taken over from #136468
For design task #135429
Co-authored-by: Wayde Moss <wbmoss_dev@yahoo.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/142847
Currently, the frame scrub area shows different frame numbers based on
the zoom level. But they would not show frame 24 until you zoom in. Since 24
is the most used frame rate for animation that's inconvenient because you never
see the spot with the full second.
With this PR the numbers and lines depend on the frame rate, and will favor
full seconds, then divide by either 2, 3 or 5 to break down the number.
This works for most FPS values, however custom FPS may hit a prime number, in which case
this logic is aborted and the next step down when zooming in will be 1. This can
result in quite large gaps where no frame numbers are displayed. But I think the impact
will be small since large prime number frame rates are rare.
This patch also reduces UI jumping because the major lines will always be turned into minor lines before disappearing.
When zooming in, any minor line will become a major line eventually.
To reduce the bunching up of minor lines when dividing by a large prime number,
they are only drawn if the distance between them is large enough.
Note that the line drawing in the VSE is not quite following the zoom level. Since this doesn't use the code path i modified in this PR I left it as is. Info from the Sequencer module is appreciated.
Pull Request: https://projects.blender.org/blender/blender/pulls/143562
Caused by 0bcab8913f
Default value for `use_clamp` is true. But negation in above commit
affected the clamp value. Remove `!`, that way actual property value is
retrieved. Did the same for other two properties as well.
Pull Request: https://projects.blender.org/blender/blender/pulls/145707
There are multiple reasons this was not working the same for `Curve` and
`Curves`:
`Curve` is actually setting the `TransData.val` for handles (as opposed
to control points) to `nullptr` (`Curves` doesnt).
This is used in multiple places (and makes sense, since this value is
used for tweaking radius, tilt and GP opacities -- stuff that should not
be able to be tweaked from just handle selection, which was actually
possible...)
Included in the places where this `nullptr` is checked for is the logic
in `initCurveShrinkFatten` which relied on this to spot a selection
including a **control point**.
So this PR fixes these two things (setting nullptr to TransData value
for Curves handles and tweaking the logic in `initCurveShrinkFatten` a
bit so it can handle the different layout/order of `TransData` for
`Curves` vs. `Curve`)
Pull Request: https://projects.blender.org/blender/blender/pulls/145327
- "grease pencil" -> "Grease Pencil": title case.
- "Display type" -> "Display Type": title case for property name.
- "Bezier" -> "Bézier": proper noun.
- "Mem:%dM, Peak %dM" -> "Mem:%dM, Peak: %dM": missing colon.
- "cannot save image while rendering" -> "Cannot": Sentence case.
- "Linked data cannot text-space transform" -> "Cannot create
transform on linked data": rephrase strange sentence.
- "Unsupported object type for text-space transform" -> "... for
texture space transform": unnecessary abbreviation.
- "Cannot write to asset %s: %s": remove double space.
- "Failed to set tmpact" -> "temporary action": unclear abbreviation.
- "luminance at which the midetones of the image" -> "midtones: typo.
- "Line angle where the image should be split." -> trailing full stop.
- "... instances all the children in the collection" -> "... instances
of all the children...": missing "of".
- "Curves to generated rounded corners on" -> "generate": typo.
- "Instances that converted to a point per instance" -> "Instances to
convert to points": rephrase unclear sentence.
- "Great Pencil to set the depth order of" -> "Grease Pencil": typo.
- "Description to set the smoothness of" -> "Geometry to set the
smoothness of": typo.
- "A cannot use current file as library" -> "cannot use...": typo.
Pull Request: https://projects.blender.org/blender/blender/pulls/145840
- "Is this strip type an effect?" has been done by reserving 3rd bit
of the effect enum values to indicate that. That is a very strange
decision, so make that be done by strip_is_effect() function. The
enum values have to stay the same for backwards compat however.
- Both "strip type" and "strip blend mode" were sourced from the
same STRIP_TYPE_ enum, with only parts of the values meant for "type",
and other parts of values meant for "blend mode". That again is highly
confusing; split that off into two enums. Yes there's a handful of
values in them that overlap, but not the majority.
Pull Request: https://projects.blender.org/blender/blender/pulls/145746
The `retrieve_selected_points` function would treat points of non-bezier
curves as selected if the handles were selected. And because the
attributes `.selected_handle_left` and `.selected_handle_right` are
created initialized to true for all points. The
`retrieve_all_selected_points` would return that all points were
selected.
Only points of bezier curves should be used when getting the selection
mask for handles.
Pull Request: https://projects.blender.org/blender/blender/pulls/144824
Implements the proposed design (with some modifications) in #135058.
## Sequencer Scene
This adds a new property called `sequencer_scene` to workspaces. This scene is used
by the video sequence editors in the current workspace for their context.
This is a first step towards "detaching" the VSE from the active scene in the window.
Each sequencer timeline editor shows the sequencer scene that is being used.
By default, when no sequencer scene is selected, the timeline and preview are empty.
Pressing the "new" button will add a new scene and assign it to the sequencer
scene for the current workspace.
## Contextual Playback
Pressing `Space` (by default) for starting the animation playback is now contextual:
depending on the context (where your mouse cursor is), the scene that is played back
might be different. E.g. with a 3D Viewport and a Sequencer open, pressing "play"
in the 3D Viewport will play the _active scene_ of the window, while pressing "play"
in the sequencer will play the _sequencer scene_.
## Time & Scene Synchronization
Additionally, this adds a toggle called "Sync Active Scene".
With the property turned on, the active scene & scene time in the window will be
synced with the time & scene of the current scene strip in the sequencer.
Note that this is _not_ bi-directional. The sequencer can change the active scene
and map time, but it's not possible the other way around since it one can have
multiple strips using the same scene (+camera, and even time!).
Currently this setting is exposed in the footer of the sequencer timeline as well
as in the workspace settings.
This allows for one of the core concepts that the story tools projects aims at: Working
in a scene (e.g. in the 3D viewport) while also working with the edit
(in the sequencer timeline).
## Some technical notes
* Undoing while playback is running will now cancel playback. This is to avoid the timer,
that points to the scene and viewlayer that are playing, to get de-synced after loading
the memfile undo step.
* When the sequencer scene is not the same as the active scene, we ensure it has
a depsgraph.
* Normally, when a `NC_SCENE` notifier points to a specific scene, the notifier is dropped
if that scene doesn't match the active one in the window. We now also check that it
doesn't match the sequencer scene in the active workspace.
* When loading older files, we need to make sure that the active workspace in a window
uses the active scene as the sequencer scene. This is to make sure that the file opens with
the same sequences open.
* Tool settings are stored per scene. To make sure the sequencer uses the tool settings for
the sequencer scene, the "context.tool_settings" and `CTX_data_tool_settings` members
are overridden in the sequence editors.
Pull Request: https://projects.blender.org/blender/blender/pulls/140271
In function `curve_populate_trans_data_structs` only editable points are
copied to `TransDataContainer`.
The code handling proportional connected editing was expecting all data
from `CurvesGeometry` to be there. Additional offset index array was
added for editable points per curves.
Pull Request: https://projects.blender.org/blender/blender/pulls/144655
When disabling cursor constraint NumInput::idx_max was set to -1.
This looks to be the behavior since 2.4x, however more recently
the modulo of `idx_max + 1` was used to cycle the axis when pressing
tab (crashing when `idx_max` is -1).
Resolve by setting `NumInput::idx_max` to the number of axes since
this is the state when transform is initialized.
With the aim of removing `seqbasep` to remove the complicated logic for
repairing pointers within the `Strip` struct when loading files and undo
steps, this commit just moves access of the variable behind a function.
In the future the function will retrieve the list from a Strip pointer,
for now it just returns the existing pointer.
Overall motivation is that blend file pointer manipulation is incompatible
with the changes required for #127706.
Pull Request: https://projects.blender.org/blender/blender/pulls/144624
The semantics of checking "has_value()" (etc.) are much better than
checking for an empty span when dealing with the result of an attribute
lookup. This mainly affects the Bezier curve handle position attributes
currently. Plenty of places assume those attributes exist now. In a
couple places the code is a bit safer now, otherwise it's just a bit
more obvious.
Pull Request: https://projects.blender.org/blender/blender/pulls/144506
This PR adds a "Mirror" menu to the Strip menu within the VSE preview.
This menu is similar to the "Mirror" menu in the view3d "Object" menu.
It allows the user to access the mirror operator through a menu, rather
than via a shortcut.
Pull Request: https://projects.blender.org/blender/blender/pulls/142506
No functional changes intended.
This brings `bone_is_visible` in line with `bone_is_selected`,
by using function overloading instead of suffixing with either
`pchan` or `editbone`.
Pull Request: https://projects.blender.org/blender/blender/pulls/144558
Technically a regression in [0] however even before this commit
there where no check to prevent an intersection being used which
is far outside triangle the vertex is sliding towards.
Resolve by only using the line-line intersection if the intersection
points lie within a conical region defined by the edge pair the user
is sliding towards (see code-comment for details).
Ref !144418
[0]: 49ab0bb844
When the median was being calculated, the division was by the total number of transform data, rather than the selected number of transform data.
Under most circumstances this would be the same, but when transforming bezier control points without the handles selected, or when having proportional editing on. This the median calculation would return a wrong result.
Note: This problem could occur almost every object type not just Grease Pencil.
Resolves: #143534
Pull Request: https://projects.blender.org/blender/blender/pulls/144245
Replaces the `FPS` macro with `scene->frames_per_second()`.
The macro has two major issues:
* It hides that it depends on a `Scene *` variable named `scene`.
* It makes debugging harder.
This is now replaced with a member function on the scene.
Pull Request: https://projects.blender.org/blender/blender/pulls/144127
In this case the depsgraph isn't necessarily evaluated before the
transform operator executes. We need to make sure there's an evaluated
depsgraph so the evaluated deform positions are updated based on the
duplicate operator (the first step of the operator macro).
Pull Request: https://projects.blender.org/blender/blender/pulls/144037