mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
flame: refactory api calls
This commit is contained in:
parent
16d920028c
commit
169b896ef4
15 changed files with 238 additions and 214 deletions
|
|
@ -1,126 +1,5 @@
|
||||||
from .api.utils import (
|
|
||||||
setup
|
|
||||||
)
|
|
||||||
|
|
||||||
from .api.pipeline import (
|
|
||||||
install,
|
|
||||||
uninstall,
|
|
||||||
ls,
|
|
||||||
containerise,
|
|
||||||
update_container,
|
|
||||||
remove_instance,
|
|
||||||
list_instances,
|
|
||||||
imprint,
|
|
||||||
maintained_selection
|
|
||||||
)
|
|
||||||
|
|
||||||
from .api.lib import (
|
|
||||||
FlameAppFramework,
|
|
||||||
maintain_current_timeline,
|
|
||||||
get_project_manager,
|
|
||||||
get_current_project,
|
|
||||||
get_current_sequence,
|
|
||||||
create_bin,
|
|
||||||
create_segment_data_marker,
|
|
||||||
get_segment_data_marker,
|
|
||||||
set_segment_data_marker,
|
|
||||||
set_publish_attribute,
|
|
||||||
get_publish_attribute,
|
|
||||||
get_sequence_segments,
|
|
||||||
maintained_segment_selection,
|
|
||||||
reset_segment_selection,
|
|
||||||
get_segment_attributes
|
|
||||||
)
|
|
||||||
|
|
||||||
from .api.menu import (
|
|
||||||
FlameMenuProjectConnect,
|
|
||||||
FlameMenuTimeline
|
|
||||||
)
|
|
||||||
|
|
||||||
from .api.workio import (
|
|
||||||
open_file,
|
|
||||||
save_file,
|
|
||||||
current_file,
|
|
||||||
has_unsaved_changes,
|
|
||||||
file_extensions,
|
|
||||||
work_root
|
|
||||||
)
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
HOST_DIR = os.path.dirname(
|
HOST_DIR = os.path.dirname(
|
||||||
os.path.abspath(__file__)
|
os.path.abspath(__file__)
|
||||||
)
|
)
|
||||||
API_DIR = os.path.join(HOST_DIR, "api")
|
|
||||||
PLUGINS_DIR = os.path.join(HOST_DIR, "plugins")
|
|
||||||
PUBLISH_PATH = os.path.join(PLUGINS_DIR, "publish")
|
|
||||||
LOAD_PATH = os.path.join(PLUGINS_DIR, "load")
|
|
||||||
CREATE_PATH = os.path.join(PLUGINS_DIR, "create")
|
|
||||||
INVENTORY_PATH = os.path.join(PLUGINS_DIR, "inventory")
|
|
||||||
|
|
||||||
app_framework = None
|
|
||||||
apps = []
|
|
||||||
selection = None
|
|
||||||
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
"HOST_DIR",
|
|
||||||
"API_DIR",
|
|
||||||
"PLUGINS_DIR",
|
|
||||||
"PUBLISH_PATH",
|
|
||||||
"LOAD_PATH",
|
|
||||||
"CREATE_PATH",
|
|
||||||
"INVENTORY_PATH",
|
|
||||||
"INVENTORY_PATH",
|
|
||||||
|
|
||||||
"app_framework",
|
|
||||||
"apps",
|
|
||||||
"selection",
|
|
||||||
|
|
||||||
# pipeline
|
|
||||||
"install",
|
|
||||||
"uninstall",
|
|
||||||
"ls",
|
|
||||||
"containerise",
|
|
||||||
"update_container",
|
|
||||||
"reload_pipeline",
|
|
||||||
"maintained_selection",
|
|
||||||
"remove_instance",
|
|
||||||
"list_instances",
|
|
||||||
"imprint",
|
|
||||||
"maintained_selection",
|
|
||||||
|
|
||||||
# utils
|
|
||||||
"setup",
|
|
||||||
|
|
||||||
# lib
|
|
||||||
"FlameAppFramework",
|
|
||||||
"maintain_current_timeline",
|
|
||||||
"get_project_manager",
|
|
||||||
"get_current_project",
|
|
||||||
"get_current_sequence",
|
|
||||||
"create_bin",
|
|
||||||
"create_segment_data_marker",
|
|
||||||
"get_segment_data_marker",
|
|
||||||
"set_segment_data_marker",
|
|
||||||
"set_publish_attribute",
|
|
||||||
"get_publish_attribute",
|
|
||||||
"get_sequence_segments",
|
|
||||||
"maintained_segment_selection",
|
|
||||||
"reset_segment_selection",
|
|
||||||
"get_segment_attributes"
|
|
||||||
|
|
||||||
# menu
|
|
||||||
"FlameMenuProjectConnect",
|
|
||||||
"FlameMenuTimeline",
|
|
||||||
|
|
||||||
# plugin
|
|
||||||
|
|
||||||
# workio
|
|
||||||
"open_file",
|
|
||||||
"save_file",
|
|
||||||
"current_file",
|
|
||||||
"has_unsaved_changes",
|
|
||||||
"file_extensions",
|
|
||||||
"work_root"
|
|
||||||
]
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,117 @@
|
||||||
"""
|
"""
|
||||||
OpenPype Autodesk Flame api
|
OpenPype Autodesk Flame api
|
||||||
"""
|
"""
|
||||||
|
from .constants import (
|
||||||
|
COLOR_MAP,
|
||||||
|
MARKER_NAME,
|
||||||
|
MARKER_COLOR,
|
||||||
|
MARKER_DURATION,
|
||||||
|
MARKER_PUBLISH_DEFAULT
|
||||||
|
)
|
||||||
|
from .lib import (
|
||||||
|
CTX,
|
||||||
|
FlameAppFramework,
|
||||||
|
maintain_current_timeline,
|
||||||
|
get_project_manager,
|
||||||
|
get_current_project,
|
||||||
|
get_current_sequence,
|
||||||
|
create_bin,
|
||||||
|
create_segment_data_marker,
|
||||||
|
get_segment_data_marker,
|
||||||
|
set_segment_data_marker,
|
||||||
|
set_publish_attribute,
|
||||||
|
get_publish_attribute,
|
||||||
|
get_sequence_segments,
|
||||||
|
maintained_segment_selection,
|
||||||
|
reset_segment_selection,
|
||||||
|
get_segment_attributes
|
||||||
|
)
|
||||||
|
from .utils import (
|
||||||
|
setup
|
||||||
|
)
|
||||||
|
from .pipeline import (
|
||||||
|
install,
|
||||||
|
uninstall,
|
||||||
|
ls,
|
||||||
|
containerise,
|
||||||
|
update_container,
|
||||||
|
remove_instance,
|
||||||
|
list_instances,
|
||||||
|
imprint,
|
||||||
|
maintained_selection
|
||||||
|
)
|
||||||
|
from .menu import (
|
||||||
|
FlameMenuProjectConnect,
|
||||||
|
FlameMenuTimeline
|
||||||
|
)
|
||||||
|
from .plugin import (
|
||||||
|
Creator,
|
||||||
|
PublishableClip
|
||||||
|
)
|
||||||
|
from .workio import (
|
||||||
|
open_file,
|
||||||
|
save_file,
|
||||||
|
current_file,
|
||||||
|
has_unsaved_changes,
|
||||||
|
file_extensions,
|
||||||
|
work_root
|
||||||
|
)
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
# constants
|
||||||
|
"COLOR_MAP",
|
||||||
|
"MARKER_NAME",
|
||||||
|
"MARKER_COLOR",
|
||||||
|
"MARKER_DURATION",
|
||||||
|
"MARKER_PUBLISH_DEFAULT",
|
||||||
|
|
||||||
|
# lib
|
||||||
|
"CTX",
|
||||||
|
"FlameAppFramework",
|
||||||
|
"maintain_current_timeline",
|
||||||
|
"get_project_manager",
|
||||||
|
"get_current_project",
|
||||||
|
"get_current_sequence",
|
||||||
|
"create_bin",
|
||||||
|
"create_segment_data_marker",
|
||||||
|
"get_segment_data_marker",
|
||||||
|
"set_segment_data_marker",
|
||||||
|
"set_publish_attribute",
|
||||||
|
"get_publish_attribute",
|
||||||
|
"get_sequence_segments",
|
||||||
|
"maintained_segment_selection",
|
||||||
|
"reset_segment_selection",
|
||||||
|
"get_segment_attributes",
|
||||||
|
|
||||||
|
# pipeline
|
||||||
|
"install",
|
||||||
|
"uninstall",
|
||||||
|
"ls",
|
||||||
|
"containerise",
|
||||||
|
"update_container",
|
||||||
|
"reload_pipeline",
|
||||||
|
"maintained_selection",
|
||||||
|
"remove_instance",
|
||||||
|
"list_instances",
|
||||||
|
"imprint",
|
||||||
|
"maintained_selection",
|
||||||
|
|
||||||
|
# utils
|
||||||
|
"setup",
|
||||||
|
|
||||||
|
# menu
|
||||||
|
"FlameMenuProjectConnect",
|
||||||
|
"FlameMenuTimeline",
|
||||||
|
|
||||||
|
# plugin
|
||||||
|
"Creator",
|
||||||
|
"PublishableClip",
|
||||||
|
|
||||||
|
# workio
|
||||||
|
"open_file",
|
||||||
|
"save_file",
|
||||||
|
"current_file",
|
||||||
|
"has_unsaved_changes",
|
||||||
|
"file_extensions",
|
||||||
|
"work_root"
|
||||||
|
]
|
||||||
|
|
|
||||||
24
openpype/hosts/flame/api/constants.py
Normal file
24
openpype/hosts/flame/api/constants.py
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenPype Flame api constances
|
||||||
|
"""
|
||||||
|
# OpenPype marker workflow variables
|
||||||
|
MARKER_NAME = "OpenPypeData"
|
||||||
|
MARKER_DURATION = 0
|
||||||
|
MARKER_COLOR = "cyan"
|
||||||
|
MARKER_PUBLISH_DEFAULT = False
|
||||||
|
|
||||||
|
# OpenPype color definitions
|
||||||
|
COLOR_MAP = {
|
||||||
|
"red": (1.0, 0.0, 0.0),
|
||||||
|
"orange": (1.0, 0.5, 0.0),
|
||||||
|
"yellow": (1.0, 1.0, 0.0),
|
||||||
|
"pink": (1.0, 0.5, 1.0),
|
||||||
|
"white": (1.0, 1.0, 1.0),
|
||||||
|
"green": (0.0, 1.0, 0.0),
|
||||||
|
"cyan": (0.0, 1.0, 1.0),
|
||||||
|
"blue": (0.0, 0.0, 1.0),
|
||||||
|
"purple": (0.5, 0.0, 0.5),
|
||||||
|
"magenta": (0.5, 0.0, 1.0),
|
||||||
|
"black": (0.0, 0.0, 0.0)
|
||||||
|
}
|
||||||
|
|
@ -5,30 +5,24 @@ import json
|
||||||
import pickle
|
import pickle
|
||||||
import contextlib
|
import contextlib
|
||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
|
from .constants import (
|
||||||
|
MARKER_COLOR,
|
||||||
|
MARKER_DURATION,
|
||||||
|
MARKER_NAME,
|
||||||
|
COLOR_MAP,
|
||||||
|
MARKER_PUBLISH_DEFAULT
|
||||||
|
)
|
||||||
from openpype.api import Logger
|
from openpype.api import Logger
|
||||||
|
|
||||||
log = Logger().get_logger(__name__)
|
log = Logger.get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class CTX:
|
||||||
|
# singleton used for passing data between api modules
|
||||||
|
app_framework = None
|
||||||
|
apps = []
|
||||||
|
selection = None
|
||||||
|
|
||||||
class ctx:
|
|
||||||
# OpenPype marker workflow variables
|
|
||||||
marker_name = "OpenPypeData"
|
|
||||||
marker_duration = 0
|
|
||||||
marker_color = "cyan"
|
|
||||||
publish_default = False
|
|
||||||
color_map = {
|
|
||||||
"red": (1.0, 0.0, 0.0),
|
|
||||||
"orange": (1.0, 0.5, 0.0),
|
|
||||||
"yellow": (1.0, 1.0, 0.0),
|
|
||||||
"pink": (1.0, 0.5, 1.0),
|
|
||||||
"white": (1.0, 1.0, 1.0),
|
|
||||||
"green": (0.0, 1.0, 0.0),
|
|
||||||
"cyan": (0.0, 1.0, 1.0),
|
|
||||||
"blue": (0.0, 0.0, 1.0),
|
|
||||||
"purple": (0.5, 0.0, 0.5),
|
|
||||||
"magenta": (0.5, 0.0, 1.0),
|
|
||||||
"black": (0.0, 0.0, 0.0)
|
|
||||||
}
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def io_preferences_file(klass, filepath, write=False):
|
def io_preferences_file(klass, filepath, write=False):
|
||||||
|
|
@ -379,7 +373,8 @@ def get_segment_data_marker(segment, with_marker=None):
|
||||||
color = marker.colour.get_value()
|
color = marker.colour.get_value()
|
||||||
name = marker.name.get_value()
|
name = marker.name.get_value()
|
||||||
|
|
||||||
if name == ctx.marker_name and color == ctx.color_map[ctx.marker_color]:
|
if (name == MARKER_NAME) and (
|
||||||
|
color == COLOR_MAP[MARKER_COLOR]):
|
||||||
if not with_marker:
|
if not with_marker:
|
||||||
return json.loads(comment)
|
return json.loads(comment)
|
||||||
else:
|
else:
|
||||||
|
|
@ -443,8 +438,8 @@ def get_publish_attribute(segment):
|
||||||
tag_data = get_segment_data_marker(segment)
|
tag_data = get_segment_data_marker(segment)
|
||||||
|
|
||||||
if not tag_data:
|
if not tag_data:
|
||||||
set_publish_attribute(segment, ctx.publish_default)
|
set_publish_attribute(segment, MARKER_PUBLISH_DEFAULT)
|
||||||
return ctx.publish_default
|
return MARKER_PUBLISH_DEFAULT
|
||||||
|
|
||||||
return tag_data["publish"]
|
return tag_data["publish"]
|
||||||
|
|
||||||
|
|
@ -465,14 +460,15 @@ def create_segment_data_marker(segment):
|
||||||
# create marker
|
# create marker
|
||||||
marker = segment.create_marker(start_frame)
|
marker = segment.create_marker(start_frame)
|
||||||
# set marker name
|
# set marker name
|
||||||
marker.name = ctx.marker_name
|
marker.name = MARKER_NAME
|
||||||
# set duration
|
# set duration
|
||||||
marker.duration = ctx.marker_duration
|
marker.duration = MARKER_DURATION
|
||||||
# set colour
|
# set colour
|
||||||
marker.colour = ctx.color_map[ctx.marker_color] # Red
|
marker.colour = COLOR_MAP[MARKER_COLOR] # Red
|
||||||
|
|
||||||
return marker
|
return marker
|
||||||
|
|
||||||
|
|
||||||
def get_sequence_segments(sequence, selected=False):
|
def get_sequence_segments(sequence, selected=False):
|
||||||
segments = []
|
segments = []
|
||||||
# loop versions in sequence
|
# loop versions in sequence
|
||||||
|
|
@ -485,7 +481,7 @@ def get_sequence_segments(sequence, selected=False):
|
||||||
# loop all segment in remaining tracks
|
# loop all segment in remaining tracks
|
||||||
for segment in track.segments:
|
for segment in track.segments:
|
||||||
# ignore all segments not selected
|
# ignore all segments not selected
|
||||||
if segment.selected != True and selected == True:
|
if segment.selected is not True and selected is True:
|
||||||
continue
|
continue
|
||||||
# add it to original selection
|
# add it to original selection
|
||||||
segments.append(segment)
|
segments.append(segment)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import os
|
import os
|
||||||
from Qt import QtWidgets
|
from Qt import QtWidgets
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
from pprint import pformat
|
||||||
from openpype.tools.utils.host_tools import HostToolsHelper
|
from openpype.tools.utils.host_tools import HostToolsHelper
|
||||||
|
|
||||||
menu_group_name = 'OpenPype'
|
menu_group_name = 'OpenPype'
|
||||||
|
|
@ -26,9 +26,11 @@ default_flame_export_presets = {
|
||||||
|
|
||||||
|
|
||||||
def callback_selection(selection, function):
|
def callback_selection(selection, function):
|
||||||
import openpype.hosts.flame as opflame
|
import openpype.hosts.flame.api as opfapi
|
||||||
opflame.selection = selection
|
opfapi.CTX.selection = selection
|
||||||
print(opflame.selection)
|
print("Hook Selection: \n\t{}".format(
|
||||||
|
pformat({type(item): item.name for item in CTX.selection})
|
||||||
|
))
|
||||||
function()
|
function()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
"""
|
"""
|
||||||
Basic avalon integration
|
Basic avalon integration
|
||||||
"""
|
"""
|
||||||
|
import os
|
||||||
import contextlib
|
import contextlib
|
||||||
from avalon import api as avalon
|
from avalon import api as avalon
|
||||||
from pyblish import api as pyblish
|
from pyblish import api as pyblish
|
||||||
|
|
@ -11,10 +12,18 @@ from .lib import (
|
||||||
maintained_segment_selection,
|
maintained_segment_selection,
|
||||||
get_current_sequence
|
get_current_sequence
|
||||||
)
|
)
|
||||||
|
from .. import HOST_DIR
|
||||||
|
|
||||||
|
API_DIR = os.path.join(HOST_DIR, "api")
|
||||||
|
PLUGINS_DIR = os.path.join(HOST_DIR, "plugins")
|
||||||
|
PUBLISH_PATH = os.path.join(PLUGINS_DIR, "publish")
|
||||||
|
LOAD_PATH = os.path.join(PLUGINS_DIR, "load")
|
||||||
|
CREATE_PATH = os.path.join(PLUGINS_DIR, "create")
|
||||||
|
INVENTORY_PATH = os.path.join(PLUGINS_DIR, "inventory")
|
||||||
|
|
||||||
AVALON_CONTAINERS = "AVALON_CONTAINERS"
|
AVALON_CONTAINERS = "AVALON_CONTAINERS"
|
||||||
|
|
||||||
log = Logger().get_logger(__name__)
|
log = Logger.get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def install():
|
def install():
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,17 @@
|
||||||
import re
|
import re
|
||||||
import os
|
|
||||||
from Qt import QtWidgets, QtCore
|
from Qt import QtWidgets, QtCore
|
||||||
import openpype.api as openpype
|
import openpype.api as openpype
|
||||||
from openpype import style
|
from openpype import style
|
||||||
import openpype.hosts.flame as opflame
|
from . import selection as opfapi_selection
|
||||||
from . import lib, pipeline
|
from . import (
|
||||||
|
lib as flib,
|
||||||
|
pipeline as fpipeline,
|
||||||
|
constants
|
||||||
|
)
|
||||||
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
|
||||||
log = openpype.Logger().get_logger(__name__)
|
log = openpype.Logger.get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class CreatorWidget(QtWidgets.QDialog):
|
class CreatorWidget(QtWidgets.QDialog):
|
||||||
|
|
@ -283,7 +287,7 @@ class Spacer(QtWidgets.QWidget):
|
||||||
class Creator(openpype.Creator):
|
class Creator(openpype.Creator):
|
||||||
"""Creator class wrapper
|
"""Creator class wrapper
|
||||||
"""
|
"""
|
||||||
clip_color = lib.ctx.color_map["purple"]
|
clip_color = constants.COLOR_MAP["purple"]
|
||||||
rename_index = None
|
rename_index = None
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
|
@ -292,13 +296,13 @@ class Creator(openpype.Creator):
|
||||||
"flame"]["create"].get(self.__class__.__name__, {})
|
"flame"]["create"].get(self.__class__.__name__, {})
|
||||||
|
|
||||||
# adding basic current context flame objects
|
# adding basic current context flame objects
|
||||||
self.project = lib.get_current_project()
|
self.project = flib.get_current_project()
|
||||||
self.sequence = lib.get_current_sequence(opflame.selection)
|
self.sequence = flib.get_current_sequence(opfapi_selection)
|
||||||
|
|
||||||
if (self.options or {}).get("useSelection"):
|
if (self.options or {}).get("useSelection"):
|
||||||
self.selected = lib.get_sequence_segments(self.sequence, True)
|
self.selected = flib.get_sequence_segments(self.sequence, True)
|
||||||
else:
|
else:
|
||||||
self.selected = lib.get_sequence_segments(self.sequence)
|
self.selected = flib.get_sequence_segments(self.sequence)
|
||||||
|
|
||||||
self.widget = CreatorWidget
|
self.widget = CreatorWidget
|
||||||
|
|
||||||
|
|
@ -345,10 +349,10 @@ class PublishableClip:
|
||||||
|
|
||||||
# get main parent objects
|
# get main parent objects
|
||||||
self.current_segment = segment
|
self.current_segment = segment
|
||||||
sequence_name = lib.get_current_sequence([segment]).name.get_value()
|
sequence_name = flib.get_current_sequence([segment]).name.get_value()
|
||||||
self.sequence_name = str(sequence_name).replace(" ", "_")
|
self.sequence_name = str(sequence_name).replace(" ", "_")
|
||||||
|
|
||||||
self.clip_data = lib.get_segment_attributes(segment)
|
self.clip_data = flib.get_segment_attributes(segment)
|
||||||
# segment (clip) main attributes
|
# segment (clip) main attributes
|
||||||
self.cs_name = self.clip_data["segment_name"]
|
self.cs_name = self.clip_data["segment_name"]
|
||||||
self.cs_index = int(self.clip_data["segment"])
|
self.cs_index = int(self.clip_data["segment"])
|
||||||
|
|
@ -406,7 +410,7 @@ class PublishableClip:
|
||||||
self.marker_data.update({"reviewTrack": None})
|
self.marker_data.update({"reviewTrack": None})
|
||||||
|
|
||||||
# create pype tag on track_item and add data
|
# create pype tag on track_item and add data
|
||||||
pipeline.imprint(self.current_segment, self.marker_data)
|
fpipeline.imprint(self.current_segment, self.marker_data)
|
||||||
|
|
||||||
return self.current_segment
|
return self.current_segment
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ if not FLAME_V:
|
||||||
raise KeyError("Missing key in environment `OPENPYPE_FLAME_VERSION`")
|
raise KeyError("Missing key in environment `OPENPYPE_FLAME_VERSION`")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from libwiretapPythonClientAPI import (
|
from libwiretapPythonClientAPI import ( # noqa
|
||||||
WireTapClientInit)
|
WireTapClientInit)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
flame_python_path = "/opt/Autodesk/flame_{}/python".format(FLAME_V)
|
flame_python_path = "/opt/Autodesk/flame_{}/python".format(FLAME_V)
|
||||||
|
|
@ -26,7 +26,7 @@ except ImportError:
|
||||||
|
|
||||||
sys.path.append(flame_python_path)
|
sys.path.append(flame_python_path)
|
||||||
|
|
||||||
from libwiretapPythonClientAPI import (
|
from libwiretapPythonClientAPI import ( # noqa
|
||||||
WireTapClientInit,
|
WireTapClientInit,
|
||||||
WireTapClientUninit,
|
WireTapClientUninit,
|
||||||
WireTapNodeHandle,
|
WireTapNodeHandle,
|
||||||
|
|
|
||||||
|
|
@ -5,17 +5,14 @@ from pprint import pformat
|
||||||
import atexit
|
import atexit
|
||||||
import openpype
|
import openpype
|
||||||
import avalon
|
import avalon
|
||||||
import openpype.hosts.flame as opflame
|
import openpype.hosts.flame.api as opfapi
|
||||||
|
|
||||||
flh = sys.modules[__name__]
|
|
||||||
flh._project = None
|
|
||||||
|
|
||||||
|
|
||||||
def openpype_install():
|
def openpype_install():
|
||||||
"""Registering OpenPype in context
|
"""Registering OpenPype in context
|
||||||
"""
|
"""
|
||||||
openpype.install()
|
openpype.install()
|
||||||
avalon.api.install(opflame)
|
avalon.api.install(opfapi)
|
||||||
print("Avalon registred hosts: {}".format(
|
print("Avalon registred hosts: {}".format(
|
||||||
avalon.api.registered_host()))
|
avalon.api.registered_host()))
|
||||||
|
|
||||||
|
|
@ -48,19 +45,19 @@ sys.excepthook = exeption_handler
|
||||||
def cleanup():
|
def cleanup():
|
||||||
"""Cleaning up Flame framework context
|
"""Cleaning up Flame framework context
|
||||||
"""
|
"""
|
||||||
if opflame.apps:
|
if opfapi.CTX.apps:
|
||||||
print('`{}` cleaning up apps:\n {}\n'.format(
|
print('`{}` cleaning up apps:\n {}\n'.format(
|
||||||
__file__, pformat(opflame.apps)))
|
__file__, pformat(opfapi.CTX.apps)))
|
||||||
while len(opflame.apps):
|
while len(opfapi.CTX.apps):
|
||||||
app = opflame.apps.pop()
|
app = opfapi.CTX.apps.pop()
|
||||||
print('`{}` removing : {}'.format(__file__, app.name))
|
print('`{}` removing : {}'.format(__file__, app.name))
|
||||||
del app
|
del app
|
||||||
opflame.apps = []
|
opfapi.CTX.apps = []
|
||||||
|
|
||||||
if opflame.app_framework:
|
if opfapi.CTX.app_framework:
|
||||||
print('PYTHON\t: %s cleaning up' % opflame.app_framework.bundle_name)
|
print('PYTHON\t: %s cleaning up' % opfapi.CTX.app_framework.bundle_name)
|
||||||
opflame.app_framework.save_prefs()
|
opfapi.CTX.app_framework.save_prefs()
|
||||||
opflame.app_framework = None
|
opfapi.CTX.app_framework = None
|
||||||
|
|
||||||
|
|
||||||
atexit.register(cleanup)
|
atexit.register(cleanup)
|
||||||
|
|
@ -69,9 +66,9 @@ atexit.register(cleanup)
|
||||||
def load_apps():
|
def load_apps():
|
||||||
"""Load available apps into Flame framework
|
"""Load available apps into Flame framework
|
||||||
"""
|
"""
|
||||||
opflame.apps.append(opflame.FlameMenuProjectConnect(opflame.app_framework))
|
opfapi.CTX.apps.append(opfapi.FlameMenuProjectConnect(opfapi.CTX.app_framework))
|
||||||
opflame.apps.append(opflame.FlameMenuTimeline(opflame.app_framework))
|
opfapi.CTX.apps.append(opfapi.FlameMenuTimeline(opfapi.CTX.app_framework))
|
||||||
opflame.app_framework.log.info("Apps are loaded")
|
opfapi.CTX.app_framework.log.info("Apps are loaded")
|
||||||
|
|
||||||
|
|
||||||
def project_changed_dict(info):
|
def project_changed_dict(info):
|
||||||
|
|
@ -89,10 +86,10 @@ def app_initialized(parent=None):
|
||||||
Args:
|
Args:
|
||||||
parent (obj, optional): Parent object. Defaults to None.
|
parent (obj, optional): Parent object. Defaults to None.
|
||||||
"""
|
"""
|
||||||
opflame.app_framework = opflame.FlameAppFramework()
|
opfapi.CTX.app_framework = opfapi.FlameAppFramework()
|
||||||
|
|
||||||
print("{} initializing".format(
|
print("{} initializing".format(
|
||||||
opflame.app_framework.bundle_name))
|
opfapi.CTX.app_framework.bundle_name))
|
||||||
|
|
||||||
load_apps()
|
load_apps()
|
||||||
|
|
||||||
|
|
@ -131,15 +128,15 @@ def _build_app_menu(app_name):
|
||||||
|
|
||||||
# first find the relative appname
|
# first find the relative appname
|
||||||
app = None
|
app = None
|
||||||
for _app in opflame.apps:
|
for _app in opfapi.CTX.apps:
|
||||||
if _app.__class__.__name__ == app_name:
|
if _app.__class__.__name__ == app_name:
|
||||||
app = _app
|
app = _app
|
||||||
|
|
||||||
if app:
|
if app:
|
||||||
menu.append(app.build_menu())
|
menu.append(app.build_menu())
|
||||||
|
|
||||||
if opflame.app_framework:
|
if opfapi.CTX.app_framework:
|
||||||
menu_auto_refresh = opflame.app_framework.prefs_global.get(
|
menu_auto_refresh = opfapi.CTX.app_framework.prefs_global.get(
|
||||||
'menu_auto_refresh', {})
|
'menu_auto_refresh', {})
|
||||||
if menu_auto_refresh.get('timeline_menu', True):
|
if menu_auto_refresh.get('timeline_menu', True):
|
||||||
try:
|
try:
|
||||||
|
|
@ -163,8 +160,8 @@ def project_saved(project_name, save_time, is_auto_save):
|
||||||
save_time (str): time when it was saved
|
save_time (str): time when it was saved
|
||||||
is_auto_save (bool): autosave is on or off
|
is_auto_save (bool): autosave is on or off
|
||||||
"""
|
"""
|
||||||
if opflame.app_framework:
|
if opfapi.CTX.app_framework:
|
||||||
opflame.app_framework.save_prefs()
|
opfapi.CTX.app_framework.save_prefs()
|
||||||
|
|
||||||
|
|
||||||
def get_main_menu_custom_ui_actions():
|
def get_main_menu_custom_ui_actions():
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ Flame utils for syncing scripts
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
from openpype.api import Logger
|
from openpype.api import Logger
|
||||||
log = Logger().get_logger(__name__)
|
log = Logger.get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def _sync_utility_scripts(env=None):
|
def _sync_utility_scripts(env=None):
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ from openpype.api import Logger
|
||||||
# )
|
# )
|
||||||
|
|
||||||
|
|
||||||
log = Logger().get_logger(__name__)
|
log = Logger.get_logger(__name__)
|
||||||
|
|
||||||
exported_projet_ext = ".otoc"
|
exported_projet_ext = ".otoc"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import socket
|
||||||
from openpype.lib import (
|
from openpype.lib import (
|
||||||
PreLaunchHook, get_openpype_username)
|
PreLaunchHook, get_openpype_username)
|
||||||
from openpype.hosts import flame as opflame
|
from openpype.hosts import flame as opflame
|
||||||
|
import openpype.hosts.flame.api as opfapi
|
||||||
import openpype
|
import openpype
|
||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
|
|
||||||
|
|
@ -79,7 +80,7 @@ class FlamePrelaunch(PreLaunchHook):
|
||||||
app_arguments = self._get_launch_arguments(data_to_script)
|
app_arguments = self._get_launch_arguments(data_to_script)
|
||||||
|
|
||||||
|
|
||||||
opflame.setup(self.launch_context.env)
|
opfapi.setup(self.launch_context.env)
|
||||||
|
|
||||||
self.launch_context.launch_args.extend(app_arguments)
|
self.launch_context.launch_args.extend(app_arguments)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ from . import utils
|
||||||
import flame
|
import flame
|
||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
|
|
||||||
reload(utils) # noqa
|
reload(utils) # type: ignore
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
import openpype.hosts.flame as opflame
|
import openpype.hosts.flame.api as opfapi
|
||||||
import openpype.hosts.flame.api.plugin as fplugin
|
|
||||||
import openpype.hosts.flame.api.lib as flib
|
reload(opfapi) # noqa
|
||||||
reload(fplugin)
|
|
||||||
reload(flib)
|
|
||||||
|
|
||||||
def _get_video_track_names(sequence):
|
def _get_video_track_names(sequence):
|
||||||
track_names = []
|
track_names = []
|
||||||
|
|
@ -13,7 +12,8 @@ def _get_video_track_names(sequence):
|
||||||
|
|
||||||
return track_names
|
return track_names
|
||||||
|
|
||||||
class CreateShotClip(fplugin.Creator):
|
|
||||||
|
class CreateShotClip(opfapi.Creator):
|
||||||
"""Publishable clip"""
|
"""Publishable clip"""
|
||||||
|
|
||||||
label = "Create Publishable Clip"
|
label = "Create Publishable Clip"
|
||||||
|
|
@ -22,7 +22,7 @@ class CreateShotClip(fplugin.Creator):
|
||||||
defaults = ["Main"]
|
defaults = ["Main"]
|
||||||
|
|
||||||
gui_tracks = _get_video_track_names(
|
gui_tracks = _get_video_track_names(
|
||||||
flib.get_current_sequence(opflame.selection)
|
opfapi.get_current_sequence(opfapi.CTX.selection)
|
||||||
)
|
)
|
||||||
gui_name = "Pype publish attributes creator"
|
gui_name = "Pype publish attributes creator"
|
||||||
gui_info = "Define sequential rename and fill hierarchy data."
|
gui_info = "Define sequential rename and fill hierarchy data."
|
||||||
|
|
@ -267,4 +267,4 @@ class CreateShotClip(fplugin.Creator):
|
||||||
self.rename_index = i
|
self.rename_index = i
|
||||||
|
|
||||||
# convert track item to timeline media pool item
|
# convert track item to timeline media pool item
|
||||||
fplugin.PublishableClip(self, segment, **kwargs).convert()
|
opfapi.PublishableClip(self, segment, **kwargs).convert()
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,10 @@
|
||||||
import os
|
import os
|
||||||
import pyblish.api
|
import pyblish.api
|
||||||
import openpype.hosts.flame as opflame
|
import openpype.hosts.flame.api as opfapi
|
||||||
from openpype.hosts.flame.otio import flame_export as otio_export
|
from openpype.hosts.flame.otio import flame_export as otio_export
|
||||||
from openpype.hosts.flame.api import lib, pipeline
|
|
||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
reload(lib) # noqa
|
reload(opfapi) # type: ignore
|
||||||
reload(pipeline) # noqa
|
reload(otio_export) # type: ignore
|
||||||
reload(otio_export) # noqa
|
|
||||||
|
|
||||||
|
|
||||||
@pyblish.api.log
|
@pyblish.api.log
|
||||||
|
|
@ -20,9 +18,9 @@ class CollectTestSelection(pyblish.api.ContextPlugin):
|
||||||
|
|
||||||
def process(self, context):
|
def process(self, context):
|
||||||
self.log.info(
|
self.log.info(
|
||||||
"Active Selection: {}".format(opflame.selection))
|
"Active Selection: {}".format(opfapi.CTX.selection))
|
||||||
|
|
||||||
sequence = lib.get_current_sequence(opflame.selection)
|
sequence = opfapi.get_current_sequence(opfapi.CTX.selection)
|
||||||
|
|
||||||
self.test_imprint_data(sequence)
|
self.test_imprint_data(sequence)
|
||||||
self.test_otio_export(sequence)
|
self.test_otio_export(sequence)
|
||||||
|
|
@ -43,15 +41,15 @@ class CollectTestSelection(pyblish.api.ContextPlugin):
|
||||||
self.log.info("Otio exported to: {}".format(export_path))
|
self.log.info("Otio exported to: {}".format(export_path))
|
||||||
|
|
||||||
def test_imprint_data(self, sequence):
|
def test_imprint_data(self, sequence):
|
||||||
with lib.maintained_segment_selection(sequence) as selected_segments:
|
with opfapi.maintained_segment_selection(sequence) as sel_segments:
|
||||||
for segment in selected_segments:
|
for segment in sel_segments:
|
||||||
if str(segment.name)[1:-1] == "":
|
if str(segment.name)[1:-1] == "":
|
||||||
continue
|
continue
|
||||||
|
|
||||||
self.log.debug("Segment with OpenPypeData: {}".format(
|
self.log.debug("Segment with OpenPypeData: {}".format(
|
||||||
segment.name))
|
segment.name))
|
||||||
|
|
||||||
pipeline.imprint(segment, {
|
opfapi.imprint(segment, {
|
||||||
'asset': segment.name.get_value(),
|
'asset': segment.name.get_value(),
|
||||||
'family': 'render',
|
'family': 'render',
|
||||||
'subset': 'subsetMain'
|
'subset': 'subsetMain'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue