Compare commits

...

1 Commits

Author SHA1 Message Date
pullusb
289455148f Fix error for blender 4 and above using bone collection system
2.0.0

- fixed: bone collection instead of layers for Blender 4+
2025-07-23 12:15:50 +02:00
3 changed files with 16 additions and 14 deletions

View File

@ -1,5 +1,9 @@
# Changelog
2.0.0
- fixed: bone collection instead of layers for Blender 4+
1.8.1
- added: bone propertie search and active bone picker

View File

@ -4,8 +4,8 @@ bl_info = {
"name": "Auto Walk",
"description": "Develop a walk/run cycles along a curve and pin feets",
"author": "Samuel Bernou",
"version": (1, 8, 1),
"blender": (3, 0, 0),
"version": (2, 0, 0),
"blender": (4, 0, 0),
"location": "View3D",
"warning": "",
"doc_url": "https://gitlab.com/autour-de-minuit/blender/auto_walk",

22
fn.py
View File

@ -9,11 +9,7 @@ def get_addon_prefs():
function to read current addon preferences properties
access with : get_addon_prefs().super_special_option
'''
import os
addon_name = os.path.splitext(__name__)[0]
preferences = bpy.context.preferences
addon_prefs = preferences.addons[addon_name].preferences
return (addon_prefs)
return bpy.context.preferences.addons[__package__].preferences
def open_addon_prefs():
'''Open addon prefs windows with focus on current addon'''
@ -739,14 +735,15 @@ def go_edit_mode(ob, context=None):
def get_visible_bones(ob):
'''Get name of all editable bones (unhided *and* on a visible bone layer'''
# visible bone layer index
visible_layers_indexes = [i for i, l in enumerate(ob.data.layers) if l]
# check if layers overlaps
'''Get name of all editable bones (unhidden *and* on a visible bone layer)'''
## list names
visible_bones_collection = [c.name for c in ob.data.collections_all if c.is_visible]
## check if layers overlaps
visible_bones = [b for b in ob.data.bones \
if not b.hide \
if any(i for i, l in enumerate(b.layers) if l and i in visible_layers_indexes)]
if not b.hide and any((col.name in visible_bones_collection for col in b.collections))] # is in a visible bone collection
return visible_bones
@ -760,6 +757,7 @@ def get_x_pos_of_visible_keys(ob, act):
## skip offset + fcu related to invisible bones
viz_bones = get_visible_bones(ob)
print('viz_bones: ', viz_bones)
visible_bone_names = [b.name for b in viz_bones]
keys = []