Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for bone collections in Blender 4.0 #647

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion resources/translations.csv
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ ToolPanel.category,CATS,,
ArmaturePanel.label,Model,モデル,모델
ArmaturePanel.warn.newBlender1,Potentially unsupported Blender version detected!
ArmaturePanel.warn.newBlender2,Some features might not work!
ArmaturePanel.warn.newBlender3,CATS currently supports up to Blender 3.5.
ArmaturePanel.warn.newBlender3,CATS currently supports up to Blender 4.0.
ArmaturePanel.warn.oldBlender1,Old Blender version detected!,古いブレンダーバージョンが検出されました!,이전 블렌더 버전이 발견되었습니다!
ArmaturePanel.warn.oldBlender2,Some features might not work!,一部の機能は動作しない可能性があります!,일부 기능이 작동하지 않을 수 있습니다!
ArmaturePanel.warn.oldBlender3,Please update to Blender 2.79!,ブレンダー2.79以上にアップデートしてください!,블렌더 2.79 버전으로 업데이트하세요!
Expand Down
14 changes: 10 additions & 4 deletions tools/armature.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from . import translate as Translate
from . import armature_bones as Bones
from .common import version_2_79_or_older
from .common import version_3_6_or_older
from .register import register_wrap
from .translations import t

Expand Down Expand Up @@ -493,9 +494,13 @@ def execute(self, context):
if bpy.ops.mesh.reveal.poll():
bpy.ops.mesh.reveal()

# Remove Bone Groups
for group in armature.pose.bone_groups:
armature.pose.bone_groups.remove(group)
# Remove Bone Groups or Collections
if version_3_6_or_older():
for group in armature.pose.bone_groups:
armature.pose.bone_groups.remove(group)
else:
for collection in armature.data.collections:
armature.data.collections.remove(collection)

# Bone constraints should be deleted
# if context.scene.remove_constraints:
Expand All @@ -512,7 +517,8 @@ def execute(self, context):
steps += 1
else:
steps -= 1
bone.layers[0] = True
if version_3_6_or_older():
bone.layers[0] = True

# Start loading bar
current_step = 0
Expand Down
2 changes: 2 additions & 0 deletions tools/armature_bones.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,8 @@
'Bip_Collar_\L',
'B_\L_Shoulder',
'\LCollar',
'Collar\L',
'Collar_\L',
'\L_Clavicle',
'\L_Clavicle1',
'\Left_Clavicle',
Expand Down
3 changes: 3 additions & 0 deletions tools/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def version_2_79_or_older():
def version_2_93_or_older():
return bpy.app.version < (2, 90)

def version_3_6_or_older():
return bpy.app.version < (3, 7)


def get_objects():
return bpy.context.scene.objects if version_2_79_or_older() else bpy.context.view_layer.objects
Expand Down
2 changes: 1 addition & 1 deletion ui/armature.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def draw(self, context):
col.separator()
col.separator()

if bpy.app.version > (3, 5, 99):
if bpy.app.version > (4, 0, 99):
col.separator()
row = col.row(align=True)
row.scale_y = 0.75
Expand Down