flame: fix wrong selection import

This commit is contained in:
Jakub Jezek 2022-01-07 16:18:11 +01:00
parent d0faab89f9
commit a24b43451d
No known key found for this signature in database
GPG key ID: D8548FBF690B100A
3 changed files with 1 additions and 38 deletions

View file

@ -11,7 +11,6 @@ from .constants import (
from .lib import (
CTX,
FlameAppFramework,
maintain_current_timeline,
get_project_manager,
get_current_project,
get_current_sequence,
@ -68,7 +67,6 @@ __all__ = [
# lib
"CTX",
"FlameAppFramework",
"maintain_current_timeline",
"get_project_manager",
"get_current_project",
"get_current_sequence",

View file

@ -225,40 +225,6 @@ class FlameAppFramework(object):
return True
@contextlib.contextmanager
def maintain_current_timeline(to_timeline, from_timeline=None):
"""Maintain current timeline selection during context
Attributes:
from_timeline (resolve.Timeline)[optional]:
Example:
>>> print(from_timeline.GetName())
timeline1
>>> print(to_timeline.GetName())
timeline2
>>> with maintain_current_timeline(to_timeline):
... print(get_current_sequence().GetName())
timeline2
>>> print(get_current_sequence().GetName())
timeline1
"""
# todo: this is still Resolve's implementation
project = get_current_project()
working_timeline = from_timeline or project.GetCurrentTimeline()
# swith to the input timeline
project.SetCurrentTimeline(to_timeline)
try:
# do a work
yield
finally:
# put the original working timeline to context
project.SetCurrentTimeline(working_timeline)
def get_project_manager():
# TODO: get_project_manager
return

View file

@ -2,7 +2,6 @@ import re
from Qt import QtWidgets, QtCore
import openpype.api as openpype
from openpype import style
from . import selection as opfapi_selection
from . import (
lib as flib,
pipeline as fpipeline,
@ -279,7 +278,7 @@ class Creator(openpype.Creator):
# adding basic current context flame objects
self.project = flib.get_current_project()
self.sequence = flib.get_current_sequence(opfapi_selection)
self.sequence = flib.get_current_sequence(flib.CTX.selection)
if (self.options or {}).get("useSelection"):
self.selected = flib.get_sequence_segments(self.sequence, True)