This formats code that is disabled using `#if 0`. Formatting was achieved
by temporarily changing `#if 0` to `#if 1 /*something*/`, then formatting,
and then changing it back to `#if 0`.
This is part of what was implemented in #109062
When adding multiple snap points (`A` key), the 'Snap Base' location no longer corresponds to the snap target point, so it becomes invisible.
Therefore, show the resulting `Snap Base` during this operation.
Pull Request: https://projects.blender.org/blender/blender/pulls/109379
Also rename:
- `SCE_SNAP_MODE_FACE_NEAREST` to `SCE_SNAP_INDIVIDUAL_NEAREST`
- `SCE_SNAP_MODE_FACE_RAYCAST` to `SCE_SNAP_INDIVIDUAL_PROJECT`
And arrange the enums in numerical order.
Caused by 5621154185.
The Perpendicular Snap needs a `prev_co` to work.
But in `Snap With` `Closest` mode the `prev_co` is not calculated.
Thus, when isolated, the snap to Perpendicular is never done.
So this commit puts the `center_global` fallback back to `prev_co`.
Also, if `Snap Base Edit` is used when only the snap to
`Edge Perpendicular` is enabled. `Snap To` will be temporarily set to
`Vert`, `Edge`, `Face` and `Edge Midpoint`.
The current `Snap Base` was available and displayed to allow snapping
to `Edge Perpendicular`.
However, the usefulness of perpendicular snapping in `Set Snap Base`
mode is questionable and can sometimes cause inconvenience.
Also, removing the current `Snap Base` indicator (the `X` drawing)
makes the intention of the operation more apparent.
Therefore, this commit removes both the indicator and the effect of the
current `Snap Base` in `Set Snap Base` mode.
Pull Request: https://projects.blender.org/blender/blender/pulls/108776
Caused by 98bfa8d458
Occlusion must consider several factors:
- The `Viewport Display` > `Display As` setting of the object.
- The X-Ray mode of the scene.
- Whether only Snap to Face is being used.
- Whether Snap is set to Cage (always transparent) in edit mode.
- Whether the object is hidden.
In the case of Cage, the final geometry should be utilized for occlusion.
However, to prevent excessive and risky modifications, it was followed
the same approach as before and verified the `Display As` setting of
the object.
This commit removes the transformed `Snap Base` symbol (white target)
and displays only the untransformed `Snap Base` symbol (X) when
confirming the Snap Base Edit operation.
The usefulness of the white target icon representing the transformed
`Snap Base` is debatable since it represents the snap target itself
(orange circle) during the Move operation or the direction between the
pivot and the snap target during the Rotation operation.
Having multiple symbols on the screen can clutter the interface and may
not be intuitive.
Therefore, further discussion is required.
Ref.
#108669
The snap mode called "Face Nearest" (and the "Increment" but that's for
another time) doesn't behave like the other snap modes.
Unlike the other snap modes, "Face Nearest" does not act on a Snap
Base (or Snap Source).
It always acts on the origin of individually transformed elements, (such
as each vertex individually).
It works just like the "Project Individual Elements" option.
So this commit makes the following changes:
- `Snap With` was moved to the beginning of the popover
- `Align Rotation to Target` and `Backface Culling` have been moved closer to the snap targets
- `Snap With`, `Target Selection` and `Align Rotation to Target` are no longer hidden by varying the mode and options
- `Project Individual Elements` has been replaced with the `Face Project` option
- `Face Nearest` has been moved to stick together with the `Face Project` option
Co-authored-by: Germano Cavalcante <germano.costa@ig.com.br>
Pull Request: https://projects.blender.org/blender/blender/pulls/108555
This commit implements a new modifier key (`B`) for the transform
operators.
This new key allows changing the 'Snap Base' of a transform by snapping
it to a defined point in the scene.
Ref #66424
# Implementation Details
- This feature is only available in the 3D View.
- This feature is only available for the transform modes:
- `Move`,
- `Rotate`,
- `Scale`,
- `Vert Slide` and
- `Edge Slide`.
- The `Snap Base Edit` is enabled while we are transforming and we
press the key `B`
- The `Snap Base Edit` is confirmed when we press any of the keys:
`B`, `LMB`, `Enter`
- During um operation, if no snap target is set for an element in the
scene (Vertex, Edge...), the snap targets to geometry Vertex, Edge,
Face, Center of Edge and Perpendicular of Edge are set automatically.
- Constraint or similar modal features are not available during the
`Snap Base Edit` mode.
- Text input is not available during the `Snap Base Edit` mode.
- A prone snap base point is indicated with an small cursor drawing.
Pull Request: https://projects.blender.org/blender/blender/pulls/104443
No functional changes.
This commit reorganizes the transform mode functions by bundling them
into a struct called `TransModeInfo` in the file.
This structural change enhances the readability of the transform code
and simplifies the process of adding or removing modes.
Furthermore, this refactor allows for the inclusion of other essential
mode-specific values, such as 'input', which cannot be separated from
the code.
Overall, this commit improves the maintainability and extensibility of
the transform functionality.
Pull Request: https://projects.blender.org/blender/blender/pulls/108467
A lot of files were missing copyright field in the header and
the Blender Foundation contributed to them in a sense of bug
fixing and general maintenance.
This change makes it explicit that those files are at least
partially copyrighted by the Blender Foundation.
Note that this does not make it so the Blender Foundation is
the only holder of the copyright in those files, and developers
who do not have a signed contract with the foundation still
hold the copyright as well.
Another aspect of this change is using SPDX format for the
header. We already used it for the license specification,
and now we state it for the copyright as well, following the
FAQ:
https://reuse.software/faq/
Remove micro optimization that seeks to reuse the active center
alculation.
This operation is lightweight and reusing its result only adds an
unnecessary dependency.
Face Nearest only works with individual projection, so always set the
`SCE_SNAP_PROJECT` flag in this case.
Also gray out the `Project Individual Elements` option in the UI if
`Face Nearest` is enabled.
And change the description to indicate that `Project Individual Elements`
is always enabled with the `Face Nearest` option.
(I feel a better design for this option needs to be considered).
No functional changes.
The code previously contained redundant and complex checks for
different snapping scenarios, which involved combinations of multiple
snapping flags and modes on each mouse interaction. This resulted in
unnecessary code duplication and overhead.
To address this issue, the code has been simplified and micro-optimized
by moving these checks to the initialization of the snapping parameters.
This results in a more streamlined and efficient codebase.
The members `align`, `project`, `peel` and `use_backface_culling`
already have a corresponding value in `TransSnap::flag`.
Keeping values that represent the same thing is error prone.
The `SNAP_FORCED` setting is set to the operation and not the snap
status.
Therefore, this option should not be cleared along with the other
statuses when resetting snapping.
Move then the location of this setting to `TransInfo::modifiers`.
There is not much documentation on the "snap_point" property, but by
code it is possible to note that it serves to set a target snap point
and is of internal use as it is hidden from the Redo panel.
However, this property was still very dependent on Tools settings and
if set to an operator's call, it changes the scene configurations
inadequately.
Therefore,
- remove this dependency from UI for rotation and resize operators,
- do not change the state of the snap in the scene and
- cleanup the code.
activeSnap --> transform_snap_is_active
activeSnap_SnappingIndividual --> transform_snap_project_individual_is_active
activeSnap_SnappingAsGroup --> transform_snap_mixed_is_active
applySnappingIndividual --> transform_snap_project_individual_apply
applySnappingAsGroup --> transform_snap_mixed_apply
Also rearrange functions to be close to where they are used.
And use static when possible.
* This patch just moves runtime data to the runtime struct to cleanup
the dna struct. Arguably, some of this data should not even be there
because it's very use case specific. This can be cleaned up separately.
* `miniwidth` was removed completely, because it was not used anywhere.
The corresponding rna property `width_hidden` is kept to avoid
script breakage, but does not do anything (e.g. node wrangler sets it).
* Since rna is in C, some helper functions where added to access the
C++ runtime data from rna.
* This size of `bNode` decreases from 432 to 368 bytes.