mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
added settings category
This commit is contained in:
parent
18667e202e
commit
0e67a3ed39
31 changed files with 112 additions and 66 deletions
|
|
@ -4,6 +4,7 @@ import itertools
|
|||
from pathlib import Path
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
import pyblish.api
|
||||
import bpy
|
||||
|
||||
from ayon_core.pipeline import (
|
||||
|
|
@ -13,6 +14,7 @@ from ayon_core.pipeline import (
|
|||
AVALON_INSTANCE_ID,
|
||||
AYON_INSTANCE_ID,
|
||||
)
|
||||
from ayon_core.pipeline.publish import Extractor
|
||||
from ayon_core.lib import BoolDef
|
||||
|
||||
from .pipeline import (
|
||||
|
|
@ -161,10 +163,23 @@ def deselect_all():
|
|||
bpy.context.view_layer.objects.active = active
|
||||
|
||||
|
||||
class BlenderInstancePlugin(pyblish.api.InstancePlugin):
|
||||
settings_category = "blender"
|
||||
|
||||
|
||||
class BlenderContextPlugin(pyblish.api.ContextPlugin):
|
||||
settings_category = "blender"
|
||||
|
||||
|
||||
class BlenderExtractor(Extractor):
|
||||
settings_category = "blender"
|
||||
|
||||
|
||||
class BaseCreator(Creator):
|
||||
"""Base class for Blender Creator plug-ins."""
|
||||
defaults = ['Main']
|
||||
|
||||
settings_category = "blender"
|
||||
create_as_asset_group = False
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -386,6 +401,7 @@ class AssetLoader(LoaderPlugin):
|
|||
it's different for different types (e.g. model, rig, animation,
|
||||
etc.).
|
||||
"""
|
||||
settings_category = "blender"
|
||||
|
||||
@staticmethod
|
||||
def _get_instance_empty(instance_name: str, nodes: List) -> Optional[bpy.types.Object]:
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import pyblish.api
|
||||
from ayon_blender.api import workio
|
||||
from ayon_blender.api import workio, plugin
|
||||
|
||||
|
||||
class CollectBlenderCurrentFile(pyblish.api.ContextPlugin):
|
||||
class CollectBlenderCurrentFile(plugin.BlenderContextPlugin):
|
||||
"""Inject the current working file into context"""
|
||||
|
||||
order = pyblish.api.CollectorOrder - 0.5
|
||||
|
|
|
|||
|
|
@ -3,10 +3,11 @@ import bpy
|
|||
import pyblish.api
|
||||
|
||||
from ayon_core.pipeline.publish import KnownPublishError
|
||||
from ayon_blender.api import plugin
|
||||
from ayon_blender.api.pipeline import AVALON_PROPERTY
|
||||
|
||||
|
||||
class CollectBlenderInstanceData(pyblish.api.InstancePlugin):
|
||||
class CollectBlenderInstanceData(plugin.BlenderInstancePlugin):
|
||||
"""Validator to verify that the instance is not empty"""
|
||||
|
||||
order = pyblish.api.CollectorOrder
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ import os
|
|||
import re
|
||||
|
||||
import bpy
|
||||
|
||||
from ayon_blender.api import colorspace
|
||||
import pyblish.api
|
||||
|
||||
from ayon_blender.api import colorspace, plugin
|
||||
|
||||
class CollectBlenderRender(pyblish.api.InstancePlugin):
|
||||
|
||||
class CollectBlenderRender(plugin.BlenderInstancePlugin):
|
||||
"""Gather all publishable render instances."""
|
||||
|
||||
order = pyblish.api.CollectorOrder + 0.01
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import bpy
|
||||
|
||||
import pyblish.api
|
||||
from ayon_blender.api import plugin
|
||||
|
||||
|
||||
class CollectReview(pyblish.api.InstancePlugin):
|
||||
class CollectReview(plugin.BlenderInstancePlugin):
|
||||
"""Collect Review data
|
||||
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
from pathlib import Path
|
||||
|
||||
from pyblish.api import InstancePlugin, CollectorOrder
|
||||
from pyblish.api import CollectorOrder
|
||||
from ayon_blender.api import plugin
|
||||
|
||||
|
||||
class CollectWorkfile(InstancePlugin):
|
||||
class CollectWorkfile(plugin.BlenderInstancePlugin):
|
||||
"""Inject workfile data into its instance."""
|
||||
|
||||
order = CollectorOrder
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from ayon_core.pipeline import publish
|
|||
from ayon_blender.api import plugin
|
||||
|
||||
|
||||
class ExtractABC(publish.Extractor, publish.OptionalPyblishPluginMixin):
|
||||
class ExtractABC(plugin.BlenderExtractor, publish.OptionalPyblishPluginMixin):
|
||||
"""Extract as ABC."""
|
||||
|
||||
label = "Extract ABC"
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ from ayon_blender.api import plugin
|
|||
|
||||
|
||||
class ExtractAnimationABC(
|
||||
publish.Extractor,
|
||||
publish.OptionalPyblishPluginMixin,
|
||||
plugin.BlenderExtractor,
|
||||
publish.OptionalPyblishPluginMixin,
|
||||
):
|
||||
"""Extract as ABC."""
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,12 @@ import os
|
|||
import bpy
|
||||
|
||||
from ayon_core.pipeline import publish
|
||||
from ayon_blender.api import plugin
|
||||
|
||||
|
||||
class ExtractBlend(publish.Extractor, publish.OptionalPyblishPluginMixin):
|
||||
class ExtractBlend(
|
||||
plugin.BlenderExtractor, publish.OptionalPyblishPluginMixin
|
||||
):
|
||||
"""Extract a blend file."""
|
||||
|
||||
label = "Extract Blend"
|
||||
|
|
|
|||
|
|
@ -3,11 +3,12 @@ import os
|
|||
import bpy
|
||||
|
||||
from ayon_core.pipeline import publish
|
||||
from ayon_blender.api import plugin
|
||||
|
||||
|
||||
class ExtractBlendAnimation(
|
||||
publish.Extractor,
|
||||
publish.OptionalPyblishPluginMixin,
|
||||
plugin.BlenderExtractor,
|
||||
publish.OptionalPyblishPluginMixin,
|
||||
):
|
||||
"""Extract a blend file."""
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ from ayon_core.pipeline import publish
|
|||
from ayon_blender.api import plugin
|
||||
|
||||
|
||||
class ExtractCameraABC(publish.Extractor, publish.OptionalPyblishPluginMixin):
|
||||
class ExtractCameraABC(
|
||||
plugin.BlenderExtractor, publish.OptionalPyblishPluginMixin
|
||||
):
|
||||
"""Extract camera as ABC."""
|
||||
|
||||
label = "Extract Camera (ABC)"
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ from ayon_core.pipeline import publish
|
|||
from ayon_blender.api import plugin
|
||||
|
||||
|
||||
class ExtractCamera(publish.Extractor, publish.OptionalPyblishPluginMixin):
|
||||
class ExtractCamera(
|
||||
plugin.BlenderExtractor, publish.OptionalPyblishPluginMixin
|
||||
):
|
||||
"""Extract as the camera as FBX."""
|
||||
|
||||
label = "Extract Camera (FBX)"
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ from ayon_core.pipeline import publish
|
|||
from ayon_blender.api import plugin
|
||||
|
||||
|
||||
class ExtractFBX(publish.Extractor, publish.OptionalPyblishPluginMixin):
|
||||
class ExtractFBX(
|
||||
plugin.BlenderExtractor, publish.OptionalPyblishPluginMixin
|
||||
):
|
||||
"""Extract as FBX."""
|
||||
|
||||
label = "Extract FBX"
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ def get_highest_root(objects):
|
|||
|
||||
|
||||
class ExtractAnimationFBX(
|
||||
publish.Extractor,
|
||||
publish.OptionalPyblishPluginMixin,
|
||||
plugin.BlenderExtractor,
|
||||
publish.OptionalPyblishPluginMixin,
|
||||
):
|
||||
"""Extract as animation."""
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@ from ayon_blender.api import plugin
|
|||
from ayon_blender.api.pipeline import AVALON_PROPERTY
|
||||
|
||||
|
||||
class ExtractLayout(publish.Extractor, publish.OptionalPyblishPluginMixin):
|
||||
class ExtractLayout(
|
||||
plugin.BlenderExtractor, publish.OptionalPyblishPluginMixin
|
||||
):
|
||||
"""Extract a layout."""
|
||||
|
||||
label = "Extract Layout (JSON)"
|
||||
|
|
|
|||
|
|
@ -7,11 +7,13 @@ import pyblish.api
|
|||
import bpy
|
||||
|
||||
from ayon_core.pipeline import publish
|
||||
from ayon_blender.api import capture
|
||||
from ayon_blender.api import capture, plugin
|
||||
from ayon_blender.api.lib import maintained_time
|
||||
|
||||
|
||||
class ExtractPlayblast(publish.Extractor, publish.OptionalPyblishPluginMixin):
|
||||
class ExtractPlayblast(
|
||||
plugin.BlenderExtractor, publish.OptionalPyblishPluginMixin
|
||||
):
|
||||
"""
|
||||
Extract viewport playblast.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,14 +3,13 @@ import glob
|
|||
import json
|
||||
|
||||
import pyblish.api
|
||||
from ayon_core.pipeline import publish
|
||||
from ayon_blender.api import capture
|
||||
from ayon_blender.api import capture, plugin
|
||||
from ayon_blender.api.lib import maintained_time
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
class ExtractThumbnail(publish.Extractor):
|
||||
class ExtractThumbnail(plugin.BlenderExtractor):
|
||||
"""Extract viewport thumbnail.
|
||||
|
||||
Takes review camera and creates a thumbnail based on viewport
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@ import os
|
|||
|
||||
import bpy
|
||||
|
||||
from ayon_core.pipeline import publish
|
||||
from ayon_core.pipeline import KnownPublishError
|
||||
from ayon_blender.api import plugin, lib
|
||||
|
||||
|
||||
class ExtractUSD(publish.Extractor):
|
||||
class ExtractUSD(plugin.BlenderExtractor):
|
||||
"""Extract as USD."""
|
||||
|
||||
label = "Extract USD"
|
||||
|
|
@ -40,7 +40,7 @@ class ExtractUSD(publish.Extractor):
|
|||
root = lib.get_highest_root(objects=instance[:])
|
||||
if not root:
|
||||
instance_node = instance.data["transientData"]["instance_node"]
|
||||
raise publish.KnownPublishError(
|
||||
raise KnownPublishError(
|
||||
f"No root object found in instance: {instance_node.name}"
|
||||
)
|
||||
self.log.debug(f"Exporting using active root: {root.name}")
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
import pyblish.api
|
||||
from ayon_core.pipeline.publish import OptionalPyblishPluginMixin
|
||||
from ayon_blender.api.workio import save_file
|
||||
from ayon_blender.api import plugin
|
||||
|
||||
|
||||
class IncrementWorkfileVersion(
|
||||
pyblish.api.ContextPlugin,
|
||||
OptionalPyblishPluginMixin
|
||||
plugin.BlenderContextPlugin,
|
||||
OptionalPyblishPluginMixin
|
||||
):
|
||||
"""Increment current workfile version."""
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,12 @@ import json
|
|||
|
||||
import pyblish.api
|
||||
from ayon_core.pipeline.publish import OptionalPyblishPluginMixin
|
||||
from ayon_blender.api import plugin
|
||||
|
||||
|
||||
class IntegrateAnimation(
|
||||
pyblish.api.InstancePlugin,
|
||||
OptionalPyblishPluginMixin,
|
||||
plugin.BlenderInstancePlugin,
|
||||
OptionalPyblishPluginMixin,
|
||||
):
|
||||
"""Generate a JSON file for animation."""
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@ from typing import List
|
|||
|
||||
import bpy
|
||||
|
||||
import pyblish.api
|
||||
|
||||
import ayon_blender.api.action
|
||||
from ayon_blender.api import plugin
|
||||
from ayon_core.pipeline.publish import (
|
||||
ValidateContentsOrder,
|
||||
PublishValidationError,
|
||||
|
|
@ -12,8 +11,10 @@ from ayon_core.pipeline.publish import (
|
|||
)
|
||||
|
||||
|
||||
class ValidateCameraZeroKeyframe(pyblish.api.InstancePlugin,
|
||||
OptionalPyblishPluginMixin):
|
||||
class ValidateCameraZeroKeyframe(
|
||||
plugin.BlenderInstancePlugin,
|
||||
OptionalPyblishPluginMixin
|
||||
):
|
||||
"""Camera must have a keyframe at frame 0.
|
||||
|
||||
Unreal shifts the first keyframe to frame 0. Forcing the camera to have
|
||||
|
|
|
|||
|
|
@ -2,18 +2,20 @@ import os
|
|||
|
||||
import bpy
|
||||
|
||||
import pyblish.api
|
||||
from ayon_core.pipeline.publish import (
|
||||
RepairAction,
|
||||
ValidateContentsOrder,
|
||||
PublishValidationError,
|
||||
OptionalPyblishPluginMixin
|
||||
)
|
||||
from ayon_blender.api import plugin
|
||||
from ayon_blender.api.render_lib import prepare_rendering
|
||||
|
||||
|
||||
class ValidateDeadlinePublish(pyblish.api.InstancePlugin,
|
||||
OptionalPyblishPluginMixin):
|
||||
class ValidateDeadlinePublish(
|
||||
plugin.BlenderInstancePlugin,
|
||||
OptionalPyblishPluginMixin
|
||||
):
|
||||
"""Validates Render File Directory is
|
||||
not the same in every submission
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ from ayon_core.pipeline.publish import (
|
|||
OptionalPyblishPluginMixin,
|
||||
PublishValidationError
|
||||
)
|
||||
from ayon_blender.api import plugin
|
||||
|
||||
|
||||
class SaveWorkfileAction(pyblish.api.Action):
|
||||
|
|
@ -18,8 +19,10 @@ class SaveWorkfileAction(pyblish.api.Action):
|
|||
bpy.ops.wm.avalon_workfiles()
|
||||
|
||||
|
||||
class ValidateFileSaved(pyblish.api.ContextPlugin,
|
||||
OptionalPyblishPluginMixin):
|
||||
class ValidateFileSaved(
|
||||
plugin.BlenderContextPlugin,
|
||||
OptionalPyblishPluginMixin
|
||||
):
|
||||
"""Validate that the workfile has been saved."""
|
||||
|
||||
order = pyblish.api.ValidatorOrder - 0.01
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
import pyblish.api
|
||||
from ayon_core.pipeline.publish import PublishValidationError
|
||||
from ayon_blender.api import plugin
|
||||
|
||||
|
||||
class ValidateInstanceEmpty(pyblish.api.InstancePlugin):
|
||||
class ValidateInstanceEmpty(plugin.BlenderInstancePlugin):
|
||||
"""Validator to verify that the instance is not empty"""
|
||||
|
||||
order = pyblish.api.ValidatorOrder - 0.01
|
||||
|
|
|
|||
|
|
@ -2,19 +2,18 @@ from typing import List
|
|||
|
||||
import bpy
|
||||
|
||||
import pyblish.api
|
||||
|
||||
from ayon_core.pipeline.publish import (
|
||||
ValidateContentsOrder,
|
||||
OptionalPyblishPluginMixin,
|
||||
PublishValidationError
|
||||
)
|
||||
import ayon_blender.api.action
|
||||
from ayon_blender.api import plugin
|
||||
|
||||
|
||||
class ValidateMeshHasUvs(
|
||||
pyblish.api.InstancePlugin,
|
||||
OptionalPyblishPluginMixin,
|
||||
plugin.BlenderInstancePlugin,
|
||||
OptionalPyblishPluginMixin,
|
||||
):
|
||||
"""Validate that the current mesh has UV's."""
|
||||
|
||||
|
|
|
|||
|
|
@ -2,18 +2,19 @@ from typing import List
|
|||
|
||||
import bpy
|
||||
|
||||
import pyblish.api
|
||||
|
||||
from ayon_core.pipeline.publish import (
|
||||
ValidateContentsOrder,
|
||||
OptionalPyblishPluginMixin,
|
||||
PublishValidationError
|
||||
)
|
||||
import ayon_blender.api.action
|
||||
from ayon_blender.api import plugin
|
||||
|
||||
|
||||
class ValidateMeshNoNegativeScale(pyblish.api.InstancePlugin,
|
||||
OptionalPyblishPluginMixin):
|
||||
class ValidateMeshNoNegativeScale(
|
||||
plugin.BlenderInstancePlugin,
|
||||
OptionalPyblishPluginMixin
|
||||
):
|
||||
"""Ensure that meshes don't have a negative scale."""
|
||||
|
||||
order = ValidateContentsOrder
|
||||
|
|
|
|||
|
|
@ -12,11 +12,12 @@ from ayon_core.pipeline.publish import (
|
|||
RepairAction
|
||||
)
|
||||
import ayon_blender.api.action
|
||||
from ayon_blender.api import plugin
|
||||
|
||||
|
||||
class ValidateModelMeshUvMap1(
|
||||
pyblish.api.InstancePlugin,
|
||||
OptionalPyblishPluginMixin,
|
||||
plugin.BlenderInstancePlugin,
|
||||
OptionalPyblishPluginMixin,
|
||||
):
|
||||
"""Validate model mesh uvs are named `map1`.
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@ from typing import List
|
|||
|
||||
import bpy
|
||||
|
||||
import pyblish.api
|
||||
|
||||
import ayon_blender.api.action
|
||||
from ayon_blender.api import plugin
|
||||
from ayon_core.pipeline.publish import (
|
||||
ValidateContentsOrder,
|
||||
OptionalPyblishPluginMixin,
|
||||
|
|
@ -12,8 +11,10 @@ from ayon_core.pipeline.publish import (
|
|||
)
|
||||
|
||||
|
||||
class ValidateNoColonsInName(pyblish.api.InstancePlugin,
|
||||
OptionalPyblishPluginMixin):
|
||||
class ValidateNoColonsInName(
|
||||
plugin.BlenderInstancePlugin,
|
||||
OptionalPyblishPluginMixin
|
||||
):
|
||||
"""There cannot be colons in names
|
||||
|
||||
Object or bone names cannot include colons. Other software do not
|
||||
|
|
|
|||
|
|
@ -8,11 +8,12 @@ from ayon_core.pipeline.publish import (
|
|||
PublishValidationError
|
||||
)
|
||||
import ayon_blender.api.action
|
||||
from ayon_blender.api import plugin
|
||||
|
||||
|
||||
class ValidateObjectIsInObjectMode(
|
||||
pyblish.api.InstancePlugin,
|
||||
OptionalPyblishPluginMixin,
|
||||
plugin.BlenderInstancePlugin,
|
||||
OptionalPyblishPluginMixin,
|
||||
):
|
||||
"""Validate that the objects in the instance are in Object Mode."""
|
||||
|
||||
|
|
|
|||
|
|
@ -6,10 +6,13 @@ from ayon_core.pipeline.publish import (
|
|||
OptionalPyblishPluginMixin,
|
||||
PublishValidationError
|
||||
)
|
||||
from ayon_blender.api import plugin
|
||||
|
||||
|
||||
class ValidateRenderCameraIsSet(pyblish.api.InstancePlugin,
|
||||
OptionalPyblishPluginMixin):
|
||||
class ValidateRenderCameraIsSet(
|
||||
plugin.BlenderInstancePlugin,
|
||||
OptionalPyblishPluginMixin
|
||||
):
|
||||
"""Validate that there is a camera set as active for rendering."""
|
||||
|
||||
order = pyblish.api.ValidatorOrder
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@ from typing import List
|
|||
import mathutils
|
||||
import bpy
|
||||
|
||||
import pyblish.api
|
||||
|
||||
from ayon_blender.api import plugin, lib
|
||||
import ayon_blender.api.action
|
||||
from ayon_core.pipeline.publish import (
|
||||
|
|
@ -16,8 +14,10 @@ from ayon_core.pipeline.publish import (
|
|||
)
|
||||
|
||||
|
||||
class ValidateTransformZero(pyblish.api.InstancePlugin,
|
||||
OptionalPyblishPluginMixin):
|
||||
class ValidateTransformZero(
|
||||
plugin.BlenderInstancePlugin,
|
||||
OptionalPyblishPluginMixin
|
||||
):
|
||||
"""Transforms can't have any values"""
|
||||
|
||||
order = ValidateContentsOrder
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue