Skip to content

Commit

Permalink
Add button to manually rebuild pose cache
Browse files Browse the repository at this point in the history
  • Loading branch information
greisane committed Aug 6, 2023
1 parent c19f9a0 commit 0d30f41
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions anim/pose_blender.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,25 @@ def execute(self, context):

return {'FINISHED'}

class GRET_OT_pose_blender_refresh(bpy.types.Operator):
"""Rebuild pose cache. Use if you tweaked the individual poses"""

bl_idname = 'gret.pose_blender_refresh'
bl_label = "Refresh Poses"
bl_options = {'INTERNAL', 'UNDO'}

@classmethod
def poll(cls, context):
obj = context.active_object
return obj and obj.type == 'ARMATURE' and obj.pose_blender.enabled

def execute(self, context):
obj = context.active_object
pbl = obj.pose_blender
pbl.clear_transient_data()

return {'FINISHED'}

def clear_transient_data(self, context):
self.clear_transient_data()

Expand Down Expand Up @@ -451,6 +470,7 @@ def draw_panel(self, context):
row.label(text="Enabled")
row.prop(pbl, 'enabled', text="")
row.enabled = pbl.enabled or pbl.is_valid()
row.operator('gret.pose_blender_refresh', icon='FILE_REFRESH', text="")

def draw_error(text, can_fix=False):
if can_fix:
Expand Down Expand Up @@ -513,6 +533,7 @@ def draw_button_row():
GRET_OT_pose_blender_flip,
GRET_OT_pose_blender_key,
GRET_OT_pose_blender_paste,
GRET_OT_pose_blender_refresh,
GRET_PG_pose_blender,
)

Expand Down

0 comments on commit 0d30f41

Please sign in to comment.