Merge pull request #3707 from pypeclub/feature/OP-3781_TVPaint-as-module

TVPaint: Defined as module
This commit is contained in:
Jakub Trllo 2022-08-23 15:20:21 +02:00 committed by GitHub
commit cd0daa3f98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 51 additions and 35 deletions

View file

@ -1,20 +1,12 @@
import os
from .tvpaint_module import (
get_launch_script_path,
TVPaintModule,
TVPAINT_ROOT_DIR,
)
def add_implementation_envs(env, _app):
"""Modify environments to contain all required for implementation."""
defaults = {
"OPENPYPE_LOG_NO_COLORS": "True"
}
for key, value in defaults.items():
if not env.get(key):
env[key] = value
def get_launch_script_path():
current_dir = os.path.dirname(os.path.abspath(__file__))
return os.path.join(
current_dir,
"api",
"launch_script.py"
)
__all__ = (
"get_launch_script_path",
"TVPaintModule",
"TVPAINT_ROOT_DIR",
)

View file

@ -6,7 +6,6 @@ from . import pipeline
from . import plugin
from .pipeline import (
install,
uninstall,
maintained_selection,
remove_instance,
list_instances,
@ -33,7 +32,6 @@ __all__ = (
"plugin",
"install",
"uninstall",
"maintained_selection",
"remove_instance",
"list_instances",

View file

@ -16,8 +16,6 @@ from openpype.pipeline import (
legacy_io,
register_loader_plugin_path,
register_creator_plugin_path,
deregister_loader_plugin_path,
deregister_creator_plugin_path,
AVALON_CONTAINER_ID,
)
@ -91,19 +89,6 @@ def install():
register_event_callback("application.exit", application_exit)
def uninstall():
"""Uninstall TVPaint-specific functionality.
This function is called automatically on calling `uninstall_host()`.
"""
log.info("OpenPype - Uninstalling TVPaint integration")
pyblish.api.deregister_host("tvpaint")
pyblish.api.deregister_plugin_path(PUBLISH_PATH)
deregister_loader_plugin_path(LOAD_PATH)
deregister_creator_plugin_path(CREATE_PATH)
def containerise(
name, namespace, members, context, loader, current_containers=None
):

View file

@ -0,0 +1,41 @@
import os
from openpype.modules import OpenPypeModule
from openpype.modules.interfaces import IHostModule
TVPAINT_ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
def get_launch_script_path():
return os.path.join(
TVPAINT_ROOT_DIR,
"api",
"launch_script.py"
)
class TVPaintModule(OpenPypeModule, IHostModule):
name = "tvpaint"
host_name = "tvpaint"
def initialize(self, module_settings):
self.enabled = True
def add_implementation_envs(self, env, _app):
"""Modify environments to contain all required for implementation."""
defaults = {
"OPENPYPE_LOG_NO_COLORS": "True"
}
for key, value in defaults.items():
if not env.get(key):
env[key] = value
def get_launch_hook_paths(self, app):
if app.host_name != self.host_name:
return []
return [
os.path.join(TVPAINT_ROOT_DIR, "hooks")
]
def get_workfile_extensions(self):
return [".tvpp"]