mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
use sel.isAnimated instead of doing check on controller
This commit is contained in:
parent
999563ea52
commit
ef654cd7d8
1 changed files with 12 additions and 29 deletions
|
|
@ -27,41 +27,24 @@ class ValidateNoAnimation(pyblish.api.InstancePlugin,
|
|||
return
|
||||
invalid = self.get_invalid(instance)
|
||||
if invalid:
|
||||
bullet_point_invalid_statement = "\n".join(
|
||||
"- {}: {}".format(obj, message)
|
||||
for obj, message in invalid
|
||||
)
|
||||
raise PublishValidationError(
|
||||
"Keyframes found on:\n\n{0}".format(
|
||||
bullet_point_invalid_statement)
|
||||
"Keyframes found on:\n\n{0}".format(invalid)
|
||||
,
|
||||
title="Keyframes on model"
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def get_invalid(instance):
|
||||
invalid = []
|
||||
selected_objects = instance.data["members"]
|
||||
for sel in selected_objects:
|
||||
sel_pos_ctl = rt.getPropertyController(
|
||||
sel.controller, 'Position')
|
||||
ctl_count = (sel_pos_ctl.keys).count
|
||||
if ctl_count > 0:
|
||||
invalid.append(
|
||||
( (sel), f"Object Position(s) has {ctl_count} keyframe(s)"))
|
||||
sel_rot_ctl = rt.getPropertyController(
|
||||
sel.controller, "Rotation"
|
||||
)
|
||||
ctl_count = (sel_rot_ctl.keys).count
|
||||
if ctl_count > 0:
|
||||
invalid.append(
|
||||
((sel), f"Object Rotation(s) has {ctl_count} keyframe(s)"))
|
||||
sel_scale_ctl = rt.getPropertyController(
|
||||
sel.controller, "Scale"
|
||||
)
|
||||
ctl_count = (sel_scale_ctl.keys).count
|
||||
if ctl_count > 0:
|
||||
invalid.append(
|
||||
((sel), f"Object Scale(s) has {ctl_count} keyframe(s)"))
|
||||
"""Get invalid object(s) which have keyframe(s)
|
||||
|
||||
|
||||
Args:
|
||||
instance (pyblish.api.instance): Instance
|
||||
|
||||
Returns:
|
||||
list: list of invalid objects
|
||||
"""
|
||||
invalid = [invalid for invalid in instance.data["members"]
|
||||
if invalid.isAnimated]
|
||||
|
||||
return invalid
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue