Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 36 additions & 9 deletions src/quadpype/hosts/aftereffects/api/workfile_template_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,35 @@

PLACEHOLDER_SET = "PLACEHOLDERS_SET"
PLACEHOLDER_ID = "quadpype.placeholder"
_ACTIVE_PLACEHOLDER_DIALOGS = {
"create": None,
"update": None,
}


def _show_placeholder_dialog(host, builder, dialog_key, placeholder_item=None):
dialog = _ACTIVE_PLACEHOLDER_DIALOGS.get(dialog_key)

if dialog and dialog.isVisible():
if placeholder_item is not None:
dialog.set_update_mode(placeholder_item)
else:
dialog.set_create_mode()
dialog.raise_()
dialog.activateWindow()
return

dialog = WorkfileBuildPlaceholderDialog(host, builder)
if placeholder_item is not None:
dialog.set_update_mode(placeholder_item)

_ACTIVE_PLACEHOLDER_DIALOGS[dialog_key] = dialog
dialog.finished.connect(
lambda *_: _ACTIVE_PLACEHOLDER_DIALOGS.__setitem__(dialog_key, None)
)
dialog.show()
dialog.raise_()
dialog.activateWindow()

class AETemplateBuilder(AbstractTemplateBuilder):
"""Concrete implementation of AbstractTemplateBuilder for AE"""
Expand Down Expand Up @@ -263,10 +292,7 @@ def create_placeholder(*args):
"""Called when new workile placeholder should be created."""
host = registered_host()
builder = AETemplateBuilder(host)
window = WorkfileBuildPlaceholderDialog(host, builder)
window.show()
window.raise_()
window.activateWindow()
_show_placeholder_dialog(host, builder, "create")


def update_placeholder(*args):
Expand Down Expand Up @@ -301,8 +327,9 @@ def update_placeholder(*args):
"Remove and re-create placeholder.")
return

window = WorkfileBuildPlaceholderDialog(host, builder)
window.set_update_mode(placeholder_item)
window.show()
window.raise_()
window.activateWindow()
_show_placeholder_dialog(
host,
builder,
"update",
placeholder_item=placeholder_item
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<description>
## Layer name too long detected

Layers names can not include more than configured characters numbers allowed.
Layers names can not include more than {max_number_characters} characters numbers allowed.

### How to repair?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ValidateLayersNameLengthCutName(pyblish.api.Action):

def process(self, context, plugin):
project_settings = context.data.get("project_settings", {})
max_number_characters = project_settings.get("global", {}).get("publish", {}).get("ValidateLayersNameLength", {}).get("max_number_characters", 31)
max_number_characters = project_settings.get("aftereffects", {}).get("publish", {}).get("ValidateLayersNameLength", {}).get("max_number_characters", 31)

data = context.data['transientData'][plugin.__name__]
invalid_layers = data["layers"]
Expand All @@ -60,7 +60,7 @@ class ValidateLayersNameLength(pyblish.api.InstancePlugin):

def collect_invalid_layers(self, layers, instance, parent_comp_id):
project_settings = instance.context.data.get("project_settings", {})
max_number_characters = project_settings.get("global", {}).get("publish", {}).get("ValidateLayersNameLength", {}).get("max_number_characters", 31)
max_number_characters = project_settings.get("aftereffects", {}).get("publish", {}).get("ValidateLayersNameLength", {}).get("max_number_characters", 31)

invalid = []

Expand All @@ -74,7 +74,9 @@ def collect_invalid_layers(self, layers, instance, parent_comp_id):

def process(self, instance):
project_settings = instance.context.data.get("project_settings", {})
active = project_settings.get("global", {}).get("publish", {}).get("ValidateLayersNameLength", {}).get("active", True)
active = project_settings.get("aftereffects", {}).get("publish", {}).get("ValidateLayersNameLength", {}).get("active", True)
max_number_characters = project_settings.get("aftereffects", {}).get("publish", {}).get("ValidateLayersNameLength", {}).get("max_number_characters", 31)


if not active:
return
Expand All @@ -100,4 +102,4 @@ def process(self, instance):
"comp_id": instance.data["comp_id"]
}
detail_lines = [f"- {layer['name']}" for layer in invalid_layers]
raise PublishXmlValidationError(self, msg, formatting_data={"layer_names": "<br/>".join(detail_lines)})
raise PublishXmlValidationError(self, msg, formatting_data={"layer_names": "<br/>".join(detail_lines), "max_number_characters": max_number_characters})
4 changes: 3 additions & 1 deletion src/quadpype/hosts/photoshop/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
from .pipeline import (
PhotoshopHost,
ls,
containerise
containerise,
set_colorspace_from_settings
)
from .plugin import (
PhotoshopLoader,
Expand All @@ -30,6 +31,7 @@
"PhotoshopHost",
"ls",
"containerise",
"set_colorspace_from_settings",

# Plugin
"PhotoshopLoader",
Expand Down
6 changes: 3 additions & 3 deletions src/quadpype/hosts/photoshop/api/checksums
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
8716BC5C7DBF3338B8F104CFDEED84B1F88E2D4CC2A1AA2E5AAE577EDD396DB8:.debug
F5735E42DB658772762D3F7D0FDC277F301740DDB1470B84AD83CB7FC729074C:index.html
C6AA55D5FF021C09F1DB7B601C5F88122BE841E74BBDD634932F50D9FD2D9E0C:client\client.js
1A80FA83F8A6DCDB6B5EB99CC763E847573DB593BE57C0B08F4048F6B8E4509E:client\client.js
5F8F8EBCFFC668009CF48DF1301F8C962A6D54F6EA12F0B0469C42C9DE48F742:client\CSInterface.js
FD0E8BED2FA88E12F5D49646944793C134428F80311BC03F3BCB1196CE3AF0AD:client\loglevel.min.js
56E337B14F6D5015C4DE134DFEA6960850927A826C06F51AD9DA660003C8AA93:client\wsrpc.js
EF55B30BCA552818EC4E11D7F34DCE9F7A1853E8BC4FAEEE802CF6D469C0C472:client\wsrpc.min.js
1E6A1A8A3A588774AC337997B62AF7DB3578A786967FF8E78A1A87CCCDCBDF2D:CSXS\manifest.xml
D352E98E9DF72DB98EE2A8D713DBECE9C4CEB7513DD4A726E65D1A6A4219722C:CSXS\manifest.xml
A4DA8020977C89F5F114D6927F4E6FF1BDBB1552D4246252435E809027BA06D3:host\export_json.jsx
5D50229BC4AD621528B6AC87932BF252210B0CC151CBFFAF9EF65DAEB784C67A:host\index.jsx
70CC7F1FD989AD9919941F22E91203B93CF524960963B3006479B072913E6869:host\index.jsx
CC7DDC2DA053A7B922BC0DA7023F734BB80D6E00B87926715206D530664BC415:host\json.js
D6F0B54C43673F18785AE31D4659289CCB08D9C79C1BBEF588ACBA8C9DBD96F4:host\JSX.js
95B2A3610223248F0CB96FFA15882EAA8282EE44FA2515D75AE613918E9DDA93:host\json_photoshop_scripting\jamActions-min.jsxinc
Expand Down
Binary file modified src/quadpype/hosts/photoshop/api/extension.zxp
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<ExtensionManifest ExtensionBundleId="io.quad.PS.panel" ExtensionBundleVersion="1.0.10" Version="7.0">
<ExtensionManifest ExtensionBundleId="io.quad.PS.panel" ExtensionBundleVersion="1.0.11" Version="7.0">
<ExtensionList>
<Extension Id="io.quad.PS.panel" Version="1.0.0" />
</ExtensionList>
Expand Down
9 changes: 9 additions & 0 deletions src/quadpype/hosts/photoshop/api/extension/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,15 @@ function main(websocket_url) {
});
});

RPC.addRoute('Photoshop.set_working_colorspace_rgb', function (data) {
log.warn('Server called client route "set_working_colorspace_rgb":', data);
return runEvalScript("setWorkingColorspaceRGB('" + data.colorspace + "')")
.then(function (result) {
log.warn("set_working_colorspace_rgb: " + result);
return result;
});
});

RPC.addRoute('Photoshop.get_extension_version', function (data) {
log.warn('Server called client route "get_extension_version":', data);
return get_extension_version();
Expand Down
15 changes: 15 additions & 0 deletions src/quadpype/hosts/photoshop/api/extension/host/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -753,3 +753,18 @@ function exportSceneToJSON(path) {

return true
}

function setWorkingColorspaceRGB(profileName) {
var ref = new ActionReference();
ref.putProperty(charIDToTypeID("Prpr"), stringIDToTypeID("colorSettings"));
ref.putEnumerated(charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));

var desc = new ActionDescriptor();
desc.putReference(charIDToTypeID("null"), ref);

var colorSettingsDesc = new ActionDescriptor();
colorSettingsDesc.putString(stringIDToTypeID("workingRGB"), profileName);

desc.putObject(charIDToTypeID("T "), stringIDToTypeID("colorSettings"), colorSettingsDesc);
executeAction(charIDToTypeID("setd"), desc, DialogModes.NO);
}
4 changes: 2 additions & 2 deletions src/quadpype/hosts/photoshop/api/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def safe_excepthook(*args):


def main(*subprocess_args):
from quadpype.hosts.photoshop.api import PhotoshopHost
from quadpype.hosts.photoshop.api import PhotoshopHost, set_colorspace_from_settings

host = PhotoshopHost()
install_host(host)
Expand Down Expand Up @@ -61,7 +61,7 @@ def main(*subprocess_args):

if not is_last_workfile_exists() and should_build_first_workfile():
launcher.execute_in_main_thread(build_workfile_template)

launcher.execute_in_main_thread(set_colorspace_from_settings)
sys.exit(app.exec_())


Expand Down
18 changes: 17 additions & 1 deletion src/quadpype/hosts/photoshop/api/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pyblish.api

from quadpype.lib import register_event_callback, Logger
from quadpype.settings import get_project_settings
from quadpype.pipeline import (
register_loader_plugin_path,
register_creator_plugin_path,
Expand Down Expand Up @@ -79,7 +80,7 @@ def work_root(self, session):
def open_workfile(self, filepath):
stub = _get_stub()
stub.open(filepath)

set_colorspace_from_settings()
return True

def save_workfile(self, filepath=None):
Expand Down Expand Up @@ -219,6 +220,7 @@ def check_inventory():


def on_application_launch():
set_colorspace_from_settings()
check_inventory()


Expand Down Expand Up @@ -334,3 +336,17 @@ def cache_and_get_instances(creator):
creator.collection_shared_data[shared_key] = \
creator.host.list_instances()
return creator.collection_shared_data[shared_key]

def set_colorspace_from_settings():
"""Set colorspace for Photoshop from settings.

This function retrieves the colorspace setting from the configuration
and applies it to Photoshop using the stub.
"""
project_name = os.environ['AVALON_PROJECT']
project_settings = get_project_settings(project_name)

colorspace_name = project_settings['photoshop']['colorspace']['colorspace_name']
stub = lib.stub()
stub.set_working_colorspace_rgb(colorspace_name)
log.info(f"Set Photoshop colorspace to {colorspace_name} based on project settings.")
45 changes: 36 additions & 9 deletions src/quadpype/hosts/photoshop/api/workfile_template_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,35 @@
from .launch_logic import stub as get_stub

PLACEHOLDER_ID = "quadpype.placeholder"
_ACTIVE_PLACEHOLDER_DIALOGS = {
"create": None,
"update": None,
}


def _show_placeholder_dialog(host, builder, dialog_key, placeholder_item=None):
dialog = _ACTIVE_PLACEHOLDER_DIALOGS.get(dialog_key)

if dialog and dialog.isVisible():
if placeholder_item is not None:
dialog.set_update_mode(placeholder_item)
else:
dialog.set_create_mode()
dialog.raise_()
dialog.activateWindow()
return

dialog = WorkfileBuildPlaceholderDialog(host, builder)
if placeholder_item is not None:
dialog.set_update_mode(placeholder_item)

_ACTIVE_PLACEHOLDER_DIALOGS[dialog_key] = dialog
dialog.finished.connect(
lambda *_: _ACTIVE_PLACEHOLDER_DIALOGS.__setitem__(dialog_key, None)
)
dialog.show()
dialog.raise_()
dialog.activateWindow()

class TextColor(Enum):
RED = ([255, 0, 0], "Red")
Expand Down Expand Up @@ -377,10 +406,7 @@ def create_placeholder(*args):
"""Called when new workile placeholder should be created."""
host = registered_host()
builder = PSTemplateBuilder(host)
window = WorkfileBuildPlaceholderDialog(host, builder)
window.show()
window.raise_()
window.activateWindow()
_show_placeholder_dialog(host, builder, "create")


def update_placeholder(*args):
Expand Down Expand Up @@ -416,8 +442,9 @@ def update_placeholder(*args):
"Remove and re-create placeholder.")
return

window = WorkfileBuildPlaceholderDialog(host, builder)
window.set_update_mode(placeholder_item)
window.show()
window.raise_()
window.activateWindow()
_show_placeholder_dialog(
host,
builder,
"update",
placeholder_item=placeholder_item
)
6 changes: 6 additions & 0 deletions src/quadpype/hosts/photoshop/api/ws_stub.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,12 @@ def export_scene_to_json(self, path):
self.client.call('Photoshop.export_scene_to_json', path=path)
)

def set_working_colorspace_rgb(self, colorspace):
"""Set working colorspace."""
return self.websocketserver.call(
self.client.call('Photoshop.set_working_colorspace_rgb', colorspace=colorspace)
)

def get_extension_version(self):
"""Returns version number of installed extension."""
return self.websocketserver.call(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ValidateLayersNameLengthCutName(pyblish.api.Action):
def process(self, context, plugin):

project_settings = context.data.get("project_settings", {})
max_number_characters = project_settings.get("global", {}).get("publish", {}).get("ValidateLayersNameLength", {}).get("max_number_characters", 31)
max_number_characters = project_settings.get("photoshop", {}).get("publish", {}).get("ValidateLayersNameLength", {}).get("max_number_characters", 31)

stub = photoshop.stub()
layers = context.data['transientData'][plugin.__name__]
Expand All @@ -55,7 +55,7 @@ class ValidateLayersNameLength(

def process(self, instance):
project_settings = instance.context.data.get("project_settings", {})
active = project_settings.get("global", {}).get("publish", {}).get("ValidateLayersNameLength", {}).get("active", True)
active = project_settings.get("photoshop", {}).get("publish", {}).get("ValidateLayersNameLength", {}).get("active", True)

if not active:
return
Expand All @@ -69,7 +69,7 @@ def process(self, instance):

stub = photoshop.stub()
layers = stub.get_layers()
max_number_characters = project_settings.get("global", {}).get("publish", {}).get("ValidateLayersNameLength", {}).get("max_number_characters", 31)
max_number_characters = project_settings.get("photoshop", {}).get("publish", {}).get("ValidateLayersNameLength", {}).get("max_number_characters", 31)

for layer in layers:
if len(layer.name) <= max_number_characters:
Expand Down
11 changes: 3 additions & 8 deletions src/quadpype/hosts/tvpaint/api/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@
from quadpype.pipeline.context_tools import get_global_context
from quadpype.tools.utils.workfile_cache import WorkFileCache

from quadpype.hosts.tvpaint.api.workfile_template_builder import (
TVPPlaceholderLoadPlugin,
TVPPlaceholderCreatePlugin
)
from quadpype.hosts.tvpaint.api.workfile_template_builder import TVPPlaceholderLoadPlugin


from .lib import (
execute_george,
Expand Down Expand Up @@ -103,10 +101,7 @@ def install(self):
register_event_callback("application.exit", self.application_exit)

def get_workfile_build_placeholder_plugins(self):
return [
TVPPlaceholderLoadPlugin,
TVPPlaceholderCreatePlugin
]
return [TVPPlaceholderLoadPlugin]

def get_current_project_name(self):
"""
Expand Down
Loading
Loading