mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 13:52:15 +01:00
added instance plugin for testing
This commit is contained in:
parent
89aa07509c
commit
13302a23df
2 changed files with 68 additions and 26 deletions
|
|
@ -1,18 +1,3 @@
|
|||
"""
|
||||
Requires:
|
||||
environment -> SAPUBLISH_INPATH
|
||||
environment -> SAPUBLISH_OUTPATH
|
||||
|
||||
Provides:
|
||||
context -> returnJsonPath (str)
|
||||
context -> project
|
||||
context -> asset
|
||||
instance -> destination_list (list)
|
||||
instance -> representations (list)
|
||||
instance -> source (list)
|
||||
instance -> representations
|
||||
"""
|
||||
|
||||
import pyblish.api
|
||||
from avalon import io
|
||||
|
||||
|
|
@ -32,7 +17,7 @@ class CollectContextDataTestHost(
|
|||
"""
|
||||
|
||||
label = "Collect Context - Test Host"
|
||||
order = pyblish.api.CollectorOrder - 0.49
|
||||
order = pyblish.api.CollectorOrder - 0.5
|
||||
hosts = ["testhost"]
|
||||
|
||||
@classmethod
|
||||
|
|
@ -59,16 +44,17 @@ class CollectContextDataTestHost(
|
|||
instance_families = in_data.get("families") or []
|
||||
|
||||
instance = context.create_instance(subset)
|
||||
instance.data.update(
|
||||
{
|
||||
"subset": subset,
|
||||
"asset": in_data["asset"],
|
||||
"label": subset,
|
||||
"name": subset,
|
||||
"family": in_data["family"],
|
||||
"families": instance_families
|
||||
}
|
||||
)
|
||||
instance.data.update({
|
||||
"subset": subset,
|
||||
"asset": in_data["asset"],
|
||||
"label": subset,
|
||||
"name": subset,
|
||||
"family": in_data["family"],
|
||||
"families": instance_families
|
||||
})
|
||||
for key, value in in_data.items():
|
||||
if key not in instance.data:
|
||||
instance.data[key] = value
|
||||
self.log.info("collected instance: {}".format(instance.data))
|
||||
self.log.info("parsing data: {}".format(in_data))
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
import json
|
||||
import pyblish.api
|
||||
from avalon import io
|
||||
|
||||
from openpype.hosts.testhost import api
|
||||
from openpype.pipeline import (
|
||||
OpenPypePyblishPluginMixin,
|
||||
attribute_definitions
|
||||
)
|
||||
|
||||
|
||||
class CollectInstanceOneTestHost(
|
||||
pyblish.api.InstancePlugin, OpenPypePyblishPluginMixin
|
||||
):
|
||||
"""
|
||||
Collecting temp json data sent from a host context
|
||||
and path for returning json data back to hostself.
|
||||
"""
|
||||
|
||||
label = "Collect Instance 1 - Test Host"
|
||||
order = pyblish.api.CollectorOrder - 0.3
|
||||
hosts = ["testhost"]
|
||||
|
||||
@classmethod
|
||||
def get_attribute_defs(cls):
|
||||
return [
|
||||
attribute_definitions.NumberDef(
|
||||
"version",
|
||||
default=1,
|
||||
minimum=1,
|
||||
maximum=999,
|
||||
decimals=0,
|
||||
label="Version"
|
||||
)
|
||||
]
|
||||
|
||||
def process(self, instance):
|
||||
self._debug_log(instance)
|
||||
|
||||
publish_attributes = instance.data.get("publish_attributes")
|
||||
if not publish_attributes:
|
||||
return
|
||||
|
||||
values = publish_attributes.get(self.__class__.__name__)
|
||||
if not values:
|
||||
return
|
||||
|
||||
instance.data["version"] = values["version"]
|
||||
|
||||
def _debug_log(self, instance):
|
||||
def _default_json(value):
|
||||
return str(value)
|
||||
|
||||
self.log.info(
|
||||
json.dumps(instance.data, indent=4, default=_default_json)
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue