getavalon / core

The safe post-production pipeline - https://getavalon.github.io/2.0
MIT License
213 stars 48 forks source link

Photoshop Integration #516

Open tokejepsen opened 4 years ago

tokejepsen commented 4 years ago

Issue

This is about a Photoshop (PS) Integration for Avalon.

Implementation

tokejepsen commented 4 years ago

Workfiles prototype

Untitled_ Jan 17 2020 6_30 PM

tokejepsen commented 4 years ago

Menu Items

tokejepsen commented 4 years ago

Extension

Untitled_ Jan 19 2020 10_50 PM

davidlatwe commented 4 years ago

Looks like a good start indeed !!

tokejepsen commented 4 years ago

Separate Flask Server

Untitled_ Jan 20 2020 6_48 PM

tokejepsen commented 4 years ago

Untitled_ Jan 22, 2020 6_09 PM

tokejepsen commented 4 years ago

Untitled_ Jan 27, 2020 2_29 PM

tokejepsen commented 4 years ago

Unfortunately LayerSets cannot store metadata, so a possible solution is to have a layer within the LayerSet that stores the metadata for the container. Certainly not ideal since the user can move the metadata layer around, but we can also link the layer and LayerSet to ensure we can get the metadata.

tokejepsen commented 4 years ago

One issue with using metadata on a layer, is that the user cannot actually interact with the data.

For example in Maya data is imprinted on the container, which allows users to manually change this data after creation.

It might be useful with a tools that reads/writes this imprinted data, so DCCs like Photoshop can have same interaction as Maya.

tokejepsen commented 4 years ago

When getting deeper into the integration it got apparent that passing objects around to different functions (imprint for example), communicating with Photoshop over socket/port became very tricky. So I took the "cheap" way out, and added the pywin32 (on Windows) dependency. Maybe in the future there will be python library we can make use of.

tokejepsen commented 4 years ago

Untitled_ Jan 30, 2020 3_09 PM

This involved other required methods; imprint and maintained_selection. Getting deeper into XMPMetadata turned out to be needlessly tricky. Instead I've opted to store the metadata in the file info Headline field. There may be a better place for this, but I chose this because (1) it provides easy access for debugging and (2) the Headline field in Photoshop is a multi-line edit so its a easy to copy.

Since I'm not storing the metadata on each layer instance, I've resorted to using each layers id which is unique. The data is a dictionary with these ids:

{
    "189": {
        "id": "pyblish.avalon.instance",
        "family": "image",
        "asset": "Bruce",
        "subset": "imageDefault",
        "active": true
    }
}

The nice thing about this approach is that LayerSets have ids as well, so there no need for additional layers as described here, making is cleaner and less user error prone.

tokejepsen commented 4 years ago

Documenting this to be fixed later.

When opening the Creator tool for the second time after creating an instance, this message appears:

Traceback (most recent call last):
  File "C:\Users\admin\avalon-docker\volume\git\avalon-core\avalon\tools\creator\app.py", line 465, in <lambda>
    lib.schedule(lambda: widget.setText(""), 5000, channel="message")
RuntimeError: wrapped C/C++ object of type QLabel has been deleted
tokejepsen commented 4 years ago

Publishing and Loading

compressed

Being able to go full circle marks the completion of the draft version of the Photoshop integration. Will look at documentation and PR tomorrow.