mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
OP-2765 - added methods for New Publisher
Removed uuid, replaced with instance_id or first members item
This commit is contained in:
parent
7b1821238d
commit
7f83c8a2d0
3 changed files with 45 additions and 22 deletions
|
|
@ -16,7 +16,10 @@ from .pipeline import (
|
|||
uninstall,
|
||||
list_instances,
|
||||
remove_instance,
|
||||
containerise
|
||||
containerise,
|
||||
get_context_data,
|
||||
update_context_data,
|
||||
get_context_title
|
||||
)
|
||||
|
||||
from .workio import (
|
||||
|
|
@ -51,6 +54,9 @@ __all__ = [
|
|||
"list_instances",
|
||||
"remove_instance",
|
||||
"containerise",
|
||||
"get_context_data",
|
||||
"update_context_data",
|
||||
"get_context_title",
|
||||
|
||||
"file_extensions",
|
||||
"has_unsaved_changes",
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ from avalon import io, pipeline
|
|||
from openpype import lib
|
||||
from openpype.api import Logger
|
||||
import openpype.hosts.aftereffects
|
||||
from openpype.pipeline import BaseCreator
|
||||
|
||||
from .launch_logic import get_stub
|
||||
|
||||
|
|
@ -67,6 +68,7 @@ def install():
|
|||
|
||||
avalon.api.register_plugin_path(avalon.api.Loader, LOAD_PATH)
|
||||
avalon.api.register_plugin_path(avalon.api.Creator, CREATE_PATH)
|
||||
avalon.api.register_plugin_path(BaseCreator, CREATE_PATH)
|
||||
log.info(PUBLISH_PATH)
|
||||
|
||||
pyblish.api.register_callback(
|
||||
|
|
@ -238,12 +240,6 @@ def list_instances():
|
|||
if instance.get("schema") and \
|
||||
"container" in instance.get("schema"):
|
||||
continue
|
||||
|
||||
uuid_val = instance.get("uuid")
|
||||
if uuid_val:
|
||||
instance['uuid'] = uuid_val
|
||||
else:
|
||||
instance['uuid'] = instance.get("members")[0] # legacy
|
||||
instances.append(instance)
|
||||
return instances
|
||||
|
||||
|
|
@ -265,8 +261,29 @@ def remove_instance(instance):
|
|||
if not stub:
|
||||
return
|
||||
|
||||
stub.remove_instance(instance.get("uuid"))
|
||||
item = stub.get_item(instance.get("uuid"))
|
||||
if item:
|
||||
stub.rename_item(item.id,
|
||||
item.name.replace(stub.PUBLISH_ICON, ''))
|
||||
inst_id = instance.get("instance_id")
|
||||
if not inst_id:
|
||||
log.warning("No instance identifier for {}".format(instance))
|
||||
return
|
||||
|
||||
stub.remove_instance(inst_id)
|
||||
|
||||
if instance.members:
|
||||
item = stub.get_item(instance.members[0])
|
||||
if item:
|
||||
stub.rename_item(item.id,
|
||||
item.name.replace(stub.PUBLISH_ICON, ''))
|
||||
|
||||
|
||||
def get_context_data():
|
||||
print("get_context_data")
|
||||
return {}
|
||||
|
||||
|
||||
def update_context_data(data, changes):
|
||||
print("update_context_data")
|
||||
|
||||
|
||||
def get_context_title():
|
||||
"""Returns title for Creator window"""
|
||||
return "AfterEffects"
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ class AEItem(object):
|
|||
workAreaDuration = attr.ib(default=None)
|
||||
frameRate = attr.ib(default=None)
|
||||
file_name = attr.ib(default=None)
|
||||
instance_id = attr.ib(default=None) # New Publisher
|
||||
|
||||
|
||||
class AfterEffectsServerStub():
|
||||
|
|
@ -132,8 +133,9 @@ class AfterEffectsServerStub():
|
|||
is_new = True
|
||||
|
||||
for item_meta in items_meta:
|
||||
if item_meta.get('members') \
|
||||
and str(item.id) == str(item_meta.get('members')[0]):
|
||||
if ((item_meta.get('members') and
|
||||
str(item.id) == str(item_meta.get('members')[0])) or
|
||||
item_meta.get("instance_id") == item.id):
|
||||
is_new = False
|
||||
if data:
|
||||
item_meta.update(data)
|
||||
|
|
@ -314,15 +316,12 @@ class AfterEffectsServerStub():
|
|||
Keep matching item in file though.
|
||||
|
||||
Args:
|
||||
instance_id(string): instance uuid
|
||||
instance_id(string): instance id
|
||||
"""
|
||||
cleaned_data = []
|
||||
|
||||
for instance in self.get_metadata():
|
||||
uuid_val = instance.get("uuid")
|
||||
if not uuid_val:
|
||||
uuid_val = instance.get("members")[0] # legacy
|
||||
if uuid_val != instance_id:
|
||||
if instance.get("instance_id") != instance_id:
|
||||
cleaned_data.append(instance)
|
||||
|
||||
payload = json.dumps(cleaned_data, indent=4)
|
||||
|
|
@ -357,7 +356,7 @@ class AfterEffectsServerStub():
|
|||
item_id (int):
|
||||
|
||||
Returns:
|
||||
(namedtuple)
|
||||
(AEItem)
|
||||
|
||||
"""
|
||||
res = self.websocketserver.call(self.client.call
|
||||
|
|
@ -418,7 +417,7 @@ class AfterEffectsServerStub():
|
|||
""" Get render queue info for render purposes
|
||||
|
||||
Returns:
|
||||
(namedtuple): with 'file_name' field
|
||||
(AEItem): with 'file_name' field
|
||||
"""
|
||||
res = self.websocketserver.call(self.client.call
|
||||
('AfterEffects.get_render_info'))
|
||||
|
|
@ -606,7 +605,8 @@ class AfterEffectsServerStub():
|
|||
d.get('workAreaStart'),
|
||||
d.get('workAreaDuration'),
|
||||
d.get('frameRate'),
|
||||
d.get('file_name'))
|
||||
d.get('file_name'),
|
||||
d.get("instance_id"))
|
||||
|
||||
ret.append(item)
|
||||
return ret
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue