rename frame range data

This commit is contained in:
Kayla Man 2023-10-20 21:34:48 +08:00
parent 8369dfddc9
commit a6c11cf08f
11 changed files with 42 additions and 41 deletions

View file

@ -248,19 +248,19 @@ def get_frame_range(asset_doc=None) -> Union[Dict[str, Any], None]:
asset_doc = get_current_project_asset()
data = asset_doc["data"]
frame_start = data.get("frameStart")
frame_end = data.get("frameEnd")
frame_start = data.get("frameStart", 0)
frame_end = data.get("frameEnd", 0)
if frame_start is None or frame_end is None:
return
handle_start = data.get("handleStart", 0)
handle_end = data.get("handleEnd", 0)
frame_start_handle = int(frame_start) - int(handle_start)
frame_end_handle = int(frame_end) + int(handle_end)
return {
"frameStart": frame_start,
"frameEnd": frame_end,
"handleStart": handle_start,
"handleEnd": handle_end
"frame_start_handle": frame_start_handle,
"frame_end_handle": frame_end_handle,
}
@ -280,12 +280,11 @@ def reset_frame_range(fps: bool = True):
fps_number = float(data_fps["data"]["fps"])
rt.frameRate = fps_number
frame_range = get_frame_range()
frame_start_handle = frame_range["frameStart"] - int(
frame_range["handleStart"]
)
frame_end_handle = frame_range["frameEnd"] + int(frame_range["handleEnd"])
set_timeline(frame_start_handle, frame_end_handle)
set_render_frame_range(frame_start_handle, frame_end_handle)
set_timeline(
frame_range["frame_start_handle"], frame_range["frame_end_handle"])
set_render_frame_range(
frame_range["frame_start_handle"], frame_range["frame_end_handle"])
def set_context_setting():

View file

@ -16,8 +16,8 @@ class CollectFrameRange(pyblish.api.InstancePlugin):
def process(self, instance):
if instance.data["family"] == "maxrender":
instance.data["frameStart"] = int(rt.rendStart)
instance.data["frameEnd"] = int(rt.rendEnd)
instance.data["frameStartHandle"] = int(rt.rendStart)
instance.data["frameEndHandle"] = int(rt.rendEnd)
else:
instance.data["frameStart"] = int(rt.animationRange.start)
instance.data["frameEnd"] = int(rt.animationRange.end)
instance.data["frameStartHandle"] = int(rt.animationRange.start)
instance.data["frameEndHandle"] = int(rt.animationRange.end)

View file

@ -97,8 +97,8 @@ class CollectRender(pyblish.api.InstancePlugin):
"renderer": renderer,
"source": filepath,
"plugin": "3dsmax",
"frameStart": int(rt.rendStart),
"frameEnd": int(rt.rendEnd),
"frameStart": instance.data.get("frameStartHandle"),
"frameEnd": instance.data.get("frameEndHandle"),
"version": version_int,
"farm": True
}

View file

@ -29,6 +29,8 @@ class CollectReview(pyblish.api.InstancePlugin,
attr_values = self.get_attr_values_from_data(instance.data)
data = {
"review_camera": camera_name,
"frameStart": instance.data.get("frameStartHandle"),
"frameEnd": instance.data.get("frameEndHandle"),
"fps": instance.context.data["fps"],
"dspGeometry": attr_values.get("dspGeometry"),
"dspShapes": attr_values.get("dspShapes"),

View file

@ -19,8 +19,8 @@ class ExtractCameraAlembic(publish.Extractor, OptionalPyblishPluginMixin):
def process(self, instance):
if not self.is_active(instance.data):
return
start = instance.data["frameStart"]
end = instance.data["frameEnd"]
start = instance.data["frameStartHandle"]
end = instance.data["frameEndHandle"]
self.log.info("Extracting Camera ...")

View file

@ -51,8 +51,8 @@ class ExtractAlembic(publish.Extractor):
families = ["pointcache"]
def process(self, instance):
start = instance.data["frameStart"]
end = instance.data["frameEnd"]
start = instance.data["frameStartHandle"]
end = instance.data["frameEndHandle"]
self.log.debug("Extracting pointcache ...")

View file

@ -40,8 +40,8 @@ class ExtractPointCloud(publish.Extractor):
def process(self, instance):
self.settings = self.get_setting(instance)
start = instance.data["frameStart"]
end = instance.data["frameEnd"]
start = instance.data["frameStartHandle"]
end = instance.data["frameEndHandle"]
self.log.info("Extracting PRT...")
stagingdir = self.staging_dir(instance)

View file

@ -16,8 +16,8 @@ class ExtractRedshiftProxy(publish.Extractor):
families = ["redshiftproxy"]
def process(self, instance):
start = instance.data["frameStart"]
end = instance.data["frameEnd"]
start = instance.data["frameStartHandle"]
end = instance.data["frameEndHandle"]
self.log.debug("Extracting Redshift Proxy...")
stagingdir = self.staging_dir(instance)

View file

@ -48,8 +48,8 @@ class ExtractReviewAnimation(publish.Extractor):
"ext": instance.data["imageFormat"],
"files": filenames,
"stagingDir": staging_dir,
"frameStart": instance.data["frameStart"],
"frameEnd": instance.data["frameEnd"],
"frameStart": instance.data["frameStartHandle"],
"frameEnd": instance.data["frameEndHandle"],
"tags": tags,
"preview": True,
"camera_name": review_camera

View file

@ -24,7 +24,7 @@ class ExtractThumbnail(publish.Extractor):
f"Create temp directory {tmp_staging} for thumbnail"
)
fps = int(instance.data["fps"])
frame = int(instance.data["frameStart"])
frame = int(instance.data["frameStartHandle"])
instance.context.data["cleanupFullPaths"].append(tmp_staging)
filename = "{name}_thumbnail..png".format(**instance.data)
filepath = os.path.join(tmp_staging, filename)

View file

@ -43,14 +43,10 @@ class ValidateFrameRange(pyblish.api.InstancePlugin,
frame_range = get_frame_range(
asset_doc=instance.data["assetEntity"])
inst_frame_start = instance.data.get("frameStart")
inst_frame_end = instance.data.get("frameEnd")
frame_start_handle = frame_range["frameStart"] - int(
frame_range["handleStart"]
)
frame_end_handle = frame_range["frameEnd"] + int(
frame_range["handleEnd"]
)
inst_frame_start = instance.data.get("frameStartHandle")
inst_frame_end = instance.data.get("frameEndHandle")
frame_start_handle = frame_range["frame_start_handle"]
frame_end_handle = frame_range["frame_end_handle"]
errors = []
if frame_start_handle != inst_frame_start:
errors.append(
@ -63,10 +59,14 @@ class ValidateFrameRange(pyblish.api.InstancePlugin,
"from the asset data. ")
if errors:
errors.append("You can use repair action to fix it.")
report = "Frame range settings are incorrect.\n\n"
for error in errors:
report += "- {}\n\n".format(error)
bullet_point_errors = "\n".join(
"- {}".format(error) for error in errors
)
report = (
"Frame range settings are incorrect.\n\n"
f"{bullet_point_errors}\n\n"
"You can use repair action to fix it."
)
raise PublishValidationError(report, title="Frame Range incorrect")
@classmethod