Skip to content

Commit

Permalink
Disallow adding in out animations if no animation is present
Browse files Browse the repository at this point in the history
  • Loading branch information
Griperis committed Feb 8, 2025
1 parent 6bb2531 commit 6b4890e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions data_vis/geonodes/animations.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ class DV_AddInAnimation(DV_AnimationOperator):
items=((AnimationNames.GROW_FROM_ZERO, "Grow", "Grow from zero"),),
)

@classmethod
def poll(cls, context: bpy.types.Context) -> bool:
if not super().poll(context):
return False

return get_action(context.active_object) is not None

def execute(self, context: bpy.types.Context):
obj = context.active_object
if is_in_present(obj):
Expand Down Expand Up @@ -165,6 +172,13 @@ class DV_AddOutAnimation(DV_AnimationOperator):
items=((AnimationNames.GROW_TO_ZERO, "Shrink", "Shrink to zero"),),
)

@classmethod
def poll(cls, context: bpy.types.Context) -> bool:
if not super().poll(context):
return False

return get_action(context.active_object) is not None

def execute(self, context: bpy.types.Context):
obj = context.active_object
if is_out_present(context.active_object):
Expand Down

0 comments on commit 6b4890e

Please sign in to comment.