mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Remove unused functions from Fusion integration
This commit is contained in:
parent
9369d4d931
commit
54a62348d0
4 changed files with 3 additions and 122 deletions
|
|
@ -3,9 +3,7 @@ from .pipeline import (
|
||||||
ls,
|
ls,
|
||||||
|
|
||||||
imprint_container,
|
imprint_container,
|
||||||
parse_container,
|
parse_container
|
||||||
list_instances,
|
|
||||||
remove_instance
|
|
||||||
)
|
)
|
||||||
|
|
||||||
from .lib import (
|
from .lib import (
|
||||||
|
|
@ -22,6 +20,7 @@ from .menu import launch_openpype_menu
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
# pipeline
|
# pipeline
|
||||||
|
"FusionHost",
|
||||||
"ls",
|
"ls",
|
||||||
|
|
||||||
"imprint_container",
|
"imprint_container",
|
||||||
|
|
@ -32,6 +31,7 @@ __all__ = [
|
||||||
"update_frame_range",
|
"update_frame_range",
|
||||||
"set_asset_framerange",
|
"set_asset_framerange",
|
||||||
"get_current_comp",
|
"get_current_comp",
|
||||||
|
"get_bmd_library",
|
||||||
"comp_lock_and_undo_chunk",
|
"comp_lock_and_undo_chunk",
|
||||||
|
|
||||||
# menu
|
# menu
|
||||||
|
|
|
||||||
|
|
@ -181,80 +181,6 @@ def validate_comp_prefs(comp=None, force_repair=False):
|
||||||
dialog.setStyleSheet(load_stylesheet())
|
dialog.setStyleSheet(load_stylesheet())
|
||||||
|
|
||||||
|
|
||||||
def switch_item(container,
|
|
||||||
asset_name=None,
|
|
||||||
subset_name=None,
|
|
||||||
representation_name=None):
|
|
||||||
"""Switch container asset, subset or representation of a container by name.
|
|
||||||
|
|
||||||
It'll always switch to the latest version - of course a different
|
|
||||||
approach could be implemented.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
container (dict): data of the item to switch with
|
|
||||||
asset_name (str): name of the asset
|
|
||||||
subset_name (str): name of the subset
|
|
||||||
representation_name (str): name of the representation
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
if all(not x for x in [asset_name, subset_name, representation_name]):
|
|
||||||
raise ValueError("Must have at least one change provided to switch.")
|
|
||||||
|
|
||||||
# Collect any of current asset, subset and representation if not provided
|
|
||||||
# so we can use the original name from those.
|
|
||||||
project_name = get_current_project_name()
|
|
||||||
if any(not x for x in [asset_name, subset_name, representation_name]):
|
|
||||||
repre_id = container["representation"]
|
|
||||||
representation = get_representation_by_id(project_name, repre_id)
|
|
||||||
repre_parent_docs = get_representation_parents(
|
|
||||||
project_name, representation)
|
|
||||||
if repre_parent_docs:
|
|
||||||
version, subset, asset, _ = repre_parent_docs
|
|
||||||
else:
|
|
||||||
version = subset = asset = None
|
|
||||||
|
|
||||||
if asset_name is None:
|
|
||||||
asset_name = asset["name"]
|
|
||||||
|
|
||||||
if subset_name is None:
|
|
||||||
subset_name = subset["name"]
|
|
||||||
|
|
||||||
if representation_name is None:
|
|
||||||
representation_name = representation["name"]
|
|
||||||
|
|
||||||
# Find the new one
|
|
||||||
asset = get_asset_by_name(project_name, asset_name, fields=["_id"])
|
|
||||||
assert asset, ("Could not find asset in the database with the name "
|
|
||||||
"'%s'" % asset_name)
|
|
||||||
|
|
||||||
subset = get_subset_by_name(
|
|
||||||
project_name, subset_name, asset["_id"], fields=["_id"]
|
|
||||||
)
|
|
||||||
assert subset, ("Could not find subset in the database with the name "
|
|
||||||
"'%s'" % subset_name)
|
|
||||||
|
|
||||||
version = get_last_version_by_subset_id(
|
|
||||||
project_name, subset["_id"], fields=["_id"]
|
|
||||||
)
|
|
||||||
assert version, "Could not find a version for {}.{}".format(
|
|
||||||
asset_name, subset_name
|
|
||||||
)
|
|
||||||
|
|
||||||
representation = get_representation_by_name(
|
|
||||||
project_name, representation_name, version["_id"]
|
|
||||||
)
|
|
||||||
assert representation, ("Could not find representation in the database "
|
|
||||||
"with the name '%s'" % representation_name)
|
|
||||||
|
|
||||||
switch_container(container, representation)
|
|
||||||
|
|
||||||
return representation
|
|
||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def maintained_selection(comp=None):
|
def maintained_selection(comp=None):
|
||||||
"""Reset comp selection from before the context after the context"""
|
"""Reset comp selection from before the context after the context"""
|
||||||
|
|
|
||||||
|
|
@ -287,49 +287,6 @@ def parse_container(tool):
|
||||||
return container
|
return container
|
||||||
|
|
||||||
|
|
||||||
# TODO: Function below is currently unused prototypes
|
|
||||||
def list_instances(creator_id=None):
|
|
||||||
"""Return created instances in current workfile which will be published.
|
|
||||||
Returns:
|
|
||||||
(list) of dictionaries matching instances format
|
|
||||||
"""
|
|
||||||
|
|
||||||
comp = get_current_comp()
|
|
||||||
tools = comp.GetToolList(False).values()
|
|
||||||
|
|
||||||
instance_signature = {
|
|
||||||
"id": "pyblish.avalon.instance",
|
|
||||||
"identifier": creator_id
|
|
||||||
}
|
|
||||||
instances = []
|
|
||||||
for tool in tools:
|
|
||||||
|
|
||||||
data = tool.GetData('openpype')
|
|
||||||
if not isinstance(data, dict):
|
|
||||||
continue
|
|
||||||
|
|
||||||
if data.get("id") != instance_signature["id"]:
|
|
||||||
continue
|
|
||||||
|
|
||||||
if creator_id and data.get("identifier") != creator_id:
|
|
||||||
continue
|
|
||||||
|
|
||||||
instances.append(tool)
|
|
||||||
|
|
||||||
return instances
|
|
||||||
|
|
||||||
|
|
||||||
# TODO: Function below is currently unused prototypes
|
|
||||||
def remove_instance(instance):
|
|
||||||
"""Remove instance from current workfile.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
instance (dict): instance representation from subsetmanager model
|
|
||||||
"""
|
|
||||||
# Assume instance is a Fusion tool directly
|
|
||||||
instance["tool"].Delete()
|
|
||||||
|
|
||||||
|
|
||||||
class FusionEventThread(QtCore.QThread):
|
class FusionEventThread(QtCore.QThread):
|
||||||
"""QThread which will periodically ping Fusion app for any events.
|
"""QThread which will periodically ping Fusion app for any events.
|
||||||
The fusion.UIManager must be set up to be notified of events before they'll
|
The fusion.UIManager must be set up to be notified of events before they'll
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,6 @@ def test_backward_compatibility(printer):
|
||||||
|
|
||||||
from openpype.lib import get_ffprobe_streams
|
from openpype.lib import get_ffprobe_streams
|
||||||
|
|
||||||
from openpype.hosts.fusion.lib import switch_item
|
|
||||||
|
|
||||||
from openpype.lib import source_hash
|
from openpype.lib import source_hash
|
||||||
from openpype.lib import run_subprocess
|
from openpype.lib import run_subprocess
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue