Skip to content

Commit

Permalink
Merge branch 'develop' into enhancement/OP-7076_Validate-Model-Name
Browse files Browse the repository at this point in the history
  • Loading branch information
moonyuet authored Mar 7, 2024
2 parents 91a7c37 + 1b7e22b commit d35d719
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Bug Report
description: File a bug report
title: ''
title: 'Your issue title here'
labels:
- 'type: bug'
body:
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/enhancement_request.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Enhancement Request
description: Create a report to help us enhance a particular feature
title: ""
title: "Your issue title here"
labels:
- "type: enhancement"
body:
Expand Down Expand Up @@ -49,4 +49,4 @@ body:
label: "Additional context:"
description: Add any other context or screenshots about the enhancement request here.
validations:
required: false
required: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# -*- coding: utf-8 -*-
import pyblish.api
from pymxs import runtime as rt
from ayon_core.pipeline import (
PublishValidationError,
OptionalPyblishPluginMixin
)
from ayon_core.hosts.max.api.action import SelectInvalidAction


def get_invalid_keys(obj):
"""function to check on whether there is keyframe in
Args:
obj (str): object needed to check if there is a keyframe
Returns:
bool: whether invalid object(s) exist
"""
for transform in ["Position", "Rotation", "Scale"]:
num_of_key = rt.NumKeys(rt.getPropertyController(
obj.controller, transform))
if num_of_key > 0:
return True
return False


class ValidateNoAnimation(pyblish.api.InstancePlugin,
OptionalPyblishPluginMixin):
"""Validates No Animation
Ensure no keyframes on nodes in the Instance
"""

order = pyblish.api.ValidatorOrder
families = ["model"]
hosts = ["max"]
optional = True
label = "Validate No Animation"
actions = [SelectInvalidAction]

def process(self, instance):
if not self.is_active(instance.data):
return
invalid = self.get_invalid(instance)
if invalid:
raise PublishValidationError(
"Keyframes found on:\n\n{0}".format(invalid)
,
title="Keyframes on model"
)

@staticmethod
def get_invalid(instance):
"""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 or get_invalid_keys(invalid)]

return invalid
7 changes: 6 additions & 1 deletion client/ayon_core/hosts/resolve/api/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,11 @@ def load(self, files):
source_out = int(_clip_property("End"))
source_duration = int(_clip_property("Frames"))

# Trim clip start if slate is present
if "slate" in self.data["versionData"]["families"]:
source_in += 1
source_duration = source_out - source_in + 1

if not self.with_handles:
# Load file without the handles of the source media
# We remove the handles from the source in and source out
Expand All @@ -435,7 +440,7 @@ def load(self, files):
handle_start = version_data.get("handleStart", 0)
handle_end = version_data.get("handleEnd", 0)
frame_start_handle = frame_start - handle_start
frame_end_handle = frame_start + handle_end
frame_end_handle = frame_end + handle_end
database_frame_duration = int(
frame_end_handle - frame_start_handle + 1
)
Expand Down
10 changes: 9 additions & 1 deletion client/ayon_core/plugins/publish/extract_thumbnail.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,15 @@ def _create_frame_from_video(self, video_file_path, output_dir):
# Set video input attributes
max_int = str(2147483647)
video_data = get_ffprobe_data(video_file_path, logger=self.log)
duration = float(video_data["format"]["duration"])
# Use duration of the individual streams since it is returned with
# higher decimal precision than 'format.duration'. We need this
# more precise value for calculating the correct amount of frames
# for higher FPS ranges or decimal ranges, e.g. 29.97 FPS
duration = max(
float(stream.get("duration", 0))
for stream in video_data["streams"]
if stream.get("codec_type") == "video"
)

cmd_args = [
"-y",
Expand Down
9 changes: 9 additions & 0 deletions server_addon/max/server/settings/publishers.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ class PublishersModel(BaseSettingsModel):
"the system automatically skips checking it"
)
)
ValidateNoAnimation: BasicValidateModel = SettingsField(
default_factory=BasicValidateModel,
title="Validate No Animation"
)
ValidateLoadedPlugin: ValidateLoadedPluginModel = SettingsField(
default_factory=ValidateLoadedPluginModel,
title="Validate Loaded Plugin"
Expand Down Expand Up @@ -176,6 +180,11 @@ class PublishersModel(BaseSettingsModel):
"optional": True,
"active": False
},
"ValidateNoAnimation": {
"enabled": True,
"optional": True,
"active": False,
},
"ExtractModelObj": {
"enabled": True,
"optional": True,
Expand Down
2 changes: 1 addition & 1 deletion server_addon/max/server/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.6"
__version__ = "0.1.7"

0 comments on commit d35d719

Please sign in to comment.