Skip to content

Instantly share code, notes, and snippets.

@mio3io
Last active May 19, 2024 11:18
Show Gist options
  • Save mio3io/8fd9ad00fd52c4fe0f04fba75859cfa4 to your computer and use it in GitHub Desktop.
Save mio3io/8fd9ad00fd52c4fe0f04fba75859cfa4 to your computer and use it in GitHub Desktop.
Blenderのアーマチュアのポーズポジションを一括で切り替えるボタン
import bpy
bl_info = {
"name": "Mio3 TogglePose",
"author": "mio",
"version": (1, 2, 0),
"blender": (3, 0, 0),
"warning": "",
"location": "View3D",
"description": "",
"category": "Armature",
}
def addPanel(self, context):
if bpy.context.mode not in {"OBJECT", "POSE", "EDIT_MESH", "PAINT_WEIGHT", "PAINT_VERTEX", "SCULPT"}:
return
row = self.layout.row(align=True)
row.prop(bpy.context.scene.mio3tp, "pose", text="", icon="ARMATURE_DATA")
def callback_pose_mode(self, context):
pose = "POSE" if context.scene.mio3tp.pose else "REST"
for a in bpy.data.armatures:
a.pose_position = pose
class MIO3TP_Props(bpy.types.PropertyGroup):
pose: bpy.props.BoolProperty(
name="pose_position",
description="mio3tp_pose",
default=True,
update=callback_pose_mode,
)
def register():
bpy.utils.register_class(MIO3TP_Props)
bpy.types.VIEW3D_HT_tool_header.append(addPanel)
bpy.types.Scene.mio3tp = bpy.props.PointerProperty(type=MIO3TP_Props)
def unregister():
bpy.utils.unregister_class(MIO3TP_Props)
bpy.types.VIEW3D_HT_tool_header.remove(addPanel)
del bpy.types.Scene.mio3tp
if __name__ == "__main__":
register()
@mio3io
Copy link
Author

mio3io commented May 19, 2024

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment