mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
Fixed fullName, implemented imprint
This commit is contained in:
parent
41c1016952
commit
a9f146e2fc
7 changed files with 96 additions and 20 deletions
|
|
@ -3,6 +3,9 @@ import os
|
|||
import pyblish.api
|
||||
from avalon import photoshop
|
||||
|
||||
from pype.modules.websocket_server.clients.photoshop_client import \
|
||||
PhotoshopClientStub
|
||||
|
||||
|
||||
class CollectCurrentFile(pyblish.api.ContextPlugin):
|
||||
"""Inject the current working file into context"""
|
||||
|
|
@ -12,6 +15,7 @@ class CollectCurrentFile(pyblish.api.ContextPlugin):
|
|||
hosts = ["photoshop"]
|
||||
|
||||
def process(self, context):
|
||||
photoshop_client = PhotoshopClientStub()
|
||||
context.data["currentFile"] = os.path.normpath(
|
||||
photoshop.app().ActiveDocument.FullName
|
||||
photoshop_client.get_active_document_full_name()
|
||||
).replace("\\", "/")
|
||||
|
|
|
|||
|
|
@ -33,8 +33,14 @@ class CollectInstances(pyblish.api.ContextPlugin):
|
|||
# for timing
|
||||
photoshop_client = PhotoshopClientStub()
|
||||
layers = photoshop_client.get_layers()
|
||||
|
||||
for layer in layers:
|
||||
layer_data = photoshop_client.read(layer)
|
||||
self.log.info("layer_data {}".format(layer_data))
|
||||
|
||||
photoshop_client.imprint(layer, layer_data)
|
||||
new_layer_data = photoshop_client.read(layer)
|
||||
assert layer_data == new_layer_data
|
||||
|
||||
# Skip layers without metadata.
|
||||
if layer_data is None:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
import pype.api
|
||||
from avalon import photoshop
|
||||
|
||||
from pype.modules.websocket_server.clients.photoshop_client import \
|
||||
PhotoshopClientStub
|
||||
|
||||
from datetime import datetime
|
||||
class ExtractSaveScene(pype.api.Extractor):
|
||||
"""Save scene before extraction."""
|
||||
|
|
@ -11,7 +14,8 @@ class ExtractSaveScene(pype.api.Extractor):
|
|||
families = ["workfile"]
|
||||
|
||||
def process(self, instance):
|
||||
photoshop_client = PhotoshopClientStub()
|
||||
start = datetime.now()
|
||||
photoshop.app().ActiveDocument.Save()
|
||||
photoshop_client.save()
|
||||
self.log.info(
|
||||
"ExtractSaveScene took {}".format(datetime.now() - start))
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ from pype.action import get_errored_plugins_from_data
|
|||
from pype.lib import version_up
|
||||
from avalon import photoshop
|
||||
|
||||
from pype.modules.websocket_server.clients.photoshop_client import \
|
||||
PhotoshopClientStub
|
||||
|
||||
class IncrementWorkfile(pyblish.api.InstancePlugin):
|
||||
"""Increment the current workfile.
|
||||
|
|
@ -24,6 +26,7 @@ class IncrementWorkfile(pyblish.api.InstancePlugin):
|
|||
)
|
||||
|
||||
scene_path = version_up(instance.context.data["currentFile"])
|
||||
photoshop.app().ActiveDocument.SaveAs(scene_path)
|
||||
photoshop_client = PhotoshopClientStub()
|
||||
photoshop_client.saveAs(scene_path, 'psd', True)
|
||||
|
||||
self.log.info("Incremented workfile to: {}".format(scene_path))
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import pyblish.api
|
|||
import pype.api
|
||||
from avalon import photoshop
|
||||
|
||||
from pype.modules.websocket_server.clients.photoshop_client import \
|
||||
PhotoshopClientStub
|
||||
|
||||
class ValidateInstanceAssetRepair(pyblish.api.Action):
|
||||
"""Repair the instance asset."""
|
||||
|
|
@ -23,11 +25,14 @@ class ValidateInstanceAssetRepair(pyblish.api.Action):
|
|||
|
||||
# Apply pyblish.logic to get the instances for the plug-in
|
||||
instances = pyblish.api.instances_by_plugin(failed, plugin)
|
||||
|
||||
photoshop_client = PhotoshopClientStub()
|
||||
for instance in instances:
|
||||
data = photoshop.read(instance[0])
|
||||
self.log.info("validate_instance_asset instance[0] {}".format(instance[0]))
|
||||
self.log.info("validate_instance_asset instance {}".format(instance))
|
||||
data = photoshop_client.read(instance[0])
|
||||
|
||||
data["asset"] = os.environ["AVALON_ASSET"]
|
||||
photoshop.imprint(instance[0], data)
|
||||
photoshop_client.imprint(instance[0], data)
|
||||
|
||||
|
||||
class ValidateInstanceAsset(pyblish.api.InstancePlugin):
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ import pyblish.api
|
|||
import pype.api
|
||||
from avalon import photoshop
|
||||
|
||||
from pype.modules.websocket_server.clients.photoshop_client import \
|
||||
PhotoshopClientStub
|
||||
|
||||
class ValidateNamingRepair(pyblish.api.Action):
|
||||
"""Repair the instance asset."""
|
||||
|
|
@ -21,13 +23,14 @@ class ValidateNamingRepair(pyblish.api.Action):
|
|||
|
||||
# Apply pyblish.logic to get the instances for the plug-in
|
||||
instances = pyblish.api.instances_by_plugin(failed, plugin)
|
||||
|
||||
photoshop_client = PhotoshopClientStub()
|
||||
for instance in instances:
|
||||
self.log.info("validate_naming instance {}".format(instance))
|
||||
name = instance.data["name"].replace(" ", "_")
|
||||
instance[0].Name = name
|
||||
data = photoshop.read(instance[0])
|
||||
data = photoshop_client.read(instance[0])
|
||||
data["subset"] = "image" + name
|
||||
photoshop.imprint(instance[0], data)
|
||||
photoshop_client.imprint(instance[0], data)
|
||||
|
||||
return True
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue