mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Merge pull request #4914 from ynput/enhancement/OP-5808_Enhancement-3dsmax-rendering-time-data-from-instance
This commit is contained in:
commit
029f653d7b
8 changed files with 121 additions and 11 deletions
|
|
@ -138,7 +138,7 @@ def get_default_render_folder(project_setting=None):
|
||||||
["default_render_image_folder"])
|
["default_render_image_folder"])
|
||||||
|
|
||||||
|
|
||||||
def set_framerange(start_frame, end_frame):
|
def set_render_frame_range(start_frame, end_frame):
|
||||||
"""
|
"""
|
||||||
Note:
|
Note:
|
||||||
Frame range can be specified in different types. Possible values are:
|
Frame range can be specified in different types. Possible values are:
|
||||||
|
|
@ -150,10 +150,10 @@ def set_framerange(start_frame, end_frame):
|
||||||
Todo:
|
Todo:
|
||||||
Current type is hard-coded, there should be a custom setting for this.
|
Current type is hard-coded, there should be a custom setting for this.
|
||||||
"""
|
"""
|
||||||
rt.rendTimeType = 4
|
rt.rendTimeType = 3
|
||||||
if start_frame is not None and end_frame is not None:
|
if start_frame is not None and end_frame is not None:
|
||||||
frame_range = "{0}-{1}".format(start_frame, end_frame)
|
rt.rendStart = int(start_frame)
|
||||||
rt.rendPickupFrames = frame_range
|
rt.rendEnd = int(end_frame)
|
||||||
|
|
||||||
|
|
||||||
def get_multipass_setting(project_setting=None):
|
def get_multipass_setting(project_setting=None):
|
||||||
|
|
@ -249,6 +249,7 @@ def reset_frame_range(fps: bool = True):
|
||||||
frame_end = frame_range["frameEnd"] + int(frame_range["handleEnd"])
|
frame_end = frame_range["frameEnd"] + int(frame_range["handleEnd"])
|
||||||
frange_cmd = f"animationRange = interval {frame_start} {frame_end}"
|
frange_cmd = f"animationRange = interval {frame_start} {frame_end}"
|
||||||
rt.execute(frange_cmd)
|
rt.execute(frange_cmd)
|
||||||
|
set_render_frame_range(frame_start, frame_end)
|
||||||
|
|
||||||
|
|
||||||
def set_context_setting():
|
def set_context_setting():
|
||||||
|
|
@ -265,6 +266,7 @@ def set_context_setting():
|
||||||
None
|
None
|
||||||
"""
|
"""
|
||||||
reset_scene_resolution()
|
reset_scene_resolution()
|
||||||
|
reset_frame_range()
|
||||||
|
|
||||||
|
|
||||||
def get_max_version():
|
def get_max_version():
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,9 @@ class RenderProducts(object):
|
||||||
container)
|
container)
|
||||||
|
|
||||||
context = get_current_project_asset()
|
context = get_current_project_asset()
|
||||||
startFrame = context["data"].get("frameStart")
|
# TODO: change the frame range follows the current render setting
|
||||||
endFrame = context["data"].get("frameEnd") + 1
|
startFrame = int(rt.rendStart)
|
||||||
|
endFrame = int(rt.rendEnd) + 1
|
||||||
|
|
||||||
img_fmt = self._project_settings["max"]["RenderSettings"]["image_format"] # noqa
|
img_fmt = self._project_settings["max"]["RenderSettings"]["image_format"] # noqa
|
||||||
full_render_list = self.beauty_render_product(output_file,
|
full_render_list = self.beauty_render_product(output_file,
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from openpype.pipeline import legacy_io
|
||||||
from openpype.pipeline.context_tools import get_current_project_asset
|
from openpype.pipeline.context_tools import get_current_project_asset
|
||||||
|
|
||||||
from openpype.hosts.max.api.lib import (
|
from openpype.hosts.max.api.lib import (
|
||||||
set_framerange,
|
set_render_frame_range,
|
||||||
get_current_renderer,
|
get_current_renderer,
|
||||||
get_default_render_folder
|
get_default_render_folder
|
||||||
)
|
)
|
||||||
|
|
@ -68,7 +68,7 @@ class RenderSettings(object):
|
||||||
# Set Frame Range
|
# Set Frame Range
|
||||||
frame_start = context["data"].get("frame_start")
|
frame_start = context["data"].get("frame_start")
|
||||||
frame_end = context["data"].get("frame_end")
|
frame_end = context["data"].get("frame_end")
|
||||||
set_framerange(frame_start, frame_end)
|
set_render_frame_range(frame_start, frame_end)
|
||||||
# get the production render
|
# get the production render
|
||||||
renderer_class = get_current_renderer()
|
renderer_class = get_current_renderer()
|
||||||
renderer = str(renderer_class).split(":")[0]
|
renderer = str(renderer_class).split(":")[0]
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,6 @@ class CollectRender(pyblish.api.InstancePlugin):
|
||||||
|
|
||||||
self.log.debug(f"Setting {version_int} to context.")
|
self.log.debug(f"Setting {version_int} to context.")
|
||||||
context.data["version"] = version_int
|
context.data["version"] = version_int
|
||||||
|
|
||||||
# setup the plugin as 3dsmax for the internal renderer
|
# setup the plugin as 3dsmax for the internal renderer
|
||||||
data = {
|
data = {
|
||||||
"subset": instance.name,
|
"subset": instance.name,
|
||||||
|
|
@ -59,8 +58,8 @@ class CollectRender(pyblish.api.InstancePlugin):
|
||||||
"source": filepath,
|
"source": filepath,
|
||||||
"expectedFiles": render_layer_files,
|
"expectedFiles": render_layer_files,
|
||||||
"plugin": "3dsmax",
|
"plugin": "3dsmax",
|
||||||
"frameStart": context.data['frameStart'],
|
"frameStart": int(rt.rendStart),
|
||||||
"frameEnd": context.data['frameEnd'],
|
"frameEnd": int(rt.rendEnd),
|
||||||
"version": version_int,
|
"version": version_int,
|
||||||
"farm": True
|
"farm": True
|
||||||
}
|
}
|
||||||
|
|
|
||||||
64
openpype/hosts/max/plugins/publish/validate_frame_range.py
Normal file
64
openpype/hosts/max/plugins/publish/validate_frame_range.py
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
import pyblish.api
|
||||||
|
|
||||||
|
from pymxs import runtime as rt
|
||||||
|
from openpype.pipeline import (
|
||||||
|
OptionalPyblishPluginMixin
|
||||||
|
)
|
||||||
|
from openpype.pipeline.publish import (
|
||||||
|
RepairAction,
|
||||||
|
ValidateContentsOrder,
|
||||||
|
PublishValidationError
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class ValidateFrameRange(pyblish.api.InstancePlugin,
|
||||||
|
OptionalPyblishPluginMixin):
|
||||||
|
"""Validates the frame ranges.
|
||||||
|
|
||||||
|
This is an optional validator checking if the frame range on instance
|
||||||
|
matches the frame range specified for the asset.
|
||||||
|
|
||||||
|
It also validates render frame ranges of render layers.
|
||||||
|
|
||||||
|
Repair action will change everything to match the asset frame range.
|
||||||
|
|
||||||
|
This can be turned off by the artist to allow custom ranges.
|
||||||
|
"""
|
||||||
|
|
||||||
|
label = "Validate Frame Range"
|
||||||
|
order = ValidateContentsOrder
|
||||||
|
families = ["maxrender"]
|
||||||
|
hosts = ["max"]
|
||||||
|
optional = True
|
||||||
|
actions = [RepairAction]
|
||||||
|
|
||||||
|
def process(self, instance):
|
||||||
|
if not self.is_active(instance.data):
|
||||||
|
self.log.info("Skipping validation...")
|
||||||
|
return
|
||||||
|
context = instance.context
|
||||||
|
|
||||||
|
frame_start = int(context.data.get("frameStart"))
|
||||||
|
frame_end = int(context.data.get("frameEnd"))
|
||||||
|
|
||||||
|
inst_frame_start = int(instance.data.get("frameStart"))
|
||||||
|
inst_frame_end = int(instance.data.get("frameEnd"))
|
||||||
|
|
||||||
|
errors = []
|
||||||
|
if frame_start != inst_frame_start:
|
||||||
|
errors.append(
|
||||||
|
f"Start frame ({inst_frame_start}) on instance does not match " # noqa
|
||||||
|
f"with the start frame ({frame_start}) set on the asset data. ") # noqa
|
||||||
|
if frame_end != inst_frame_end:
|
||||||
|
errors.append(
|
||||||
|
f"End frame ({inst_frame_end}) on instance does not match "
|
||||||
|
f"with the end frame ({frame_start}) from the asset data. ")
|
||||||
|
|
||||||
|
if errors:
|
||||||
|
errors.append("You can use repair action to fix it.")
|
||||||
|
raise PublishValidationError("\n".join(errors))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def repair(cls, instance):
|
||||||
|
rt.rendStart = instance.context.data.get("frameStart")
|
||||||
|
rt.rendEnd = instance.context.data.get("frameEnd")
|
||||||
|
|
@ -19,5 +19,12 @@
|
||||||
"custFloats": "custFloats",
|
"custFloats": "custFloats",
|
||||||
"custVecs": "custVecs"
|
"custVecs": "custVecs"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"publish": {
|
||||||
|
"ValidateFrameRange": {
|
||||||
|
"enabled": true,
|
||||||
|
"optional": true,
|
||||||
|
"active": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "schema",
|
||||||
|
"name": "schema_max_publish"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"type": "dict",
|
||||||
|
"collapsible": true,
|
||||||
|
"key": "publish",
|
||||||
|
"label": "Publish plugins",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"type": "dict",
|
||||||
|
"collapsible": true,
|
||||||
|
"checkbox_key": "enabled",
|
||||||
|
"key": "ValidateFrameRange",
|
||||||
|
"label": "Validate Frame Range",
|
||||||
|
"is_group": true,
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"type": "boolean",
|
||||||
|
"key": "enabled",
|
||||||
|
"label": "Enabled"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "boolean",
|
||||||
|
"key": "optional",
|
||||||
|
"label": "Optional"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "boolean",
|
||||||
|
"key": "active",
|
||||||
|
"label": "Active"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue