Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Resolve: Match folder structure to other hosts #3653

Conversation

iLLiCiTiT
Copy link
Member

@iLLiCiTiT iLLiCiTiT commented Aug 11, 2022

Brief description

Make sure that code related to in-DCC logic is not imported in main host directory. This change gives ability to have resolve as module which is not possible at the moment.

Description

Changed all import to point directly to function locations or to openpype.hosts.resolve.api instead of openpype.hosts.resolve. Moved setup function from in-DCC functions to public code because is used in prelaunch hook.

Additional info

I don't have resolve so all changes are made blindly, please report any issues. Current structure would block development of some features thus this changes are needed to move on.

There is a lot of script files that seems to be duplicated or not used, we should consider remove those unused.

Testing notes:

  1. Resolve should work at least the same as before this PR

Resolves #3406

@ynbot
Copy link
Contributor

ynbot commented Aug 11, 2022

@iLLiCiTiT iLLiCiTiT self-assigned this Aug 11, 2022
work_root
)

from .testing_utils import TestGUI
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

module level import not at top of file

PublishClip
)

from .workio import (
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

module level import not at top of file


from .menu import launch_pype_menu

from .plugin import (
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

module level import not at top of file

get_reformated_path
)

from .menu import launch_pype_menu
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

module level import not at top of file

list_instances
)

from .lib import (
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

module level import not at top of file

get_resolve_module
)

from .pipeline import (
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

module level import not at top of file

API_DIR = os.path.dirname(os.path.abspath(__file__))
HOST_DIR = os.path.dirname(API_DIR)
PLUGINS_DIR = os.path.join(HOST_DIR, "plugins")
from .utils import (
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

module level import not at top of file

@iLLiCiTiT iLLiCiTiT added host: Resolve type: refactor Structural changes not affecting functionality labels Aug 11, 2022
@jrsndl
Copy link
Collaborator

jrsndl commented Aug 15, 2022

I would love to check, but I am not able to make the Resolve work. Attempt to run Openpype_Menu script stops at importing OTIO:

    from opentimelineio import opentime
  File "C:\Users\robur\OpenPype\.venv\Lib\site-packages\opentimelineio\__init__.py", line 35, in <module>
    from . import (
  File "C:\Users\robur\OpenPype\.venv\Lib\site-packages\opentimelineio\opentime.py", line 1, in <module>
    from . _opentime import ( # noqa
ModuleNotFoundError: No module named 'opentimelineio._opentime'

Resolve 17.4.6 build 4
Python 3.6
Windows 10

@jakubjezek001
Copy link
Member

I would love to check, but I am not able to make the Resolve work. Attempt to run Openpype_Menu script stops at importing OTIO:

    from opentimelineio import opentime
  File "C:\Users\robur\OpenPype\.venv\Lib\site-packages\opentimelineio\__init__.py", line 35, in <module>
    from . import (
  File "C:\Users\robur\OpenPype\.venv\Lib\site-packages\opentimelineio\opentime.py", line 1, in <module>
    from . _opentime import ( # noqa
ModuleNotFoundError: No module named 'opentimelineio._opentime'

Resolve 17.4.6 build 4
Python 3.6
Windows 10

You have to install OpenTimelineIO separately into p3.6. The process should be explained in documentation I believe.

@jakubjezek001
Copy link
Member

@iLLiCiTiT please also fix the pep8 before the merge ;)

@iLLiCiTiT
Copy link
Member Author

please also fix the pep8 before the merge ;)

I can't. It's because the imports are after definition of bmdvr and bmdvf, but they must be defined before those imports because are replaced during that time. To fix it I would have to move those global variables elsewhere and change all related imports.

@iLLiCiTiT iLLiCiTiT merged commit e0a31da into develop Aug 17, 2022
@iLLiCiTiT iLLiCiTiT deleted the feature/OP-3455_Resolve-Match-folder-structure-to-other-hosts branch August 17, 2022 16:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
host: Resolve type: refactor Structural changes not affecting functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Resolve: Match folder structure to other hosts
4 participants