2023-08-15 14:20:26 +00:00
|
|
|
# SPDX-FileCopyrightText: 2009-2023 Blender Authors
|
2023-06-15 03:09:04 +00:00
|
|
|
#
|
2022-02-10 22:07:11 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
2023-06-15 03:09:04 +00:00
|
|
|
|
2009-05-19 15:38:36 +00:00
|
|
|
import bpy
|
2023-02-21 15:43:57 +00:00
|
|
|
from bpy.types import Panel, Menu, UIList
|
2010-01-08 08:54:41 +00:00
|
|
|
from rna_prop_ui import PropertyPanel
|
2011-03-27 05:23:14 +00:00
|
|
|
|
2019-06-11 06:08:32 +00:00
|
|
|
from bl_ui.properties_animviz import (
|
2019-03-19 23:44:13 +00:00
|
|
|
MotionPathButtonsPanel,
|
|
|
|
MotionPathButtonsPanel_display,
|
|
|
|
)
|
2011-09-20 18:29:19 +00:00
|
|
|
|
2019-04-09 13:16:11 +00:00
|
|
|
|
2015-01-29 04:35:06 +00:00
|
|
|
class ArmatureButtonsPanel:
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_space_type = 'PROPERTIES'
|
|
|
|
bl_region_type = 'WINDOW'
|
|
|
|
bl_context = "data"
|
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2009-10-31 19:31:45 +00:00
|
|
|
return context.armature
|
2009-05-20 02:17:53 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class DATA_PT_context_arm(ArmatureButtonsPanel, Panel):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_label = ""
|
2010-08-26 01:05:37 +00:00
|
|
|
bl_options = {'HIDE_HEADER'}
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
ob = context.object
|
|
|
|
arm = context.armature
|
|
|
|
space = context.space_data
|
2009-11-14 13:35:44 +00:00
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
if ob:
|
2010-12-30 12:22:28 +00:00
|
|
|
layout.template_ID(ob, "data")
|
2010-08-06 15:17:44 +00:00
|
|
|
elif arm:
|
2010-12-30 12:22:28 +00:00
|
|
|
layout.template_ID(space, "pin_id")
|
2009-06-07 13:36:12 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2023-09-28 14:31:55 +00:00
|
|
|
class DATA_PT_pose(ArmatureButtonsPanel, Panel):
|
|
|
|
bl_label = "Pose"
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
arm = context.armature
|
|
|
|
|
2017-06-01 13:38:32 +00:00
|
|
|
layout.row().prop(arm, "pose_position", expand=True)
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2011-09-08 05:42:44 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class DATA_PT_display(ArmatureButtonsPanel, Panel):
|
2019-02-27 18:01:29 +00:00
|
|
|
bl_label = "Viewport Display"
|
2018-10-18 10:13:06 +00:00
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2019-02-18 04:10:01 +00:00
|
|
|
layout.use_property_split = True
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-01-02 04:14:17 +00:00
|
|
|
ob = context.object
|
2009-10-31 19:31:45 +00:00
|
|
|
arm = context.armature
|
|
|
|
|
2019-02-18 04:10:01 +00:00
|
|
|
layout.prop(arm, "display_type", text="Display As")
|
2009-11-12 21:44:35 +00:00
|
|
|
|
UI: Layout changes for new checkbox layout possibilities
Follow-up to previous commit.
Some examples:
{F8473507} {F8473508} {F8473509} {F8473510}
For more screenshots, please see D7430.
We use column or row headings here to bring more structure, and to give
the eye visual anchors which aid eye-scanning. The left-aligned
checkboxes likewise help with this. And we keep the adherence to the
center line, so the alignment matches up between the various buttons and
controls.
* Changes the property split percentage from 50/50% to 40/60%. This is
needed to give enough space for the checkboxes. But in most cases this
looks better anyway - see Transform panel. In some cases it simply
fills out the available space more efficently.
* Fix various hacks where we previously used manually defined splits.
When we did this, the alignment was never quite right, and the layout
code was a mess.
* Adds column headings to many places where a list of checkboxes all
share a common purpose or leading text.
* Add checkbox + value configurations various places where a checkbox
only serves to enable the value slider
* Removes most uses of grid flow layout. The grid flow layouts combine
poorly with column headings, and also they would mess alignment up
badly. The grid flow layouts also often made buttons and controls jump
around on the screen if you would just resize editors slightly,
causing visual confusion, making users lose their place. The logic for
at what time the list of items would re-flow was often flawed, jumping
to multiple columns too fast or too late - and frankly, the grid flow
layouts would often just look bad.
Maniphest Task: https://developer.blender.org/T65965
Differential Revision: https://developer.blender.org/D7430
Reviewed by: Brecht Van Lommel, Pablo Vazquez.
Most work here by William Reynish, few changes by Julian Eisel.
2020-04-17 14:54:03 +00:00
|
|
|
col = layout.column(heading="Show")
|
2019-03-21 17:25:01 +00:00
|
|
|
col.prop(arm, "show_names", text="Names")
|
|
|
|
col.prop(arm, "show_bone_custom_shapes", text="Shapes")
|
2023-09-08 10:00:51 +00:00
|
|
|
col.prop(arm, "show_bone_colors", text="Bone Colors")
|
2021-03-30 09:16:45 +00:00
|
|
|
|
2010-12-17 10:33:28 +00:00
|
|
|
if ob:
|
2019-03-21 17:25:01 +00:00
|
|
|
col.prop(ob, "show_in_front", text="In Front")
|
2009-05-19 15:38:36 +00:00
|
|
|
|
2021-03-30 09:16:45 +00:00
|
|
|
col = layout.column(align=False, heading="Axes")
|
|
|
|
row = col.row(align=True)
|
|
|
|
row.prop(arm, "show_axes", text="")
|
|
|
|
sub = row.row(align=True)
|
|
|
|
sub.active = arm.show_axes
|
|
|
|
sub.prop(arm, "axes_position", text="Position")
|
|
|
|
|
2023-03-21 14:13:22 +00:00
|
|
|
sub = col.row(align=True)
|
|
|
|
sub.prop(arm, "relation_line_position", text="Relations", expand=True)
|
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
Anim: replace Bone Groups & Armature Layers with Bone Collections
Armature layers (the 32 little dots) and bone groups are replaced with
Bone Collections:
- Bone collections are stored on the armature, and have a name that is
unique within that armature.
- An armature can have an arbitrary number of bone collections (instead
of the fixed 32 layers).
- Bones can be assigned to zero or more bone collections.
- Bone collections have a visibility setting, just like objects in scene
collections.
- When a bone is in at least one collection, and all its collections in
are hidden, the bone is hidden. In other cases (in any visible
collection, or in no collection at all), the bone visibility is
determined by its own 'hidden' flag.
- For now, bone collections cannot be nested; they are a flat list just
like bone groups were. Nestability of bone collections is intended to
be implemented in a later 4.x release.
- Since bone collections are defined on the armature, they can be used
from both pose mode and edit mode.
Versioning converts bone groups and armature layers to new bone
collections. Layers that do not contain any bones are skipped. The old
data structures remain in DNA and are unaltered, for limited forward
compatibility. That way at least a save with Blender 4.0 will not
immediately erase the bone group and armature layers and their bone
assignments.
Shortcuts:
- M/Shift+M in pose/edit mode: move to collection (M) and add to
collection (shift+M). This works similar to the M/Shift+M menus for
objects & scene collections.
- Ctrl+G in pose mode shows a port of the old 'bone groups' menu. This
is likely to be removed in the near future, as the functionality
overlaps with the M/Shift+M menus.
This is the first commit of a series; the bone collections feature will
be improved before the Blender 4.0 release. See #108941 for more info.
Pull request: https://projects.blender.org/blender/blender/pulls/109976
2023-08-22 10:15:54 +00:00
|
|
|
class DATA_UL_bone_collections(UIList):
|
|
|
|
def draw_item(self, _context, layout, armature, bcoll, _icon, _active_data, _active_propname, _index):
|
|
|
|
active_bone = armature.edit_bones.active or armature.bones.active
|
|
|
|
has_active_bone = active_bone and bcoll.name in active_bone.collections
|
2011-07-07 04:31:53 +00:00
|
|
|
|
Anim: replace Bone Groups & Armature Layers with Bone Collections
Armature layers (the 32 little dots) and bone groups are replaced with
Bone Collections:
- Bone collections are stored on the armature, and have a name that is
unique within that armature.
- An armature can have an arbitrary number of bone collections (instead
of the fixed 32 layers).
- Bones can be assigned to zero or more bone collections.
- Bone collections have a visibility setting, just like objects in scene
collections.
- When a bone is in at least one collection, and all its collections in
are hidden, the bone is hidden. In other cases (in any visible
collection, or in no collection at all), the bone visibility is
determined by its own 'hidden' flag.
- For now, bone collections cannot be nested; they are a flat list just
like bone groups were. Nestability of bone collections is intended to
be implemented in a later 4.x release.
- Since bone collections are defined on the armature, they can be used
from both pose mode and edit mode.
Versioning converts bone groups and armature layers to new bone
collections. Layers that do not contain any bones are skipped. The old
data structures remain in DNA and are unaltered, for limited forward
compatibility. That way at least a save with Blender 4.0 will not
immediately erase the bone group and armature layers and their bone
assignments.
Shortcuts:
- M/Shift+M in pose/edit mode: move to collection (M) and add to
collection (shift+M). This works similar to the M/Shift+M menus for
objects & scene collections.
- Ctrl+G in pose mode shows a port of the old 'bone groups' menu. This
is likely to be removed in the near future, as the functionality
overlaps with the M/Shift+M menus.
This is the first commit of a series; the bone collections feature will
be improved before the Blender 4.0 release. See #108941 for more info.
Pull request: https://projects.blender.org/blender/blender/pulls/109976
2023-08-22 10:15:54 +00:00
|
|
|
layout.prop(bcoll, "name", text="", emboss=False,
|
|
|
|
icon='DOT' if has_active_bone else 'BLANK1')
|
2023-09-14 12:31:01 +00:00
|
|
|
|
|
|
|
if armature.override_library:
|
|
|
|
icon = 'LIBRARY_DATA_OVERRIDE' if bcoll.is_local_override else 'BLANK1'
|
|
|
|
layout.prop(
|
|
|
|
bcoll,
|
|
|
|
"is_local_override",
|
|
|
|
text="",
|
|
|
|
emboss=False,
|
|
|
|
icon=icon)
|
|
|
|
|
Anim: replace Bone Groups & Armature Layers with Bone Collections
Armature layers (the 32 little dots) and bone groups are replaced with
Bone Collections:
- Bone collections are stored on the armature, and have a name that is
unique within that armature.
- An armature can have an arbitrary number of bone collections (instead
of the fixed 32 layers).
- Bones can be assigned to zero or more bone collections.
- Bone collections have a visibility setting, just like objects in scene
collections.
- When a bone is in at least one collection, and all its collections in
are hidden, the bone is hidden. In other cases (in any visible
collection, or in no collection at all), the bone visibility is
determined by its own 'hidden' flag.
- For now, bone collections cannot be nested; they are a flat list just
like bone groups were. Nestability of bone collections is intended to
be implemented in a later 4.x release.
- Since bone collections are defined on the armature, they can be used
from both pose mode and edit mode.
Versioning converts bone groups and armature layers to new bone
collections. Layers that do not contain any bones are skipped. The old
data structures remain in DNA and are unaltered, for limited forward
compatibility. That way at least a save with Blender 4.0 will not
immediately erase the bone group and armature layers and their bone
assignments.
Shortcuts:
- M/Shift+M in pose/edit mode: move to collection (M) and add to
collection (shift+M). This works similar to the M/Shift+M menus for
objects & scene collections.
- Ctrl+G in pose mode shows a port of the old 'bone groups' menu. This
is likely to be removed in the near future, as the functionality
overlaps with the M/Shift+M menus.
This is the first commit of a series; the bone collections feature will
be improved before the Blender 4.0 release. See #108941 for more info.
Pull request: https://projects.blender.org/blender/blender/pulls/109976
2023-08-22 10:15:54 +00:00
|
|
|
layout.prop(bcoll, "is_visible", text="", emboss=False,
|
|
|
|
icon='HIDE_OFF' if bcoll.is_visible else 'HIDE_ON')
|
2023-02-21 15:43:57 +00:00
|
|
|
|
|
|
|
|
Anim: replace Bone Groups & Armature Layers with Bone Collections
Armature layers (the 32 little dots) and bone groups are replaced with
Bone Collections:
- Bone collections are stored on the armature, and have a name that is
unique within that armature.
- An armature can have an arbitrary number of bone collections (instead
of the fixed 32 layers).
- Bones can be assigned to zero or more bone collections.
- Bone collections have a visibility setting, just like objects in scene
collections.
- When a bone is in at least one collection, and all its collections in
are hidden, the bone is hidden. In other cases (in any visible
collection, or in no collection at all), the bone visibility is
determined by its own 'hidden' flag.
- For now, bone collections cannot be nested; they are a flat list just
like bone groups were. Nestability of bone collections is intended to
be implemented in a later 4.x release.
- Since bone collections are defined on the armature, they can be used
from both pose mode and edit mode.
Versioning converts bone groups and armature layers to new bone
collections. Layers that do not contain any bones are skipped. The old
data structures remain in DNA and are unaltered, for limited forward
compatibility. That way at least a save with Blender 4.0 will not
immediately erase the bone group and armature layers and their bone
assignments.
Shortcuts:
- M/Shift+M in pose/edit mode: move to collection (M) and add to
collection (shift+M). This works similar to the M/Shift+M menus for
objects & scene collections.
- Ctrl+G in pose mode shows a port of the old 'bone groups' menu. This
is likely to be removed in the near future, as the functionality
overlaps with the M/Shift+M menus.
This is the first commit of a series; the bone collections feature will
be improved before the Blender 4.0 release. See #108941 for more info.
Pull request: https://projects.blender.org/blender/blender/pulls/109976
2023-08-22 10:15:54 +00:00
|
|
|
class DATA_PT_bone_collections(ArmatureButtonsPanel, Panel):
|
|
|
|
bl_label = "Bone Collections"
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
2023-09-07 15:09:17 +00:00
|
|
|
arm = context.armature
|
Anim: replace Bone Groups & Armature Layers with Bone Collections
Armature layers (the 32 little dots) and bone groups are replaced with
Bone Collections:
- Bone collections are stored on the armature, and have a name that is
unique within that armature.
- An armature can have an arbitrary number of bone collections (instead
of the fixed 32 layers).
- Bones can be assigned to zero or more bone collections.
- Bone collections have a visibility setting, just like objects in scene
collections.
- When a bone is in at least one collection, and all its collections in
are hidden, the bone is hidden. In other cases (in any visible
collection, or in no collection at all), the bone visibility is
determined by its own 'hidden' flag.
- For now, bone collections cannot be nested; they are a flat list just
like bone groups were. Nestability of bone collections is intended to
be implemented in a later 4.x release.
- Since bone collections are defined on the armature, they can be used
from both pose mode and edit mode.
Versioning converts bone groups and armature layers to new bone
collections. Layers that do not contain any bones are skipped. The old
data structures remain in DNA and are unaltered, for limited forward
compatibility. That way at least a save with Blender 4.0 will not
immediately erase the bone group and armature layers and their bone
assignments.
Shortcuts:
- M/Shift+M in pose/edit mode: move to collection (M) and add to
collection (shift+M). This works similar to the M/Shift+M menus for
objects & scene collections.
- Ctrl+G in pose mode shows a port of the old 'bone groups' menu. This
is likely to be removed in the near future, as the functionality
overlaps with the M/Shift+M menus.
This is the first commit of a series; the bone collections feature will
be improved before the Blender 4.0 release. See #108941 for more info.
Pull request: https://projects.blender.org/blender/blender/pulls/109976
2023-08-22 10:15:54 +00:00
|
|
|
active_bcoll = arm.collections.active
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
row = layout.row()
|
2023-12-28 15:10:02 +00:00
|
|
|
row.template_bone_collection_tree()
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
col = row.column(align=True)
|
Anim: replace Bone Groups & Armature Layers with Bone Collections
Armature layers (the 32 little dots) and bone groups are replaced with
Bone Collections:
- Bone collections are stored on the armature, and have a name that is
unique within that armature.
- An armature can have an arbitrary number of bone collections (instead
of the fixed 32 layers).
- Bones can be assigned to zero or more bone collections.
- Bone collections have a visibility setting, just like objects in scene
collections.
- When a bone is in at least one collection, and all its collections in
are hidden, the bone is hidden. In other cases (in any visible
collection, or in no collection at all), the bone visibility is
determined by its own 'hidden' flag.
- For now, bone collections cannot be nested; they are a flat list just
like bone groups were. Nestability of bone collections is intended to
be implemented in a later 4.x release.
- Since bone collections are defined on the armature, they can be used
from both pose mode and edit mode.
Versioning converts bone groups and armature layers to new bone
collections. Layers that do not contain any bones are skipped. The old
data structures remain in DNA and are unaltered, for limited forward
compatibility. That way at least a save with Blender 4.0 will not
immediately erase the bone group and armature layers and their bone
assignments.
Shortcuts:
- M/Shift+M in pose/edit mode: move to collection (M) and add to
collection (shift+M). This works similar to the M/Shift+M menus for
objects & scene collections.
- Ctrl+G in pose mode shows a port of the old 'bone groups' menu. This
is likely to be removed in the near future, as the functionality
overlaps with the M/Shift+M menus.
This is the first commit of a series; the bone collections feature will
be improved before the Blender 4.0 release. See #108941 for more info.
Pull request: https://projects.blender.org/blender/blender/pulls/109976
2023-08-22 10:15:54 +00:00
|
|
|
col.operator("armature.collection_add", icon='ADD', text="")
|
|
|
|
col.operator("armature.collection_remove", icon='REMOVE', text="")
|
|
|
|
if active_bcoll:
|
2011-07-07 04:31:53 +00:00
|
|
|
col.separator()
|
Anim: replace Bone Groups & Armature Layers with Bone Collections
Armature layers (the 32 little dots) and bone groups are replaced with
Bone Collections:
- Bone collections are stored on the armature, and have a name that is
unique within that armature.
- An armature can have an arbitrary number of bone collections (instead
of the fixed 32 layers).
- Bones can be assigned to zero or more bone collections.
- Bone collections have a visibility setting, just like objects in scene
collections.
- When a bone is in at least one collection, and all its collections in
are hidden, the bone is hidden. In other cases (in any visible
collection, or in no collection at all), the bone visibility is
determined by its own 'hidden' flag.
- For now, bone collections cannot be nested; they are a flat list just
like bone groups were. Nestability of bone collections is intended to
be implemented in a later 4.x release.
- Since bone collections are defined on the armature, they can be used
from both pose mode and edit mode.
Versioning converts bone groups and armature layers to new bone
collections. Layers that do not contain any bones are skipped. The old
data structures remain in DNA and are unaltered, for limited forward
compatibility. That way at least a save with Blender 4.0 will not
immediately erase the bone group and armature layers and their bone
assignments.
Shortcuts:
- M/Shift+M in pose/edit mode: move to collection (M) and add to
collection (shift+M). This works similar to the M/Shift+M menus for
objects & scene collections.
- Ctrl+G in pose mode shows a port of the old 'bone groups' menu. This
is likely to be removed in the near future, as the functionality
overlaps with the M/Shift+M menus.
This is the first commit of a series; the bone collections feature will
be improved before the Blender 4.0 release. See #108941 for more info.
Pull request: https://projects.blender.org/blender/blender/pulls/109976
2023-08-22 10:15:54 +00:00
|
|
|
col.operator("armature.collection_move", icon='TRIA_UP', text="").direction = 'UP'
|
|
|
|
col.operator("armature.collection_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
|
2023-09-28 12:38:54 +00:00
|
|
|
col.separator()
|
|
|
|
|
|
|
|
col.menu("ARMATURE_MT_collection_context_menu", icon='DOWNARROW_HLT', text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-07-14 03:19:19 +00:00
|
|
|
row = layout.row()
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-07-14 03:19:19 +00:00
|
|
|
sub = row.row(align=True)
|
Anim: replace Bone Groups & Armature Layers with Bone Collections
Armature layers (the 32 little dots) and bone groups are replaced with
Bone Collections:
- Bone collections are stored on the armature, and have a name that is
unique within that armature.
- An armature can have an arbitrary number of bone collections (instead
of the fixed 32 layers).
- Bones can be assigned to zero or more bone collections.
- Bone collections have a visibility setting, just like objects in scene
collections.
- When a bone is in at least one collection, and all its collections in
are hidden, the bone is hidden. In other cases (in any visible
collection, or in no collection at all), the bone visibility is
determined by its own 'hidden' flag.
- For now, bone collections cannot be nested; they are a flat list just
like bone groups were. Nestability of bone collections is intended to
be implemented in a later 4.x release.
- Since bone collections are defined on the armature, they can be used
from both pose mode and edit mode.
Versioning converts bone groups and armature layers to new bone
collections. Layers that do not contain any bones are skipped. The old
data structures remain in DNA and are unaltered, for limited forward
compatibility. That way at least a save with Blender 4.0 will not
immediately erase the bone group and armature layers and their bone
assignments.
Shortcuts:
- M/Shift+M in pose/edit mode: move to collection (M) and add to
collection (shift+M). This works similar to the M/Shift+M menus for
objects & scene collections.
- Ctrl+G in pose mode shows a port of the old 'bone groups' menu. This
is likely to be removed in the near future, as the functionality
overlaps with the M/Shift+M menus.
This is the first commit of a series; the bone collections feature will
be improved before the Blender 4.0 release. See #108941 for more info.
Pull request: https://projects.blender.org/blender/blender/pulls/109976
2023-08-22 10:15:54 +00:00
|
|
|
sub.operator("armature.collection_assign", text="Assign")
|
|
|
|
sub.operator("armature.collection_unassign", text="Remove")
|
2010-07-14 03:19:19 +00:00
|
|
|
|
|
|
|
sub = row.row(align=True)
|
Anim: replace Bone Groups & Armature Layers with Bone Collections
Armature layers (the 32 little dots) and bone groups are replaced with
Bone Collections:
- Bone collections are stored on the armature, and have a name that is
unique within that armature.
- An armature can have an arbitrary number of bone collections (instead
of the fixed 32 layers).
- Bones can be assigned to zero or more bone collections.
- Bone collections have a visibility setting, just like objects in scene
collections.
- When a bone is in at least one collection, and all its collections in
are hidden, the bone is hidden. In other cases (in any visible
collection, or in no collection at all), the bone visibility is
determined by its own 'hidden' flag.
- For now, bone collections cannot be nested; they are a flat list just
like bone groups were. Nestability of bone collections is intended to
be implemented in a later 4.x release.
- Since bone collections are defined on the armature, they can be used
from both pose mode and edit mode.
Versioning converts bone groups and armature layers to new bone
collections. Layers that do not contain any bones are skipped. The old
data structures remain in DNA and are unaltered, for limited forward
compatibility. That way at least a save with Blender 4.0 will not
immediately erase the bone group and armature layers and their bone
assignments.
Shortcuts:
- M/Shift+M in pose/edit mode: move to collection (M) and add to
collection (shift+M). This works similar to the M/Shift+M menus for
objects & scene collections.
- Ctrl+G in pose mode shows a port of the old 'bone groups' menu. This
is likely to be removed in the near future, as the functionality
overlaps with the M/Shift+M menus.
This is the first commit of a series; the bone collections feature will
be improved before the Blender 4.0 release. See #108941 for more info.
Pull request: https://projects.blender.org/blender/blender/pulls/109976
2023-08-22 10:15:54 +00:00
|
|
|
sub.operator("armature.collection_select", text="Select")
|
|
|
|
sub.operator("armature.collection_deselect", text="Deselect")
|
2009-07-21 10:18:08 +00:00
|
|
|
|
2010-01-31 14:46:28 +00:00
|
|
|
|
2023-09-28 12:38:54 +00:00
|
|
|
class ARMATURE_MT_collection_context_menu(Menu):
|
|
|
|
bl_label = "Bone Collection Specials"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
arm = context.armature
|
|
|
|
active_bcoll = arm.collections.active
|
|
|
|
|
|
|
|
props = layout.operator("armature.collection_solo_visibility")
|
|
|
|
props.name = active_bcoll.name if active_bcoll else ""
|
|
|
|
layout.operator("armature.collection_show_all")
|
|
|
|
|
|
|
|
|
2023-12-28 15:10:02 +00:00
|
|
|
class ARMATURE_MT_collection_tree_context_menu(Menu):
|
|
|
|
bl_label = "Bone Collections"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
arm = context.armature
|
|
|
|
|
2024-01-09 09:23:23 +00:00
|
|
|
active_bcoll_is_locked = arm.collections.active and not arm.collections.active.is_editable
|
|
|
|
|
|
|
|
# The poll function doesn't have access to the parent index property, so
|
|
|
|
# it cannot disable this operator depending on whether the parent is
|
|
|
|
# editable or not. That means this menu has to do the disabling for it.
|
|
|
|
sub = layout.column()
|
|
|
|
sub.enabled = not active_bcoll_is_locked
|
2024-01-22 09:34:30 +00:00
|
|
|
sub.operator("armature.collection_add", text="Add Child Collection")
|
2024-01-09 09:23:23 +00:00
|
|
|
sub.operator("armature.collection_remove")
|
2023-12-28 15:10:02 +00:00
|
|
|
|
|
|
|
layout.separator()
|
|
|
|
|
|
|
|
layout.operator("armature.collection_solo_visibility")
|
|
|
|
layout.operator("armature.collection_show_all")
|
|
|
|
|
|
|
|
layout.separator()
|
|
|
|
|
2024-01-09 09:23:23 +00:00
|
|
|
# These operators can be used to assign to a named collection as well, and
|
|
|
|
# don't necessarily always use the active bone collection. That means that
|
|
|
|
# they have the same limitation as described above.
|
|
|
|
sub = layout.column()
|
|
|
|
sub.enabled = not active_bcoll_is_locked
|
|
|
|
sub.operator("armature.collection_assign", text="Assign Selected Bones")
|
|
|
|
sub.operator("armature.collection_unassign", text="Remove Selected Bones")
|
2023-12-28 15:10:02 +00:00
|
|
|
|
|
|
|
layout.separator()
|
|
|
|
|
|
|
|
layout.operator("armature.collection_select", text="Select Bones")
|
|
|
|
layout.operator("armature.collection_deselect", text="Deselect Bones")
|
|
|
|
|
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, Panel):
|
2012-11-24 00:18:34 +00:00
|
|
|
bl_label = "Inverse Kinematics"
|
2023-05-15 10:53:17 +00:00
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
2009-12-14 03:01:42 +00:00
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2009-12-14 03:01:42 +00:00
|
|
|
ob = context.object
|
2022-12-06 17:24:07 +00:00
|
|
|
return ob and ob.pose
|
2009-12-14 03:01:42 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2018-06-01 16:44:06 +00:00
|
|
|
layout.use_property_split = True
|
2009-12-14 03:01:42 +00:00
|
|
|
|
|
|
|
ob = context.object
|
|
|
|
itasc = ob.pose.ik_param
|
|
|
|
|
2011-03-04 19:57:05 +00:00
|
|
|
layout.prop(ob.pose, "ik_solver")
|
2009-12-26 09:36:50 +00:00
|
|
|
|
2009-12-17 13:14:29 +00:00
|
|
|
if itasc:
|
2019-02-18 04:10:01 +00:00
|
|
|
layout.prop(itasc, "mode")
|
2023-05-15 08:42:20 +00:00
|
|
|
layout.prop(itasc, "translate_root_bones")
|
2009-12-17 13:14:29 +00:00
|
|
|
simulation = (itasc.mode == 'SIMULATION')
|
|
|
|
if simulation:
|
2018-06-01 16:44:06 +00:00
|
|
|
layout.prop(itasc, "reiteration_method", expand=False)
|
2009-12-14 03:01:42 +00:00
|
|
|
|
2018-06-01 16:44:06 +00:00
|
|
|
col = layout.column()
|
|
|
|
col.active = not simulation or itasc.reiteration_method != 'NEVER'
|
|
|
|
col.prop(itasc, "precision")
|
|
|
|
col.prop(itasc, "iterations")
|
2009-12-17 13:14:29 +00:00
|
|
|
|
|
|
|
if simulation:
|
2019-02-18 04:10:01 +00:00
|
|
|
col.prop(itasc, "use_auto_step")
|
|
|
|
sub = layout.column(align=True)
|
2010-08-18 08:58:37 +00:00
|
|
|
if itasc.use_auto_step:
|
2019-02-18 04:10:01 +00:00
|
|
|
sub.prop(itasc, "step_min", text="Steps Min")
|
|
|
|
sub.prop(itasc, "step_max", text="Max")
|
2009-12-17 13:14:29 +00:00
|
|
|
else:
|
2019-02-18 04:10:01 +00:00
|
|
|
sub.prop(itasc, "step_count", text="Steps")
|
2009-12-17 13:14:29 +00:00
|
|
|
|
2019-02-18 04:10:01 +00:00
|
|
|
col.prop(itasc, "solver")
|
2009-12-17 13:14:29 +00:00
|
|
|
if simulation:
|
2019-02-18 04:10:01 +00:00
|
|
|
col.prop(itasc, "feedback")
|
|
|
|
col.prop(itasc, "velocity_max")
|
2009-12-17 13:14:29 +00:00
|
|
|
if itasc.solver == 'DLS':
|
2018-06-01 16:44:06 +00:00
|
|
|
col.separator()
|
|
|
|
col.prop(itasc, "damping_max", text="Damping Max", slider=True)
|
|
|
|
col.prop(itasc, "damping_epsilon", text="Damping Epsilon", slider=True)
|
|
|
|
|
2009-12-14 03:01:42 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class DATA_PT_motion_paths(MotionPathButtonsPanel, Panel):
|
2023-03-01 11:12:18 +00:00
|
|
|
# bl_label = "Bones Motion Paths"
|
2018-10-18 10:13:06 +00:00
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
2010-08-02 02:55:12 +00:00
|
|
|
bl_context = "data"
|
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2011-10-17 06:58:07 +00:00
|
|
|
# XXX: include pose-mode check?
|
2010-08-02 02:55:12 +00:00
|
|
|
return (context.object) and (context.armature)
|
|
|
|
|
|
|
|
def draw(self, context):
|
2014-04-24 19:31:20 +00:00
|
|
|
# layout = self.layout
|
2010-08-02 02:55:12 +00:00
|
|
|
|
|
|
|
ob = context.object
|
2012-07-03 19:09:07 +00:00
|
|
|
avs = ob.pose.animation_visualization
|
2012-05-15 18:50:51 +00:00
|
|
|
|
2012-05-01 16:19:13 +00:00
|
|
|
pchan = context.active_pose_bone
|
|
|
|
mpath = pchan.motion_path if pchan else None
|
2012-05-15 18:50:51 +00:00
|
|
|
|
2012-05-01 16:19:13 +00:00
|
|
|
self.draw_settings(context, avs, mpath, bones=True)
|
2010-08-02 02:55:12 +00:00
|
|
|
|
|
|
|
|
2018-09-11 06:49:52 +00:00
|
|
|
class DATA_PT_motion_paths_display(MotionPathButtonsPanel_display, Panel):
|
2023-03-01 11:12:18 +00:00
|
|
|
# bl_label = "Bones Motion Paths"
|
2018-09-11 06:49:52 +00:00
|
|
|
bl_context = "data"
|
|
|
|
bl_parent_id = "DATA_PT_motion_paths"
|
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
|
|
|
# XXX: include pose-mode check?
|
|
|
|
return (context.object) and (context.armature)
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
# layout = self.layout
|
|
|
|
|
|
|
|
ob = context.object
|
|
|
|
avs = ob.pose.animation_visualization
|
|
|
|
|
|
|
|
pchan = context.active_pose_bone
|
|
|
|
mpath = pchan.motion_path if pchan else None
|
|
|
|
|
|
|
|
self.draw_settings(context, avs, mpath, bones=True)
|
|
|
|
|
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class DATA_PT_custom_props_arm(ArmatureButtonsPanel, PropertyPanel, Panel):
|
2023-09-04 15:42:04 +00:00
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
|
2010-08-12 19:36:10 +00:00
|
|
|
_context_path = "object.data"
|
2010-12-17 10:33:28 +00:00
|
|
|
_property_type = bpy.types.Armature
|
2011-04-04 10:13:04 +00:00
|
|
|
|
2017-03-18 09:03:24 +00:00
|
|
|
|
2023-09-07 14:51:59 +00:00
|
|
|
class DATA_PT_custom_props_bcoll(ArmatureButtonsPanel, PropertyPanel, Panel):
|
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
|
|
|
|
_context_path = "armature.collections.active"
|
|
|
|
_property_type = bpy.types.BoneCollection
|
|
|
|
bl_parent_id = "DATA_PT_bone_collections"
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2023-09-15 12:53:40 +00:00
|
|
|
arm = context.armature
|
|
|
|
if not arm:
|
|
|
|
return False
|
|
|
|
|
|
|
|
is_lib_override = arm.id_data.override_library and arm.id_data.override_library.reference
|
|
|
|
if is_lib_override:
|
|
|
|
# This is due to a limitation in scripts/modules/rna_prop_ui.py; if that
|
|
|
|
# limitation is lifted, this poll function should be adjusted.
|
|
|
|
return False
|
|
|
|
|
|
|
|
return arm.collections.active
|
2023-09-07 14:51:59 +00:00
|
|
|
|
|
|
|
|
2017-03-18 09:03:24 +00:00
|
|
|
classes = (
|
|
|
|
DATA_PT_context_arm,
|
2023-09-28 14:31:55 +00:00
|
|
|
DATA_PT_pose,
|
Anim: replace Bone Groups & Armature Layers with Bone Collections
Armature layers (the 32 little dots) and bone groups are replaced with
Bone Collections:
- Bone collections are stored on the armature, and have a name that is
unique within that armature.
- An armature can have an arbitrary number of bone collections (instead
of the fixed 32 layers).
- Bones can be assigned to zero or more bone collections.
- Bone collections have a visibility setting, just like objects in scene
collections.
- When a bone is in at least one collection, and all its collections in
are hidden, the bone is hidden. In other cases (in any visible
collection, or in no collection at all), the bone visibility is
determined by its own 'hidden' flag.
- For now, bone collections cannot be nested; they are a flat list just
like bone groups were. Nestability of bone collections is intended to
be implemented in a later 4.x release.
- Since bone collections are defined on the armature, they can be used
from both pose mode and edit mode.
Versioning converts bone groups and armature layers to new bone
collections. Layers that do not contain any bones are skipped. The old
data structures remain in DNA and are unaltered, for limited forward
compatibility. That way at least a save with Blender 4.0 will not
immediately erase the bone group and armature layers and their bone
assignments.
Shortcuts:
- M/Shift+M in pose/edit mode: move to collection (M) and add to
collection (shift+M). This works similar to the M/Shift+M menus for
objects & scene collections.
- Ctrl+G in pose mode shows a port of the old 'bone groups' menu. This
is likely to be removed in the near future, as the functionality
overlaps with the M/Shift+M menus.
This is the first commit of a series; the bone collections feature will
be improved before the Blender 4.0 release. See #108941 for more info.
Pull request: https://projects.blender.org/blender/blender/pulls/109976
2023-08-22 10:15:54 +00:00
|
|
|
DATA_PT_bone_collections,
|
|
|
|
DATA_UL_bone_collections,
|
2023-09-28 12:38:54 +00:00
|
|
|
ARMATURE_MT_collection_context_menu,
|
2023-12-28 15:10:02 +00:00
|
|
|
ARMATURE_MT_collection_tree_context_menu,
|
2018-08-02 02:44:17 +00:00
|
|
|
DATA_PT_motion_paths,
|
2018-09-11 06:49:52 +00:00
|
|
|
DATA_PT_motion_paths_display,
|
2019-02-27 18:01:29 +00:00
|
|
|
DATA_PT_display,
|
2017-03-18 09:03:24 +00:00
|
|
|
DATA_PT_iksolver_itasc,
|
2017-03-19 15:34:32 +00:00
|
|
|
DATA_PT_custom_props_arm,
|
2023-09-07 14:51:59 +00:00
|
|
|
DATA_PT_custom_props_bcoll,
|
2017-03-18 09:03:24 +00:00
|
|
|
)
|
|
|
|
|
2011-04-04 10:13:04 +00:00
|
|
|
if __name__ == "__main__": # only for live edit.
|
2017-03-18 09:03:24 +00:00
|
|
|
from bpy.utils import register_class
|
|
|
|
for cls in classes:
|
|
|
|
register_class(cls)
|