Last active
May 19, 2024 11:18
-
-
Save mio3io/8fd9ad00fd52c4fe0f04fba75859cfa4 to your computer and use it in GitHub Desktop.
Blenderのアーマチュアのポーズポジションを一括で切り替えるボタン
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Author
mio3io
commented
May 19, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment