Post #4995: In that case, you will create a string property. As shown in the image, please c

📋 Metadata

  • Author: Pluglug
  • Date: 2024-01-12 13:52:21
  • Type: answer
  • Quality Score: 8/10
  • Reply to: post_04991

🏷️ Tags

macro python-scripting intermediate solved

  • Macro Editor
  • Property Editor
  • Python Scripting

💬 Content

In that case, you will create a string property. As shown in the image, please create my_prop_bone_name. You can access this string entered into the property using props().my_prop_bone_name within PME. As you might notice, you can copy this code by clicking on the preview.

imageimage953×852 128 KB

Below is a command using my_prop_bone_name. It searches for bones that match the specified term in the property by prefix, suffix, or exact match, and then selects those bones. Please try this in Pose Mode. If it doesn’t work, let me know the details of your issue.

tgt_bone_name = props().my_prop_bone_name; arm = C.active_object; [setattr(bone.bone, 'select', bone.name.startswith(tgt_bone_name) or bone.name.endswith(tgt_bone_name) or bone.name == tgt_bone_name) for bone in arm.pose.bones] if arm and arm.type == 'ARMATURE' and arm.mode == 'POSE' else None

❤️ 1 likes


🔗 View on Blender Artists