Merge branch 'develop' into enhancement/AY-4914_Move-Harmony-client-code

This commit is contained in:
Jakub Trllo 2024-06-05 13:55:11 +02:00 committed by GitHub
commit c34da53b8d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
76 changed files with 255 additions and 198 deletions

View file

@ -50,6 +50,7 @@ IGNORED_MODULES_IN_AYON = set()
# - this is used to log the missing addon
MOVED_ADDON_MILESTONE_VERSIONS = {
"applications": VersionInfo(0, 2, 0),
"blender": VersionInfo(0, 2, 0),
"celaction": VersionInfo(0, 2, 0),
"clockify": VersionInfo(0, 2, 0),
"flame": VersionInfo(0, 2, 0),

View file

@ -1,6 +0,0 @@
from .addon import BlenderAddon
__all__ = (
"BlenderAddon",
)

View file

@ -0,0 +1,13 @@
from .version import __version__
from .addon import (
BlenderAddon,
BLENDER_ADDON_ROOT,
)
__all__ = (
"__version__",
"BlenderAddon",
"BLENDER_ADDON_ROOT",
)

View file

@ -1,18 +1,21 @@
import os
from ayon_core.addon import AYONAddon, IHostAddon
BLENDER_ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
from .version import __version__
BLENDER_ADDON_ROOT = os.path.dirname(os.path.abspath(__file__))
class BlenderAddon(AYONAddon, IHostAddon):
name = "blender"
version = __version__
host_name = "blender"
def add_implementation_envs(self, env, _app):
"""Modify environments to contain all required for implementation."""
# Prepare path to implementation script
implementation_user_script_path = os.path.join(
BLENDER_ROOT_DIR,
BLENDER_ADDON_ROOT,
"blender_addon"
)
@ -61,7 +64,7 @@ class BlenderAddon(AYONAddon, IHostAddon):
if app.host_name != self.host_name:
return []
return [
os.path.join(BLENDER_ROOT_DIR, "hooks")
os.path.join(BLENDER_ADDON_ROOT, "hooks")
]
def get_workfile_extensions(self):

View file

@ -15,7 +15,6 @@ from .pipeline import (
from .plugin import (
Creator,
Loader,
)
from .workio import (
@ -51,7 +50,6 @@ __all__ = [
"BlenderHost",
"Creator",
"Loader",
# Workfiles API
"open_file",

View file

Before

Width:  |  Height:  |  Size: 632 B

After

Width:  |  Height:  |  Size: 632 B

Before After
Before After

View file

@ -305,7 +305,7 @@ class LaunchCreator(LaunchQtApp):
class LaunchLoader(LaunchQtApp):
"""Launch Avalon Loader."""
"""Launch AYON Loader."""
bl_idname = "wm.avalon_loader"
bl_label = "Load..."

View file

@ -5,9 +5,6 @@ from typing import Callable, Dict, Iterator, List, Optional
import bpy
from . import lib
from . import ops
import pyblish.api
import ayon_api
@ -33,8 +30,12 @@ from ayon_core.lib import (
register_event_callback,
emit_event
)
import ayon_core.hosts.blender
from ayon_core.settings import get_project_settings
from ayon_blender import BLENDER_ADDON_ROOT
from . import lib
from . import ops
from .workio import (
open_file,
save_file,
@ -44,9 +45,7 @@ from .workio import (
work_root,
)
HOST_DIR = os.path.dirname(os.path.abspath(ayon_core.hosts.blender.__file__))
PLUGINS_DIR = os.path.join(HOST_DIR, "plugins")
PLUGINS_DIR = os.path.join(BLENDER_ADDON_ROOT, "plugins")
PUBLISH_PATH = os.path.join(PLUGINS_DIR, "publish")
LOAD_PATH = os.path.join(PLUGINS_DIR, "load")
CREATE_PATH = os.path.join(PLUGINS_DIR, "create")

View file

@ -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 BaseCreator(Creator):
class BlenderInstancePlugin(pyblish.api.InstancePlugin):
settings_category = "blender"
class BlenderContextPlugin(pyblish.api.ContextPlugin):
settings_category = "blender"
class BlenderExtractor(Extractor):
settings_category = "blender"
class BlenderCreator(Creator):
"""Base class for Blender Creator plug-ins."""
defaults = ['Main']
settings_category = "blender"
create_as_asset_group = False
@staticmethod
@ -265,7 +280,7 @@ class BaseCreator(Creator):
return instance_node
def collect_instances(self):
"""Override abstract method from BaseCreator.
"""Override abstract method from BlenderCreator.
Collect existing instances related to this creator plugin."""
# Cache instances in shared data
@ -292,7 +307,7 @@ class BaseCreator(Creator):
self._add_instance_to_context(instance)
def update_instances(self, update_list):
"""Override abstract method from BaseCreator.
"""Override abstract method from BlenderCreator.
Store changes of existing instances so they can be recollected.
Args:
@ -376,13 +391,7 @@ class BaseCreator(Creator):
]
class Loader(LoaderPlugin):
"""Base class for Loader plug-ins."""
hosts = ["blender"]
class AssetLoader(LoaderPlugin):
class BlenderLoader(LoaderPlugin):
"""A basic AssetLoader for Blender
This will implement the basic logic for linking/appending assets
@ -392,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]:
@ -496,7 +506,7 @@ class AssetLoader(LoaderPlugin):
# Only containerise if it's not already a collection from a .blend file.
# representation = context["representation"]["name"]
# if representation != "blend":
# from ayon_core.hosts.blender.api.pipeline import containerise
# from ayon_blender.api.pipeline import containerise
# return containerise(
# name=name,
# namespace=namespace,

View file

@ -1,5 +1,5 @@
from ayon_core.pipeline import install_host
from ayon_core.hosts.blender.api import BlenderHost
from ayon_blender.api import BlenderHost
def register():

View file

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Converter for legacy Houdini products."""
from ayon_core.pipeline.create.creator_plugins import ProductConvertorPlugin
from ayon_core.hosts.blender.api.lib import imprint
from ayon_blender.api.lib import imprint
class BlenderLegacyConvertor(ProductConvertorPlugin):
@ -42,7 +42,7 @@ class BlenderLegacyConvertor(ProductConvertorPlugin):
parameter on them.
This is using cached entries done in
:py:meth:`~BaseCreator.cache_instance_data()`
:py:meth:`~BlenderCreator.cache_instance_data()`
"""
self.legacy_instances = self.collection_shared_data.get(

View file

@ -2,10 +2,10 @@
import bpy
from ayon_core.hosts.blender.api import lib, plugin
from ayon_blender.api import lib, plugin
class CreateAction(plugin.BaseCreator):
class CreateAction(plugin.BlenderCreator):
"""Action output for character rigs."""
identifier = "io.openpype.creators.blender.action"

View file

@ -1,9 +1,9 @@
"""Create an animation asset."""
from ayon_core.hosts.blender.api import plugin, lib
from ayon_blender.api import plugin, lib
class CreateAnimation(plugin.BaseCreator):
class CreateAnimation(plugin.BlenderCreator):
"""Animation output for character rigs."""
identifier = "io.openpype.creators.blender.animation"

View file

@ -2,10 +2,10 @@
import bpy
from ayon_core.hosts.blender.api import plugin, lib
from ayon_blender.api import plugin, lib
class CreateBlendScene(plugin.BaseCreator):
class CreateBlendScene(plugin.BlenderCreator):
"""Generic group of assets."""
identifier = "io.openpype.creators.blender.blendscene"

View file

@ -2,11 +2,11 @@
import bpy
from ayon_core.hosts.blender.api import plugin, lib
from ayon_core.hosts.blender.api.pipeline import AVALON_INSTANCES
from ayon_blender.api import plugin, lib
from ayon_blender.api.pipeline import AVALON_INSTANCES
class CreateCamera(plugin.BaseCreator):
class CreateCamera(plugin.BlenderCreator):
"""Polygonal static geometry."""
identifier = "io.openpype.creators.blender.camera"

View file

@ -2,10 +2,10 @@
import bpy
from ayon_core.hosts.blender.api import plugin, lib
from ayon_blender.api import plugin, lib
class CreateLayout(plugin.BaseCreator):
class CreateLayout(plugin.BlenderCreator):
"""Layout output for character rigs."""
identifier = "io.openpype.creators.blender.layout"

View file

@ -2,10 +2,10 @@
import bpy
from ayon_core.hosts.blender.api import plugin, lib
from ayon_blender.api import plugin, lib
class CreateModel(plugin.BaseCreator):
class CreateModel(plugin.BlenderCreator):
"""Polygonal static geometry."""
identifier = "io.openpype.creators.blender.model"

View file

@ -1,9 +1,9 @@
"""Create a pointcache asset."""
from ayon_core.hosts.blender.api import plugin, lib
from ayon_blender.api import plugin, lib
class CreatePointcache(plugin.BaseCreator):
class CreatePointcache(plugin.BlenderCreator):
"""Polygonal static geometry."""
identifier = "io.openpype.creators.blender.pointcache"

View file

@ -2,12 +2,12 @@
import bpy
from ayon_core.lib import version_up
from ayon_core.hosts.blender.api import plugin
from ayon_core.hosts.blender.api.render_lib import prepare_rendering
from ayon_core.hosts.blender.api.workio import save_file
from ayon_blender.api import plugin
from ayon_blender.api.render_lib import prepare_rendering
from ayon_blender.api.workio import save_file
class CreateRenderlayer(plugin.BaseCreator):
class CreateRenderlayer(plugin.BlenderCreator):
"""Single baked camera."""
identifier = "io.openpype.creators.blender.render"

View file

@ -1,9 +1,9 @@
"""Create review."""
from ayon_core.hosts.blender.api import plugin, lib
from ayon_blender.api import plugin, lib
class CreateReview(plugin.BaseCreator):
class CreateReview(plugin.BlenderCreator):
"""Single baked camera."""
identifier = "io.openpype.creators.blender.review"

View file

@ -2,10 +2,10 @@
import bpy
from ayon_core.hosts.blender.api import plugin, lib
from ayon_blender.api import plugin, lib
class CreateRig(plugin.BaseCreator):
class CreateRig(plugin.BlenderCreator):
"""Artist-friendly rig with controls to direct motion."""
identifier = "io.openpype.creators.blender.rig"

View file

@ -1,9 +1,9 @@
"""Create a USD Export."""
from ayon_core.hosts.blender.api import plugin, lib
from ayon_blender.api import plugin, lib
class CreateUSD(plugin.BaseCreator):
class CreateUSD(plugin.BlenderCreator):
"""Create USD Export"""
identifier = "io.openpype.creators.blender.usd"

View file

@ -2,14 +2,14 @@ import bpy
import ayon_api
from ayon_core.pipeline import CreatedInstance, AutoCreator
from ayon_core.hosts.blender.api.plugin import BaseCreator
from ayon_core.hosts.blender.api.pipeline import (
from ayon_blender.api.plugin import BlenderCreator
from ayon_blender.api.pipeline import (
AVALON_PROPERTY,
AVALON_CONTAINERS
)
class CreateWorkfile(BaseCreator, AutoCreator):
class CreateWorkfile(BlenderCreator, AutoCreator):
"""Workfile auto-creator.
The workfile instance stores its data on the `AVALON_CONTAINERS` collection

View file

@ -1,6 +1,6 @@
import bpy
from ayon_core.hosts.blender.api import plugin
from ayon_blender.api import plugin
def append_workfile(context, fname, do_import):
@ -34,7 +34,7 @@ def append_workfile(context, fname, do_import):
collection.children.link(coll)
class AppendBlendLoader(plugin.AssetLoader):
class AppendBlendLoader(plugin.BlenderLoader):
"""Append workfile in Blender (unmanaged)
Warning:
@ -59,7 +59,7 @@ class AppendBlendLoader(plugin.AssetLoader):
return
class ImportBlendLoader(plugin.AssetLoader):
class ImportBlendLoader(plugin.BlenderLoader):
"""Import workfile in the current Blender scene (unmanaged)
Warning:

View file

@ -7,8 +7,8 @@ from typing import Dict, List, Optional
import bpy
from ayon_core.pipeline import get_representation_path
from ayon_core.hosts.blender.api import plugin
from ayon_core.hosts.blender.api.pipeline import (
from ayon_blender.api import plugin
from ayon_blender.api.pipeline import (
containerise_existing,
AVALON_PROPERTY,
)
@ -16,7 +16,7 @@ from ayon_core.hosts.blender.api.pipeline import (
logger = logging.getLogger("ayon").getChild("blender").getChild("load_action")
class BlendActionLoader(plugin.AssetLoader):
class BlendActionLoader(plugin.BlenderLoader):
"""Load action from a .blend file.
Warning:

View file

@ -4,11 +4,11 @@ from typing import Dict, List, Optional
import bpy
from ayon_core.hosts.blender.api import plugin
from ayon_core.hosts.blender.api.pipeline import AVALON_PROPERTY
from ayon_blender.api import plugin
from ayon_blender.api.pipeline import AVALON_PROPERTY
class BlendAnimationLoader(plugin.AssetLoader):
class BlendAnimationLoader(plugin.BlenderLoader):
"""Load animations from a .blend file.
Warning:

View file

@ -10,14 +10,14 @@ from ayon_core.pipeline import (
get_representation_path,
AVALON_CONTAINER_ID,
)
from ayon_core.hosts.blender.api import plugin
from ayon_core.hosts.blender.api.pipeline import (
from ayon_blender.api import plugin
from ayon_blender.api.pipeline import (
AVALON_CONTAINERS,
AVALON_PROPERTY,
)
class AudioLoader(plugin.AssetLoader):
class AudioLoader(plugin.BlenderLoader):
"""Load audio in Blender."""
product_types = {"audio"}

View file

@ -9,15 +9,15 @@ from ayon_core.pipeline import (
registered_host
)
from ayon_core.pipeline.create import CreateContext
from ayon_core.hosts.blender.api import plugin
from ayon_core.hosts.blender.api.lib import imprint
from ayon_core.hosts.blender.api.pipeline import (
from ayon_blender.api import plugin
from ayon_blender.api.lib import imprint
from ayon_blender.api.pipeline import (
AVALON_CONTAINERS,
AVALON_PROPERTY,
)
class BlendLoader(plugin.AssetLoader):
class BlendLoader(plugin.BlenderLoader):
"""Load assets from a .blend file."""
product_types = {"model", "rig", "layout", "camera"}

View file

@ -7,15 +7,15 @@ from ayon_core.pipeline import (
get_representation_path,
AVALON_CONTAINER_ID,
)
from ayon_core.hosts.blender.api import plugin
from ayon_core.hosts.blender.api.lib import imprint
from ayon_core.hosts.blender.api.pipeline import (
from ayon_blender.api import plugin
from ayon_blender.api.lib import imprint
from ayon_blender.api.pipeline import (
AVALON_CONTAINERS,
AVALON_PROPERTY,
)
class BlendSceneLoader(plugin.AssetLoader):
class BlendSceneLoader(plugin.BlenderLoader):
"""Load assets from a .blend file."""
product_types = {"blendScene"}

View file

@ -11,14 +11,14 @@ from ayon_core.pipeline import (
AVALON_CONTAINER_ID,
)
from ayon_core.hosts.blender.api.pipeline import (
from ayon_blender.api.pipeline import (
AVALON_CONTAINERS,
AVALON_PROPERTY,
)
from ayon_core.hosts.blender.api import plugin, lib
from ayon_blender.api import plugin, lib
class CacheModelLoader(plugin.AssetLoader):
class CacheModelLoader(plugin.BlenderLoader):
"""Load cache models.
Stores the imported asset in a collection named after the asset.

View file

@ -10,14 +10,14 @@ from ayon_core.pipeline import (
get_representation_path,
AVALON_CONTAINER_ID,
)
from ayon_core.hosts.blender.api import plugin, lib
from ayon_core.hosts.blender.api.pipeline import (
from ayon_blender.api import plugin, lib
from ayon_blender.api.pipeline import (
AVALON_CONTAINERS,
AVALON_PROPERTY,
)
class AbcCameraLoader(plugin.AssetLoader):
class AbcCameraLoader(plugin.BlenderLoader):
"""Load a camera from Alembic file.
Stores the imported asset in an empty named after the asset.

View file

@ -10,14 +10,14 @@ from ayon_core.pipeline import (
get_representation_path,
AVALON_CONTAINER_ID,
)
from ayon_core.hosts.blender.api import plugin, lib
from ayon_core.hosts.blender.api.pipeline import (
from ayon_blender.api import plugin, lib
from ayon_blender.api.pipeline import (
AVALON_CONTAINERS,
AVALON_PROPERTY,
)
class FbxCameraLoader(plugin.AssetLoader):
class FbxCameraLoader(plugin.BlenderLoader):
"""Load a camera from FBX.
Stores the imported asset in an empty named after the asset.

View file

@ -10,14 +10,14 @@ from ayon_core.pipeline import (
get_representation_path,
AVALON_CONTAINER_ID,
)
from ayon_core.hosts.blender.api import plugin, lib
from ayon_core.hosts.blender.api.pipeline import (
from ayon_blender.api import plugin, lib
from ayon_blender.api.pipeline import (
AVALON_CONTAINERS,
AVALON_PROPERTY,
)
class FbxModelLoader(plugin.AssetLoader):
class FbxModelLoader(plugin.BlenderLoader):
"""Load FBX models.
Stores the imported asset in an empty named after the asset.

View file

@ -15,15 +15,15 @@ from ayon_core.pipeline import (
loaders_from_representation,
AVALON_CONTAINER_ID,
)
from ayon_core.hosts.blender.api.pipeline import (
from ayon_blender.api.pipeline import (
AVALON_INSTANCES,
AVALON_CONTAINERS,
AVALON_PROPERTY,
)
from ayon_core.hosts.blender.api import plugin
from ayon_blender.api import plugin
class JsonLayoutLoader(plugin.AssetLoader):
class JsonLayoutLoader(plugin.BlenderLoader):
"""Load layout published from Unreal."""
product_types = {"layout"}

View file

@ -9,14 +9,14 @@ import json
import bpy
from ayon_core.pipeline import get_representation_path
from ayon_core.hosts.blender.api import plugin
from ayon_core.hosts.blender.api.pipeline import (
from ayon_blender.api import plugin
from ayon_blender.api.pipeline import (
containerise_existing,
AVALON_PROPERTY
)
class BlendLookLoader(plugin.AssetLoader):
class BlendLookLoader(plugin.BlenderLoader):
"""Load models from a .blend file.
Because they come from a .blend file we can simply link the collection that

View file

@ -1,8 +1,8 @@
import pyblish.api
from ayon_core.hosts.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

View file

@ -3,10 +3,11 @@ import bpy
import pyblish.api
from ayon_core.pipeline.publish import KnownPublishError
from ayon_core.hosts.blender.api.pipeline import AVALON_PROPERTY
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

View file

@ -5,12 +5,12 @@ import os
import re
import bpy
from ayon_core.hosts.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

View file

@ -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
"""

View file

@ -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

View file

@ -4,10 +4,10 @@ import bpy
from ayon_core.lib import BoolDef
from ayon_core.pipeline import publish
from ayon_core.hosts.blender.api import plugin
from ayon_blender.api import plugin
class ExtractABC(publish.Extractor, publish.OptionalPyblishPluginMixin):
class ExtractABC(plugin.BlenderExtractor, publish.OptionalPyblishPluginMixin):
"""Extract as ABC."""
label = "Extract ABC"

View file

@ -3,12 +3,12 @@ import os
import bpy
from ayon_core.pipeline import publish
from ayon_core.hosts.blender.api import plugin
from ayon_blender.api import plugin
class ExtractAnimationABC(
publish.Extractor,
publish.OptionalPyblishPluginMixin,
plugin.BlenderExtractor,
publish.OptionalPyblishPluginMixin,
):
"""Extract as ABC."""

View file

@ -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"

View file

@ -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."""

View file

@ -3,10 +3,12 @@ import os
import bpy
from ayon_core.pipeline import publish
from ayon_core.hosts.blender.api import plugin
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)"

View file

@ -3,10 +3,12 @@ import os
import bpy
from ayon_core.pipeline import publish
from ayon_core.hosts.blender.api import plugin
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)"

View file

@ -3,10 +3,12 @@ import os
import bpy
from ayon_core.pipeline import publish
from ayon_core.hosts.blender.api import plugin
from ayon_blender.api import plugin
class ExtractFBX(publish.Extractor, publish.OptionalPyblishPluginMixin):
class ExtractFBX(
plugin.BlenderExtractor, publish.OptionalPyblishPluginMixin
):
"""Extract as FBX."""
label = "Extract FBX"

View file

@ -6,8 +6,8 @@ import bpy_extras
import bpy_extras.anim_utils
from ayon_core.pipeline import publish
from ayon_core.hosts.blender.api import plugin
from ayon_core.hosts.blender.api.pipeline import AVALON_PROPERTY
from ayon_blender.api import plugin
from ayon_blender.api.pipeline import AVALON_PROPERTY
def get_all_parents(obj):
@ -42,8 +42,8 @@ def get_highest_root(objects):
class ExtractAnimationFBX(
publish.Extractor,
publish.OptionalPyblishPluginMixin,
plugin.BlenderExtractor,
publish.OptionalPyblishPluginMixin,
):
"""Extract as animation."""

View file

@ -8,11 +8,13 @@ import bpy_extras.anim_utils
from ayon_api import get_representations
from ayon_core.pipeline import publish
from ayon_core.hosts.blender.api import plugin
from ayon_core.hosts.blender.api.pipeline import AVALON_PROPERTY
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)"

View file

@ -7,11 +7,13 @@ import pyblish.api
import bpy
from ayon_core.pipeline import publish
from ayon_core.hosts.blender.api import capture
from ayon_core.hosts.blender.api.lib import maintained_time
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.

View file

@ -3,14 +3,13 @@ import glob
import json
import pyblish.api
from ayon_core.pipeline import publish
from ayon_core.hosts.blender.api import capture
from ayon_core.hosts.blender.api.lib import maintained_time
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

View file

@ -2,11 +2,11 @@ import os
import bpy
from ayon_core.pipeline import publish
from ayon_core.hosts.blender.api import plugin, lib
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}")

View file

@ -1,11 +1,12 @@
import pyblish.api
from ayon_core.pipeline.publish import OptionalPyblishPluginMixin
from ayon_core.hosts.blender.api.workio import save_file
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."""

View file

@ -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."""

View file

@ -2,9 +2,8 @@ from typing import List
import bpy
import pyblish.api
import ayon_core.hosts.blender.api.action
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
@ -25,7 +26,7 @@ class ValidateCameraZeroKeyframe(pyblish.api.InstancePlugin,
hosts = ["blender"]
families = ["camera"]
label = "Zero Keyframe"
actions = [ayon_core.hosts.blender.api.action.SelectInvalidAction]
actions = [ayon_blender.api.action.SelectInvalidAction]
@staticmethod
def get_invalid(instance) -> List:

View file

@ -2,18 +2,20 @@ import os
import bpy
import pyblish.api
from ayon_core.pipeline.publish import (
RepairAction,
ValidateContentsOrder,
PublishValidationError,
OptionalPyblishPluginMixin
)
from ayon_core.hosts.blender.api.render_lib import prepare_rendering
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
"""

View file

@ -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

View file

@ -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

View file

@ -2,19 +2,18 @@ from typing import List
import bpy
import pyblish.api
from ayon_core.pipeline.publish import (
ValidateContentsOrder,
OptionalPyblishPluginMixin,
PublishValidationError
)
import ayon_core.hosts.blender.api.action
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."""
@ -22,7 +21,7 @@ class ValidateMeshHasUvs(
hosts = ["blender"]
families = ["model"]
label = "Mesh Has UVs"
actions = [ayon_core.hosts.blender.api.action.SelectInvalidAction]
actions = [ayon_blender.api.action.SelectInvalidAction]
optional = True
@staticmethod

View file

@ -2,25 +2,26 @@ from typing import List
import bpy
import pyblish.api
from ayon_core.pipeline.publish import (
ValidateContentsOrder,
OptionalPyblishPluginMixin,
PublishValidationError
)
import ayon_core.hosts.blender.api.action
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
hosts = ["blender"]
families = ["model"]
label = "Mesh No Negative Scale"
actions = [ayon_core.hosts.blender.api.action.SelectInvalidAction]
actions = [ayon_blender.api.action.SelectInvalidAction]
@staticmethod
def get_invalid(instance) -> List:

View file

@ -3,20 +3,19 @@ from typing import List
import bpy
import pyblish.api
from ayon_core.pipeline.publish import (
ValidateContentsOrder,
OptionalPyblishPluginMixin,
PublishValidationError,
RepairAction
)
import ayon_core.hosts.blender.api.action
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`.
@ -27,7 +26,7 @@ class ValidateModelMeshUvMap1(
hosts = ["blender"]
families = ["model"]
label = "Mesh UVs named map1"
actions = [ayon_core.hosts.blender.api.action.SelectInvalidAction,
actions = [ayon_blender.api.action.SelectInvalidAction,
RepairAction]
optional = True
enabled = False

View file

@ -2,9 +2,8 @@ from typing import List
import bpy
import pyblish.api
import ayon_core.hosts.blender.api.action
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
@ -25,7 +26,7 @@ class ValidateNoColonsInName(pyblish.api.InstancePlugin,
hosts = ["blender"]
families = ["model", "rig"]
label = "No Colons in names"
actions = [ayon_core.hosts.blender.api.action.SelectInvalidAction]
actions = [ayon_blender.api.action.SelectInvalidAction]
@staticmethod
def get_invalid(instance) -> List:

View file

@ -7,12 +7,13 @@ from ayon_core.pipeline.publish import (
OptionalPyblishPluginMixin,
PublishValidationError
)
import ayon_core.hosts.blender.api.action
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."""
@ -20,7 +21,7 @@ class ValidateObjectIsInObjectMode(
hosts = ["blender"]
families = ["model", "rig", "layout"]
label = "Validate Object Mode"
actions = [ayon_core.hosts.blender.api.action.SelectInvalidAction]
actions = [ayon_blender.api.action.SelectInvalidAction]
optional = False
@staticmethod

View file

@ -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

View file

@ -4,10 +4,8 @@ from typing import List
import mathutils
import bpy
import pyblish.api
from ayon_core.hosts.blender.api import plugin, lib
import ayon_core.hosts.blender.api.action
from ayon_blender.api import plugin, lib
import ayon_blender.api.action
from ayon_core.pipeline.publish import (
ValidateContentsOrder,
OptionalPyblishPluginMixin,
@ -16,15 +14,17 @@ 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
hosts = ["blender"]
families = ["model"]
label = "Transform Zero"
actions = [ayon_core.hosts.blender.api.action.SelectInvalidAction,
actions = [ayon_blender.api.action.SelectInvalidAction,
RepairAction]
_identity = mathutils.Matrix()

View file

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
"""Package declaring AYON addon 'blender' version."""
__version__ = "0.2.0"

View file

@ -1,3 +1,11 @@
name = "blender"
title = "Blender"
version = "0.1.9"
version = "0.2.0"
client_dir = "ayon_blender"
ayon_required_addons = {
"core": ">0.3.2",
}
ayon_compatible_addons = {}