36 Commits

Author SHA1 Message Date
Christoph Lendenfeld
b2653be057 Anim: Place Pose Bone Gizmo at Custom Transform
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
2025-09-26 13:25:01 +02:00
Christoph Lendenfeld
a43359eb88 Anim: Store pose bone visibility flag on pose bone
This PR adds a flag to the pose bone that determines its visibility.
Doing so allows to hide a pose bone and
* don't affect other instances of the same armature
* save the visibility even if the rig is linked

The visibility of the bone in object mode is now also determined by the
pose bone whereas before it was the `Bone`.

**This breaks backwards compatibility** on the Python API since the visibility property,
on the `Bone` behaves differently now as it hides the edit bone instead of the pose bone.

In order to remove all active uses of `BONE_HIDDEN_P` the changes in `armature_skinning.cc` are required.

Part of #138482

Pull Request: https://projects.blender.org/blender/blender/pulls/139167
2025-08-07 15:54:58 +02:00
Aras Pranckevicius
8bf73386f2 Anim: support per-bone "Display As" overrides
Armature bone display mode (Octahedral, Stick, Envelope, B-Bone,
Wire) could only be set on the whole armature. This adds ability to
override the display mode per-bone (by default bones use the
same display mode as the armature).

Images in the PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/138445
2025-05-16 15:06:36 +02:00
Campbell Barton
3c15f1bbe0 Cleanup: quiet Python linter warnings 2025-04-22 21:23:03 +10:00
Alaska
6faef7b149 Fix #137647: Remove warning about macOS not supporting custom wire widths
In a previous commmit (1), custom wire width for armatures was disabled
on macOS and a corrisponding warning was added to the UI due to a
limitation at the time leading to rendering artifacts #124691.

These limiations appear to have been sorted in Blender 4.4 and so
custom wire widths now work on macOS. So this commit removes the
warning message form the UI.

(1) a451971026

Pull Request: https://projects.blender.org/blender/blender/pulls/137651
2025-04-22 09:50:57 +02:00
Pasang Bomjan
5884c61b4c UI: Sort transform properties for custom bone shape
Sort the order of custom bone shape transform properties consistently
with other areas.

Pull Request: https://projects.blender.org/blender/blender/pulls/134173
2025-02-07 18:06:11 +01:00
Campbell Barton
49242a6b68 Cleanup: remove unused "COMPAT_ENGINES" in panels
Their existence was misleading making it seem as if would hidden unless
they were listed here.
2024-10-30 12:05:25 +11:00
Philipp Oeser
52be15071f UI: dim the hide_select property whenever the bone is hidden
suggestion by @dr.sybren in !127340
2024-09-20 18:00:05 +02:00
Philipp Oeser
b58f61a91a Fix: inconsistent bone selection after hiding or changing selectability
In blender, hidden items should not be selected.
Also, making an item unselectable should deselect it.

- in armature editmode (unlike posemode), hiding a bone through RNA
(unlike though the Outliner) would not deselect the bone
- in armature editmode (unlike posemode), hiding a bone through RNA
would not update the Outliner
- in armature posemode (unlike editmode), making a bone unselectable did
not deselect it (at least it did not update properly)

To resolve, add deselection to the RNA update functions and add needed
depsgraph tagging
Also add Bone selectability checkbox to Properties Editor (could be
split in a separate commit) -- came up in #127180.

Pull Request: https://projects.blender.org/blender/blender/pulls/127340
2024-09-20 17:42:41 +02:00
Campbell Barton
d19c13eb82 Cleanup: spelling & punctuation in comments 2024-09-03 12:59:37 +10:00
Christoph Lendenfeld
a451971026 Fix #124691: Custom bone wire rendering broken on Mac
This issue occurred only on Mac which has to circumvent
geometry shaders lacking support for them.

This patch reverts the vertex shader for Mac devices to
how it was before f9ea64b0ba. (and uses the frag shader from before that commit)
In order to communicate that to the user I added a label
in the GUI when the platform is Mac.

Co-authored-by: Clément Foucault <foucault.clem@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/125967
2024-08-08 11:19:12 +02:00
Christoph Lendenfeld
f9ea64b0ba Anim: Per bone wire width for custom shapes
The setting adds the "Custom Shape Wire Width"
option to the "Viewport Display/Custom Shape" section of a pose bone.
As the setting says, this controls how thick the wire is drawn in the viewport.

This is done by adding a geometry shader that makes two triangles out of a line.

The Anti-Aliasing is controlled by the setting
Viewport->Quality->Smooth Wires->Overlay in the user preferences.

## Artifacts
When increasing the line width, the lines start to separate at their vertices.
This comes from extruding each edge along the normal of its direction.
This could be solved by adding round caps in a later PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/120176
2024-05-30 15:51:30 +02:00
Frederick Solano
6e0c3231eb Anim: add bone length property to Bone Properties Panel
The Bone 'length' property is not shown in the Bone Properties Panel in Edit Mode, but it is shown in the N-Panel. This PR exposes it in Bone Properties Panel as well for UI consistency.

Pull Request: https://projects.blender.org/blender/blender/pulls/120815
2024-04-29 18:39:28 +02:00
Campbell Barton
d07d6f1c10 Cleanup: un-wrap lines that fit within 120 width for Python scripts 2024-03-15 10:04:03 +11:00
Philipp Oeser
b96770f692 Merge branch 'blender-v4.1-release' 2024-03-01 16:43:26 +01:00
Sybren A. Stüvel
1c5766f8bc Fix #118878: Anim: pinned bone custom properties not visible in edit-mode
Use `context.edit_bone` when available. This also properly accounts for
pinning of the armature.
2024-03-01 15:20:40 +01:00
Campbell Barton
4f8db2ee67 Cleanup: use static sets for contains checks, remove f-string use 2024-02-28 11:02:49 +11:00
Sybren A. Stüvel
1c789199d5 Anim: Bone properties panel, add missing 'solo' property
Solo'ing bone collections was only possible from the Armature properties
panel. However, the bone collections shown on the Bone properties panel
should have the same functionality.

Pull Request: https://projects.blender.org/blender/blender/pulls/118512
2024-02-20 18:09:04 +01:00
Sybren A. Stüvel
490c183bfd Fix #95204: Custom properties not shown on pose bone hidden by collection
Work around the limitation that `context.active_pose_bone` is `None` when
the active bone is hidden.

This also fixes the issue that the bone custom properties panel was using
the global context (`bpy.context`) instead of the one passed to the
`draw()` and `poll()` functions.

Pull Request: https://projects.blender.org/blender/blender/pulls/118510
2024-02-20 17:44:22 +01:00
Sybren A. Stüvel
72542321b0 Anim: change label "Edit Bone Color" to "Bone Color"
This was already done for pose mode (26fbeef755), and it's now consistent
in armature edit mode as well.
2023-10-05 14:33:14 +02:00
Sybren A. Stüvel
cf591606d1 Anim: change "Sync to Selected" to "Copy Colors to Selected"
"Sync" may imply that things are kept synchronous, while the operator
only performs a one-time copy. The new name & identifier reflect this
better.
2023-10-05 14:32:10 +02:00
Campbell Barton
36f65655cd Cleanup: reserve single quotes for enums 2023-10-04 10:30:28 +11:00
Sybren A. Stüvel
26fbeef755 Anim: change UI label from 'Edit Bone Color' to just 'Bone Color'
The `armature.bones["name"].color` property is *the* bone color, which is
intended to be used as the primary way of coloring bones. THis is now
reflected better in the UI.

The per-armature-object bone color (i.e. `ob.pose.bones["name"].color`) is
seen as a secondary.
2023-10-02 11:57:15 +02:00
Campbell Barton
790fea431f Cleanup: use since quotes for enum values, wrap multi-line brackets 2023-09-29 14:41:48 +10:00
Sybren A. Stüvel
fff9da576c Anim: add overview of bone collections to bone property panel
Add an overview of those bone collections the active/pinned bone is
assigned to.

This overview was originally there, showing the armature layers and the
bone group. This is now replaced by a list of the bone's collections. The
only possible interaction is unassigning the bone & toggling visibility
of the bone collections.
2023-09-28 15:52:45 +02:00
Sybren A. Stüvel
1930ebdb4f Anim: add operator to sync bone colors between selected bones
Blender's "Copy to Selected" feature only copies single properties, while
bone colors consist of four properties (palette + 3 custom colors). These
can now be copied with a single click.
2023-09-28 11:21:02 +02:00
Sybren A. Stüvel
4473bdc6ab Anim: bone color properties panel layout tweaks
More consistent layout for bone colors. The custom colors and regular
colors now have the layout in the UI.
2023-09-28 11:19:53 +02:00
Alexander Gavrilov
0055ae01ab Anim: implement a new curve-aware vertex to B-Bone segment mapping mode.
Currently vertices are mapped to B-Bone segments without taking the
rest pose curve into account. This is very simple and fast, but causes
poor deformations in some cases where the rest curvature is significant,
e.g. mouth corners in the new Rigify face rig.

This patch implements a new mapping mode that addresses this problem.
The general idea is to do an orthogonal projection on the curve. However,
since there is no analytical solution for bezier curves, it uses the
segment approximation:

* First, boundaries between segments are used for a binary space
  partitioning search to narrow down the mapping to one segment.
* Then, a position on the segment is chosen via linear
  interpolation between the BSP planes.
* Finally, to remove the sharp discontinuity at the evolute surface
  a smoothing pass is applied to the chosen position by blending to
  reduce the slope around the planes previously used in the BSP search.

In order to make per-vertex processing faster, a new array with the
necessary vectors converted to the pose space, as well as some
precomputed coefficients, is built.

The new mode is implemented as a per-bone option in order to ensure
backward compatibility, and also because the new mode may not be
optimal for all cases due to the difference in performance, and
complications like the smoothed but still present mapping
discontinuities around the evolute surface.

Wiki: https://wiki.blender.org/wiki/Source/Animation/B-Bone_Vertex_Mapping

Pull Request: https://projects.blender.org/blender/blender/pulls/110758

Pull Request: https://projects.blender.org/blender/blender/pulls/110758
2023-09-26 14:17:21 +02:00
Sybren A. Stüvel
59c592f1de Anim: remove RNA access to bone groups
Bone groups have been replaced with bone collections (#108941), but for
versioning purposes are still in DNA. This commit removes the RNA
access.
2023-09-08 12:12:39 +02:00
Miguel Pozo
2aa7961e6f Workbench: Remove old implementation 2023-09-06 15:54:48 +02:00
Philipp Oeser
726ef2c873 Fix: remove UI code relating to bone layers
Since #109976 was merged, one would run into the following when opening
Bone Relations panel in Properties:

```
/build_linux/bin/4.0/scripts/startup/bl_ui/properties_data_bone.py:228
rna_uiItemR: property not found: Bone.layers
```

So now remove the UI code there (since Bone.layers are no more...)

Pull Request: https://projects.blender.org/blender/blender/pulls/111730
2023-08-31 15:02:07 +02:00
Sybren A. Stüvel
042c5347f4 Anim: move bone colors from bone groups to individual bones
Move control over the color of bones from bone groups to the bones
themselves. Instead of using bone groups (which are defined on the pose,
and thus owned by the object), the color is stored on:

- the bone (`struct Bone`, or RNA `armature.bones['bone_name'].color`)
- a possible override on the pose bone (`struct bPoseChannel`, or RNA
  `ob.pose.bones['bone_name'].color`).

When the pose bone is set to its default color, the color is determined
by the armature bone. In armature edit mode, the armature bone colors
are always used, as then the pose data is unavailable.

Versioning code converts bone group colors to bone colors. If the
Armature has a single user, the group color is stored on the bones
directly. If it has multiple users, the group colors will be stored on
the pose bones instead.

The bone group color is not removed from DNA for forward compatibility,
that is, to avoid immediate dataloss when saving a 3.6 file with 4.0.

This is part of the replacement of bone groups & armature layers with
bone collections. See the design task at #108941.

Pull request: https://projects.blender.org/blender/blender/pulls/109976
2023-08-29 14:31:18 +02:00
Campbell Barton
e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00
Campbell Barton
65f99397ec License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
Damien Picard
dc999d83b4 I18n: disambiguate a few messages
- "Out" meaning "one end of a bone". Same as in 9120c86c3f.
- "Canvas" meaning a painting support for Dynamic Paint.
- "Twist" meaning an action verb, as opposed to an amount.
- "Solid" meaning a textureless, single-color material.
- "Blend mode" meaning material opacity blending, as opposed to color
  blending.
- "Pixel Size" meaning "a size measured using pixels as the unit".
- "Light" meaning "not dark", as in "Light Theme".

Ref #43295
2023-05-16 14:51:52 +02:00
Sergey Sharybin
03806d0b67 Re-design of submodules used in blender.git
This commit implements described in the #104573.

The goal is to fix the confusion of the submodule hashes change, which are not
ideal for any of the supported git-module configuration (they are either always
visible causing confusion, or silently staged and committed, also causing
confusion).

This commit replaces submodules with a checkout of addons and addons_contrib,
covered by the .gitignore, and locale and developer tools are moved to the
main repository.

This also changes the paths:
- /release/scripts are moved to the /scripts
- /source/tools are moved to the /tools
- /release/datafiles/locale is moved to /locale

This is done to avoid conflicts when using bisect, and also allow buildbot to
automatically "recover" wgen building older or newer branches/patches.

Running `make update` will initialize the local checkout to the changed
repository configuration.

Another aspect of the change is that the make update will support Github style
of remote organization (origin remote pointing to thy fork, upstream remote
pointing to the upstream blender/blender.git).

Pull Request #104755
2023-02-21 16:39:58 +01:00