mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 13:24:54 +01:00
Merge branch 'develop' into bugfix/hiero-load-clip-colorspace
This commit is contained in:
commit
cd1609b09c
7 changed files with 172 additions and 114 deletions
|
|
@ -0,0 +1,61 @@
|
|||
from openpype.modules.ftrack.lib import ServerAction
|
||||
|
||||
|
||||
class PrivateProjectDetectionAction(ServerAction):
|
||||
"""Action helps to identify if does not have access to project."""
|
||||
|
||||
identifier = "server.missing.perm.private.project"
|
||||
label = "Missing permissions"
|
||||
description = (
|
||||
"Main ftrack event server does not have access to this project."
|
||||
)
|
||||
|
||||
def _discover(self, event):
|
||||
"""Show action only if there is a selection in event data."""
|
||||
entities = self._translate_event(event)
|
||||
if entities:
|
||||
return None
|
||||
|
||||
selection = event["data"].get("selection")
|
||||
if not selection:
|
||||
return None
|
||||
|
||||
return {
|
||||
"items": [{
|
||||
"label": self.label,
|
||||
"variant": self.variant,
|
||||
"description": self.description,
|
||||
"actionIdentifier": self.discover_identifier,
|
||||
"icon": self.icon,
|
||||
}]
|
||||
}
|
||||
|
||||
def _launch(self, event):
|
||||
# Ignore if there are values in event data
|
||||
# - somebody clicked on submit button
|
||||
values = event["data"].get("values")
|
||||
if values:
|
||||
return None
|
||||
|
||||
title = "# Private project (missing permissions) #"
|
||||
msg = (
|
||||
"User ({}) or API Key used on Ftrack event server"
|
||||
" does not have permissions to access this private project."
|
||||
).format(self.session.api_user)
|
||||
return {
|
||||
"type": "form",
|
||||
"title": "Missing permissions",
|
||||
"items": [
|
||||
{"type": "label", "value": title},
|
||||
{"type": "label", "value": msg},
|
||||
# Add hidden to be able detect if was clicked on submit
|
||||
{"type": "hidden", "value": "1", "name": "hidden"}
|
||||
],
|
||||
"submit_button_label": "Got it"
|
||||
}
|
||||
|
||||
|
||||
def register(session):
|
||||
'''Register plugin. Called when used as an plugin.'''
|
||||
|
||||
PrivateProjectDetectionAction(session).register()
|
||||
|
|
@ -1,33 +1,98 @@
|
|||
import platform
|
||||
import socket
|
||||
import getpass
|
||||
|
||||
from openpype.modules.ftrack.lib import BaseAction, statics_icon
|
||||
|
||||
|
||||
class ActionAskWhereIRun(BaseAction):
|
||||
""" Sometimes user forget where pipeline with his credentials is running.
|
||||
- this action triggers `ActionShowWhereIRun`
|
||||
"""
|
||||
ignore_me = True
|
||||
identifier = 'ask.where.i.run'
|
||||
label = 'Ask where I run'
|
||||
description = 'Triggers PC info where user have running OpenPype'
|
||||
icon = statics_icon("ftrack", "action_icons", "ActionAskWhereIRun.svg")
|
||||
class ActionWhereIRun(BaseAction):
|
||||
"""Show where same user has running OpenPype instances."""
|
||||
|
||||
def discover(self, session, entities, event):
|
||||
""" Hide by default - Should be enabled only if you want to run.
|
||||
- best practise is to create another action that triggers this one
|
||||
"""
|
||||
identifier = "ask.where.i.run"
|
||||
show_identifier = "show.where.i.run"
|
||||
label = "OpenPype Admin"
|
||||
variant = "- Where I run"
|
||||
description = "Show PC info where user have running OpenPype"
|
||||
|
||||
return True
|
||||
def _discover(self, _event):
|
||||
return {
|
||||
"items": [{
|
||||
"label": self.label,
|
||||
"variant": self.variant,
|
||||
"description": self.description,
|
||||
"actionIdentifier": self.discover_identifier,
|
||||
"icon": self.icon,
|
||||
}]
|
||||
}
|
||||
|
||||
def launch(self, session, entities, event):
|
||||
more_data = {"event_hub_id": session.event_hub.id}
|
||||
self.trigger_action(
|
||||
"show.where.i.run", event, additional_event_data=more_data
|
||||
def _launch(self, event):
|
||||
self.trigger_action(self.show_identifier, event)
|
||||
|
||||
def register(self):
|
||||
# Register default action callbacks
|
||||
super(ActionWhereIRun, self).register()
|
||||
|
||||
# Add show identifier
|
||||
show_subscription = (
|
||||
"topic=ftrack.action.launch"
|
||||
" and data.actionIdentifier={}"
|
||||
" and source.user.username={}"
|
||||
).format(
|
||||
self.show_identifier,
|
||||
self.session.api_user
|
||||
)
|
||||
self.session.event_hub.subscribe(
|
||||
show_subscription,
|
||||
self._show_info
|
||||
)
|
||||
|
||||
return True
|
||||
def _show_info(self, event):
|
||||
title = "Where Do I Run?"
|
||||
msgs = {}
|
||||
all_keys = ["Hostname", "IP", "Username", "System name", "PC name"]
|
||||
try:
|
||||
host_name = socket.gethostname()
|
||||
msgs["Hostname"] = host_name
|
||||
host_ip = socket.gethostbyname(host_name)
|
||||
msgs["IP"] = host_ip
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
system_name, pc_name, *_ = platform.uname()
|
||||
msgs["System name"] = system_name
|
||||
msgs["PC name"] = pc_name
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
msgs["Username"] = getpass.getuser()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
for key in all_keys:
|
||||
if not msgs.get(key):
|
||||
msgs[key] = "-Undefined-"
|
||||
|
||||
items = []
|
||||
first = True
|
||||
separator = {"type": "label", "value": "---"}
|
||||
for key, value in msgs.items():
|
||||
if first:
|
||||
first = False
|
||||
else:
|
||||
items.append(separator)
|
||||
self.log.debug("{}: {}".format(key, value))
|
||||
|
||||
subtitle = {"type": "label", "value": "<h3>{}</h3>".format(key)}
|
||||
items.append(subtitle)
|
||||
message = {"type": "label", "value": "<p>{}</p>".format(value)}
|
||||
items.append(message)
|
||||
|
||||
self.show_interface(items, title, event=event)
|
||||
|
||||
|
||||
def register(session):
|
||||
'''Register plugin. Called when used as an plugin.'''
|
||||
|
||||
ActionAskWhereIRun(session).register()
|
||||
ActionWhereIRun(session).register()
|
||||
|
|
|
|||
|
|
@ -1,86 +0,0 @@
|
|||
import platform
|
||||
import socket
|
||||
import getpass
|
||||
from openpype.modules.ftrack.lib import BaseAction
|
||||
|
||||
|
||||
class ActionShowWhereIRun(BaseAction):
|
||||
""" Sometimes user forget where pipeline with his credentials is running.
|
||||
- this action shows on which PC, Username and IP is running
|
||||
- requirement action MUST be registered where we want to locate the PC:
|
||||
- - can't be used retrospectively...
|
||||
"""
|
||||
#: Action identifier.
|
||||
identifier = 'show.where.i.run'
|
||||
#: Action label.
|
||||
label = 'Show where I run'
|
||||
#: Action description.
|
||||
description = 'Shows PC info where user have running OpenPype'
|
||||
|
||||
def discover(self, session, entities, event):
|
||||
""" Hide by default - Should be enabled only if you want to run.
|
||||
- best practise is to create another action that triggers this one
|
||||
"""
|
||||
|
||||
return False
|
||||
|
||||
@property
|
||||
def launch_identifier(self):
|
||||
return self.identifier
|
||||
|
||||
def launch(self, session, entities, event):
|
||||
# Don't show info when was launch from this session
|
||||
if session.event_hub.id == event.get("data", {}).get("event_hub_id"):
|
||||
return True
|
||||
|
||||
title = "Where Do I Run?"
|
||||
msgs = {}
|
||||
all_keys = ["Hostname", "IP", "Username", "System name", "PC name"]
|
||||
try:
|
||||
host_name = socket.gethostname()
|
||||
msgs["Hostname"] = host_name
|
||||
host_ip = socket.gethostbyname(host_name)
|
||||
msgs["IP"] = host_ip
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
system_name, pc_name, *_ = platform.uname()
|
||||
msgs["System name"] = system_name
|
||||
msgs["PC name"] = pc_name
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
msgs["Username"] = getpass.getuser()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
for key in all_keys:
|
||||
if not msgs.get(key):
|
||||
msgs[key] = "-Undefined-"
|
||||
|
||||
items = []
|
||||
first = True
|
||||
splitter = {'type': 'label', 'value': '---'}
|
||||
for key, value in msgs.items():
|
||||
if first:
|
||||
first = False
|
||||
else:
|
||||
items.append(splitter)
|
||||
self.log.debug("{}: {}".format(key, value))
|
||||
|
||||
subtitle = {'type': 'label', 'value': '<h3>{}</h3>'.format(key)}
|
||||
items.append(subtitle)
|
||||
message = {'type': 'label', 'value': '<p>{}</p>'.format(value)}
|
||||
items.append(message)
|
||||
|
||||
self.show_interface(items, title, event=event)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def register(session):
|
||||
'''Register plugin. Called when used as an plugin.'''
|
||||
|
||||
ActionShowWhereIRun(session).register()
|
||||
|
|
@ -191,15 +191,22 @@ class BaseHandler(object):
|
|||
if session is None:
|
||||
session = self.session
|
||||
|
||||
_entities = event['data'].get('entities_object', None)
|
||||
_entities = event["data"].get("entities_object", None)
|
||||
if _entities is not None and not _entities:
|
||||
return _entities
|
||||
|
||||
if (
|
||||
_entities is None or
|
||||
_entities[0].get(
|
||||
'link', None
|
||||
_entities is None
|
||||
or _entities[0].get(
|
||||
"link", None
|
||||
) == ftrack_api.symbol.NOT_SET
|
||||
):
|
||||
_entities = self._get_entities(event)
|
||||
event['data']['entities_object'] = _entities
|
||||
_entities = [
|
||||
item
|
||||
for item in self._get_entities(event)
|
||||
if item is not None
|
||||
]
|
||||
event["data"]["entities_object"] = _entities
|
||||
|
||||
return _entities
|
||||
|
||||
|
|
|
|||
|
|
@ -113,6 +113,10 @@ def _h264_codec_args(ffprobe_data):
|
|||
|
||||
output.extend(["-codec:v", "h264"])
|
||||
|
||||
bit_rate = ffprobe_data.get("bit_rate")
|
||||
if bit_rate:
|
||||
output.extend(["-b:v", bit_rate])
|
||||
|
||||
pix_fmt = ffprobe_data.get("pix_fmt")
|
||||
if pix_fmt:
|
||||
output.extend(["-pix_fmt", pix_fmt])
|
||||
|
|
|
|||
|
|
@ -316,6 +316,7 @@ class Controller(QtCore.QObject):
|
|||
self.was_skipped.emit(plugin)
|
||||
continue
|
||||
|
||||
in_collect_stage = self.collect_state == 0
|
||||
if plugin.__instanceEnabled__:
|
||||
instances = pyblish.logic.instances_by_plugin(
|
||||
self.context, plugin
|
||||
|
|
@ -325,7 +326,10 @@ class Controller(QtCore.QObject):
|
|||
continue
|
||||
|
||||
for instance in instances:
|
||||
if instance.data.get("publish") is False:
|
||||
if (
|
||||
not in_collect_stage
|
||||
and instance.data.get("publish") is False
|
||||
):
|
||||
pyblish.logic.log.debug(
|
||||
"%s was inactive, skipping.." % instance
|
||||
)
|
||||
|
|
@ -338,7 +342,7 @@ class Controller(QtCore.QObject):
|
|||
yield (plugin, instance)
|
||||
else:
|
||||
families = util.collect_families_from_instances(
|
||||
self.context, only_active=True
|
||||
self.context, only_active=not in_collect_stage
|
||||
)
|
||||
plugins = pyblish.logic.plugins_by_families(
|
||||
[plugin], families
|
||||
|
|
|
|||
|
|
@ -498,6 +498,9 @@ class PluginModel(QtGui.QStandardItemModel):
|
|||
):
|
||||
new_flag_states[PluginStates.HasError] = True
|
||||
|
||||
if not publish_states & PluginStates.IsCompatible:
|
||||
new_flag_states[PluginStates.IsCompatible] = True
|
||||
|
||||
item.setData(new_flag_states, Roles.PublishFlagsRole)
|
||||
|
||||
records = item.data(Roles.LogRecordsRole) or []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue