pyblish / pyblish-qml

Pyblish QML frontend for Maya 2013+, Houdini 11+, Nuke 8+ and more
GNU Lesser General Public License v3.0
114 stars 44 forks source link

QML window within Maya opening but without GUI #378

Open Illogicstudios opened 1 year ago

Illogicstudios commented 1 year ago

I have a code to launch a qml window with my plugins stored in a folder "plugins". The problem is that the gui that supposed to be in the qml qindow isn't showing. The plugins seems to work how they supposed to be. Here's the code :

import os
import sys
import importlib
import pyblish.api
import pyblish_maya
import pyblish_qml
from pyblish_qml import api as qml_api

import pyblish_test

# Dependencies
qml_api.register_python_executable(r"C:\Program Files\Autodesk\Maya2022\bin\mayapy.exe")
qml_api.register_pyqt5(r"R:\pipeline\networkInstall\python_lib\PyQt5")

# Plugins
pyblish.api.deregister_all_paths()
pyblish.api.register_target("test_target")
pyblish.api.register_plugin_path(os.path.join(os.path.dirname(pyblish_test.__file__), "plugins"))

# GUI
pyblish.api.register_gui("pyblish_qml")
pyblish_qml.settings.WindowTitle="Pyblish Test"
pyblish_qml.settings.HiddenSections = []
pyblish_maya.show()

Here's the logs :

https://github.com/pyblish/pyblish-qml/assets/117286626/b924a71c-cb77-4c2d-8b46-423594d66dbf

I'm on Maya 2022 with Python 3.7.7. Here's my packages : image

mottosso commented 1 year ago

Try removing this line.

qml_api.register_pyqt5(r"R:\pipeline\networkInstall\python_lib\PyQt5")

mayapy already has PySide2 which should be enough.

Then try adding your plug-ins to PYBLISHPLUGINPATH before launching Maya.

set PYBLISHPLUGINPATH=c:\my\plugins

If that works, you can try launching Maya first and adding it both via pyblish.api and PYBLISHPLUGINPATH. Since QML is running in a separate mayapy, it doesn't know about what gets registered inside of the Maya GUI. It only knows what's in the environment, like PYBLISHPLUGINPATH. Both Maya GUI and the external mayapy needs to know the path to your plug-ins.

import os
plugins = os.path.join(os.path.dirname(pyblish_test.__file__), "plugins")
os.environ["PYBLISHPLUGINPATH"] = plugins
pyblish.api.register_plugin_path(plugins)
Illogicstudios commented 1 year ago

Setting the env var for Maya GUI and for mayapy doesn't seem to change something. The plugins are found and the collector is executed (some logs are here).

Here's my adapted code :

set PYBLISHPLUGINPATH=C:\Users\m.jenin\Documents\marius\pyblish_test\plugins

from common import utils import pyblish_test

from pyblish_qml import api as qml_api

Dependencies

qml_api.register_python_executable(r"C:\Program Files\Autodesk\Maya2022\bin\mayapy.exe")

qml_api.register_pyqt5(r"R:\pipeline\networkInstall\python_lib\PyQt5")

Plugins

pyblish.api.deregister_all_paths() pyblish.api.register_target("test_target") plugins = os.path.join(os.path.dirname(pyblish_test.file), "plugins") os.environ["PYBLISHPLUGINPATH"] = plugins pyblish.api.register_plugin_path(plugins)

GUI

pyblish.api.register_gui("pyblish_qml") pyblish_qml.settings.WindowTitle="Pyblish Test" pyblish_qml.settings.HiddenSections = [] pyblish_maya.show()

Illogicstudios commented 1 year ago

Also pyblish_lite works well. It seems to be an UI problem