mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
Merge branch 'develop' into enhancement/OP-5920_abc-options-for-Pointcache-Animation-family
This commit is contained in:
commit
242ea77fa8
19 changed files with 253 additions and 3 deletions
42
openpype/hosts/max/api/action.py
Normal file
42
openpype/hosts/max/api/action.py
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
from pymxs import runtime as rt
|
||||
|
||||
import pyblish.api
|
||||
|
||||
from openpype.pipeline.publish import get_errored_instances_from_context
|
||||
|
||||
|
||||
class SelectInvalidAction(pyblish.api.Action):
|
||||
"""Select invalid objects in Blender when a publish plug-in failed."""
|
||||
label = "Select Invalid"
|
||||
on = "failed"
|
||||
icon = "search"
|
||||
|
||||
def process(self, context, plugin):
|
||||
errored_instances = get_errored_instances_from_context(context,
|
||||
plugin=plugin)
|
||||
|
||||
# Get the invalid nodes for the plug-ins
|
||||
self.log.info("Finding invalid nodes...")
|
||||
invalid = list()
|
||||
for instance in errored_instances:
|
||||
invalid_nodes = plugin.get_invalid(instance)
|
||||
if invalid_nodes:
|
||||
if isinstance(invalid_nodes, (list, tuple)):
|
||||
invalid.extend(invalid_nodes)
|
||||
else:
|
||||
self.log.warning(
|
||||
"Failed plug-in doesn't have any selectable objects."
|
||||
)
|
||||
|
||||
if not invalid:
|
||||
self.log.info("No invalid nodes found.")
|
||||
return
|
||||
invalid_names = [obj.name for obj in invalid if isinstance(obj, str)]
|
||||
if not invalid_names:
|
||||
invalid_names = [obj.name for obj, _ in invalid]
|
||||
invalid = [obj for obj, _ in invalid]
|
||||
self.log.info(
|
||||
"Selecting invalid objects: %s", ", ".join(invalid_names)
|
||||
)
|
||||
|
||||
rt.Select(invalid)
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
import pyblish.api
|
||||
from pymxs import runtime as rt
|
||||
|
||||
from openpype.pipeline.publish import (
|
||||
RepairAction,
|
||||
OptionalPyblishPluginMixin,
|
||||
PublishValidationError
|
||||
)
|
||||
from openpype.hosts.max.api.action import SelectInvalidAction
|
||||
|
||||
|
||||
class ValidateCameraAttributes(OptionalPyblishPluginMixin,
|
||||
pyblish.api.InstancePlugin):
|
||||
"""Validates Camera has no invalid attribute properties
|
||||
or values.(For 3dsMax Cameras only)
|
||||
|
||||
"""
|
||||
|
||||
order = pyblish.api.ValidatorOrder
|
||||
families = ['camera']
|
||||
hosts = ['max']
|
||||
label = 'Validate Camera Attributes'
|
||||
actions = [SelectInvalidAction, RepairAction]
|
||||
optional = True
|
||||
|
||||
DEFAULTS = ["fov", "nearrange", "farrange",
|
||||
"nearclip", "farclip"]
|
||||
CAM_TYPE = ["Freecamera", "Targetcamera",
|
||||
"Physical"]
|
||||
|
||||
@classmethod
|
||||
def get_invalid(cls, instance):
|
||||
invalid = []
|
||||
if rt.units.DisplayType != rt.Name("Generic"):
|
||||
cls.log.warning(
|
||||
"Generic Type is not used as a scene unit\n\n"
|
||||
"sure you tweak the settings with your own values\n\n"
|
||||
"before validation.")
|
||||
cameras = instance.data["members"]
|
||||
project_settings = instance.context.data["project_settings"].get("max")
|
||||
cam_attr_settings = (
|
||||
project_settings["publish"]["ValidateCameraAttributes"]
|
||||
)
|
||||
for camera in cameras:
|
||||
if str(rt.ClassOf(camera)) not in cls.CAM_TYPE:
|
||||
cls.log.debug(
|
||||
"Skipping camera created from external plugin..")
|
||||
continue
|
||||
for attr in cls.DEFAULTS:
|
||||
default_value = cam_attr_settings.get(attr)
|
||||
if default_value == float(0):
|
||||
cls.log.debug(
|
||||
f"the value of {attr} in setting set to"
|
||||
" zero. Skipping the check.")
|
||||
continue
|
||||
if round(rt.getProperty(camera, attr), 1) != default_value:
|
||||
cls.log.error(
|
||||
f"Invalid attribute value for {camera.name}:{attr} "
|
||||
f"(should be: {default_value}))")
|
||||
invalid.append(camera)
|
||||
|
||||
return invalid
|
||||
|
||||
def process(self, instance):
|
||||
if not self.is_active(instance.data):
|
||||
self.log.debug("Skipping Validate Camera Attributes.")
|
||||
return
|
||||
invalid = self.get_invalid(instance)
|
||||
|
||||
if invalid:
|
||||
raise PublishValidationError(
|
||||
"Invalid camera attributes found. See log.")
|
||||
|
||||
@classmethod
|
||||
def repair(cls, instance):
|
||||
invalid_cameras = cls.get_invalid(instance)
|
||||
project_settings = instance.context.data["project_settings"].get("max")
|
||||
cam_attr_settings = (
|
||||
project_settings["publish"]["ValidateCameraAttributes"]
|
||||
)
|
||||
for camera in invalid_cameras:
|
||||
for attr in cls.DEFAULTS:
|
||||
expected_value = cam_attr_settings.get(attr)
|
||||
if expected_value == float(0):
|
||||
cls.log.debug(
|
||||
f"the value of {attr} in setting set to zero.")
|
||||
continue
|
||||
rt.setProperty(camera, attr, expected_value)
|
||||
|
|
@ -64,7 +64,7 @@ class CollectRenderInstances(pyblish.api.InstancePlugin):
|
|||
|
||||
new_data = new_instance.data
|
||||
|
||||
new_data["asset"] = seq_name
|
||||
new_data["asset"] = f"/{s.get('output')}"
|
||||
new_data["setMembers"] = seq_name
|
||||
new_data["family"] = "render"
|
||||
new_data["families"] = ["render", "review"]
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ class AfterEffectsSubmitDeadline(
|
|||
"FTRACK_API_KEY",
|
||||
"FTRACK_API_USER",
|
||||
"FTRACK_SERVER",
|
||||
"AVALON_DB",
|
||||
"AVALON_PROJECT",
|
||||
"AVALON_ASSET",
|
||||
"AVALON_TASK",
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ class BlenderSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline,
|
|||
"FTRACK_API_USER",
|
||||
"FTRACK_SERVER",
|
||||
"OPENPYPE_SG_USER",
|
||||
"AVALON_DB",
|
||||
"AVALON_PROJECT",
|
||||
"AVALON_ASSET",
|
||||
"AVALON_TASK",
|
||||
|
|
|
|||
|
|
@ -223,6 +223,7 @@ class FusionSubmitDeadline(
|
|||
"FTRACK_API_KEY",
|
||||
"FTRACK_API_USER",
|
||||
"FTRACK_SERVER",
|
||||
"AVALON_DB",
|
||||
"AVALON_PROJECT",
|
||||
"AVALON_ASSET",
|
||||
"AVALON_TASK",
|
||||
|
|
|
|||
|
|
@ -275,6 +275,7 @@ class HarmonySubmitDeadline(
|
|||
"FTRACK_API_KEY",
|
||||
"FTRACK_API_USER",
|
||||
"FTRACK_SERVER",
|
||||
"AVALON_DB",
|
||||
"AVALON_PROJECT",
|
||||
"AVALON_ASSET",
|
||||
"AVALON_TASK",
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ class HoudiniCacheSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline
|
|||
"FTRACK_API_USER",
|
||||
"FTRACK_SERVER",
|
||||
"OPENPYPE_SG_USER",
|
||||
"AVALON_DB",
|
||||
"AVALON_PROJECT",
|
||||
"AVALON_ASSET",
|
||||
"AVALON_TASK",
|
||||
|
|
|
|||
|
|
@ -205,6 +205,7 @@ class HoudiniSubmitDeadline(
|
|||
"FTRACK_API_USER",
|
||||
"FTRACK_SERVER",
|
||||
"OPENPYPE_SG_USER",
|
||||
"AVALON_DB",
|
||||
"AVALON_PROJECT",
|
||||
"AVALON_ASSET",
|
||||
"AVALON_TASK",
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ class MaxSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline,
|
|||
"FTRACK_API_USER",
|
||||
"FTRACK_SERVER",
|
||||
"OPENPYPE_SG_USER",
|
||||
"AVALON_DB",
|
||||
"AVALON_PROJECT",
|
||||
"AVALON_ASSET",
|
||||
"AVALON_TASK",
|
||||
|
|
|
|||
|
|
@ -201,6 +201,7 @@ class MayaSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline,
|
|||
"FTRACK_API_USER",
|
||||
"FTRACK_SERVER",
|
||||
"OPENPYPE_SG_USER",
|
||||
"AVALON_DB",
|
||||
"AVALON_PROJECT",
|
||||
"AVALON_ASSET",
|
||||
"AVALON_TASK",
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ class MayaSubmitRemotePublishDeadline(
|
|||
if key in os.environ}, **legacy_io.Session)
|
||||
|
||||
# TODO replace legacy_io with context.data
|
||||
environment["AVALON_DB"] = os.environ.get("AVALON_DB")
|
||||
environment["AVALON_PROJECT"] = project_name
|
||||
environment["AVALON_ASSET"] = instance.context.data["asset"]
|
||||
environment["AVALON_TASK"] = instance.context.data["task"]
|
||||
|
|
|
|||
|
|
@ -376,6 +376,7 @@ class NukeSubmitDeadline(pyblish.api.InstancePlugin,
|
|||
keys = [
|
||||
"PYTHONPATH",
|
||||
"PATH",
|
||||
"AVALON_DB",
|
||||
"AVALON_PROJECT",
|
||||
"AVALON_ASSET",
|
||||
"AVALON_TASK",
|
||||
|
|
|
|||
|
|
@ -131,6 +131,7 @@ class ProcessSubmittedCacheJobOnFarm(pyblish.api.InstancePlugin,
|
|||
create_metadata_path(instance, anatomy)
|
||||
|
||||
environment = {
|
||||
"AVALON_DB": os.environ["AVALON_DB"],
|
||||
"AVALON_PROJECT": instance.context.data["projectName"],
|
||||
"AVALON_ASSET": instance.context.data["asset"],
|
||||
"AVALON_TASK": instance.context.data["task"],
|
||||
|
|
|
|||
|
|
@ -187,6 +187,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin,
|
|||
create_metadata_path(instance, anatomy)
|
||||
|
||||
environment = {
|
||||
"AVALON_DB": os.environ["AVALON_DB"],
|
||||
"AVALON_PROJECT": instance.context.data["projectName"],
|
||||
"AVALON_ASSET": instance.context.data["asset"],
|
||||
"AVALON_TASK": instance.context.data["task"],
|
||||
|
|
|
|||
|
|
@ -56,6 +56,16 @@
|
|||
"enabled": false,
|
||||
"attributes": {}
|
||||
},
|
||||
"ValidateCameraAttributes": {
|
||||
"enabled": true,
|
||||
"optional": true,
|
||||
"active": false,
|
||||
"fov": 45.0,
|
||||
"nearrange": 0.0,
|
||||
"farrange": 1000.0,
|
||||
"nearclip": 1.0,
|
||||
"farclip": 1000.0
|
||||
},
|
||||
"ValidateLoadedPlugin": {
|
||||
"enabled": false,
|
||||
"optional": true,
|
||||
|
|
|
|||
|
|
@ -48,6 +48,76 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "dict",
|
||||
"collapsible": true,
|
||||
"checkbox_key": "enabled",
|
||||
"key": "ValidateCameraAttributes",
|
||||
"label": "Validate Camera Attributes",
|
||||
"is_group": true,
|
||||
"children": [
|
||||
{
|
||||
"type": "boolean",
|
||||
"key": "enabled",
|
||||
"label": "Enabled"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"key": "optional",
|
||||
"label": "Optional"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"key": "active",
|
||||
"label": "Active"
|
||||
},
|
||||
{
|
||||
"type": "number",
|
||||
"key": "fov",
|
||||
"label": "Focal Length",
|
||||
"decimal": 1,
|
||||
"minimum": 0,
|
||||
"maximum": 100.0
|
||||
},
|
||||
{
|
||||
"type": "label",
|
||||
"label": "If the value of the camera attributes set to 0, the system automatically skips checking it"
|
||||
},
|
||||
{
|
||||
"type": "number",
|
||||
"key": "nearrange",
|
||||
"label": "Near Range",
|
||||
"decimal": 1,
|
||||
"minimum": 0,
|
||||
"maximum": 100.0
|
||||
},
|
||||
{
|
||||
"type": "number",
|
||||
"key": "farrange",
|
||||
"label": "Far Range",
|
||||
"decimal": 1,
|
||||
"minimum": 0,
|
||||
"maximum": 2000.0
|
||||
},
|
||||
{
|
||||
"type": "number",
|
||||
"key": "nearclip",
|
||||
"label": "Near Clip",
|
||||
"decimal": 1,
|
||||
"minimum": 0,
|
||||
"maximum": 100.0
|
||||
},
|
||||
{
|
||||
"type": "number",
|
||||
"key": "farclip",
|
||||
"label": "Far Clip",
|
||||
"decimal": 1,
|
||||
"minimum": 0,
|
||||
"maximum": 2000.0
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"type": "dict",
|
||||
"collapsible": true,
|
||||
|
|
|
|||
|
|
@ -27,6 +27,17 @@ class ValidateAttributesModel(BaseSettingsModel):
|
|||
return value
|
||||
|
||||
|
||||
class ValidateCameraAttributesModel(BaseSettingsModel):
|
||||
enabled: bool = SettingsField(title="Enabled")
|
||||
optional: bool = SettingsField(title="Optional")
|
||||
active: bool = SettingsField(title="Active")
|
||||
fov: float = SettingsField(0.0, title="Focal Length")
|
||||
nearrange: float = SettingsField(0.0, title="Near Range")
|
||||
farrange: float = SettingsField(0.0, title="Far Range")
|
||||
nearclip: float = SettingsField(0.0, title="Near Clip")
|
||||
farclip: float = SettingsField(0.0, title="Far Clip")
|
||||
|
||||
|
||||
class FamilyMappingItemModel(BaseSettingsModel):
|
||||
product_types: list[str] = SettingsField(
|
||||
default_factory=list,
|
||||
|
|
@ -63,7 +74,14 @@ class PublishersModel(BaseSettingsModel):
|
|||
default_factory=ValidateAttributesModel,
|
||||
title="Validate Attributes"
|
||||
)
|
||||
|
||||
ValidateCameraAttributes: ValidateCameraAttributesModel = SettingsField(
|
||||
default_factory=ValidateCameraAttributesModel,
|
||||
title="Validate Camera Attributes",
|
||||
description=(
|
||||
"If the value of the camera attributes set to 0, "
|
||||
"the system automatically skips checking it"
|
||||
)
|
||||
)
|
||||
ValidateLoadedPlugin: ValidateLoadedPluginModel = SettingsField(
|
||||
default_factory=ValidateLoadedPluginModel,
|
||||
title="Validate Loaded Plugin"
|
||||
|
|
@ -101,6 +119,16 @@ DEFAULT_PUBLISH_SETTINGS = {
|
|||
"enabled": False,
|
||||
"attributes": "{}"
|
||||
},
|
||||
"ValidateCameraAttributes": {
|
||||
"enabled": True,
|
||||
"optional": True,
|
||||
"active": False,
|
||||
"fov": 45.0,
|
||||
"nearrange": 0.0,
|
||||
"farrange": 1000.0,
|
||||
"nearclip": 1.0,
|
||||
"farclip": 1000.0
|
||||
},
|
||||
"ValidateLoadedPlugin": {
|
||||
"enabled": False,
|
||||
"optional": True,
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
__version__ = "0.1.4"
|
||||
__version__ = "0.1.5"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue