ue将插件安装到指定目录中


from functools import partial
import unreal
import sys
import os

scripts_dir = 'D:/work/dcc_scripts/'
python_path = [
               scripts_dir + 'packages',
               scripts_dir + 'unreal_scripts'    
               ]
if unreal.SystemLibrary.get_engine_version().startswith('5.4'):
    python_path.append(scripts_dir + 'unreal_scripts/packages-5.4')
    os.environ['UE_ADDITIONAL_PLUGIN_PATHS'] = 'D:/Users/Documents/UnrealEngine/Plugins;D:/Users/Documents/UnrealEngine/Plugins/UE5.4;'
elif unreal.SystemLibrary.get_engine_version().startswith('5.2'):
    python_path.append(scripts_dir + 'unreal_scripts/packages-5.2')
    os.environ['UE_ADDITIONAL_PLUGIN_PATHS'] = 'D:/Users/Documents/UnrealEngine/Plugins;D:/Users/Documents/UnrealEngine/Plugins/UE5.2;'

for path in python_path:
    if path not in sys.path:
        sys.path.insert(0, path)


from qss_dir import qdarkstyle
from Qt import QtWidgets, __binding__
from zy_unreal_utils import create_menu
import pyblish.api as api
api.register_host('unreal')


def __QtAppTick__(delta_seconds):
    QtWidgets.QApplication.sendPostedEvents()


if __name__ == '__main__':
    create_menu.main()
    unreal_app = QtWidgets.QApplication.instance()
    if not unreal_app:
        unreal_app = QtWidgets.QApplication([])
        unreal_app.setStyleSheet(qdarkstyle.load_stylesheet(
            qt_api=__binding__))
        tick_handle = unreal.register_slate_post_tick_callback(__QtAppTick__)
        __QtAppQuit__ = partial(
            unreal.unregister_slate_post_tick_callback, tick_handle)
        unreal_app.aboutToQuit.connect(__QtAppQuit__)


评论
  目录