Adobe Substance painter integration

I was wondering if anyone has managed to get the latest version of substance painter running now that everything has shifted to Adobe. I have changed the paths in the start up to match the newer software and plugin paths . Yet in the startup.py I keep getting

AttributeError: 'LooseVersion' object has no attribute 'version'

which seems to be deprecated in the later versions of python so not really sure

Figured out how to get it to get to the desktop in the startup.py you have to rework the get_file_info

from win32api import *
def get_file_info(filename):
  
    File_information = GetFileVersionInfo(filename, "\\")
  
    ms_file_version = File_information['FileVersionMS']
    ls_file_version = File_information['FileVersionLS']
  
    return [str(HIWORD(ms_file_version)), str(LOWORD(ms_file_version)),
            str(HIWORD(ls_file_version)), str(LOWORD(ls_file_version))]

and also edit the _find_software to include the changes
executable_version = ".".join(get_file_info(executable_path))
still working out the rest to get it to show up in substance but that’s the first step

the new snag is getting the client to connect

  File "C:/Users/dfult/git/tk-substancepainter/startup/bootstrap.py", line 83, in start_toolkit_classic
    engine = sgtk.platform.start_engine(env_engine, context.sgtk, context)
  File "C:\Users\dfult\AppData\Roaming\Shotgun\reeltv\p551c1684.basic.desktop\cfg\install\core\python\tank\platform\engine.py", line 3012, in start_engine
    return _start_engine(engine_name, tk, None, context)
  File "C:\Users\dfult\AppData\Roaming\Shotgun\reeltv\p551c1684.basic.desktop\cfg\install\core\python\tank\platform\engine.py", line 3172, in _start_engine
    engine = class_obj(tk, new_context, engine_name, env)
  File "C:\Users\dfult\git\tk-substancepainter\engine.py", line 191, in __init__
    Engine.__init__(self, *args, **kwargs)
  File "C:\Users\dfult\AppData\Roaming\Shotgun\reeltv\p551c1684.basic.desktop\cfg\install\core\python\tank\platform\engine.py", line 197, in __init__
    self.pre_app_init()
  File "C:\Users\dfult\git\tk-substancepainter\engine.py", line 447, in pre_app_init
    painter_version_str = self._dcc_app.get_application_version()
  File "C:\Users\dfult\git\tk-substancepainter\python\tk_substancepainter\application.py", line 203, in get_application_version
    version = self.send_and_receive("GET_VERSION")
  File "C:\Users\dfult\git\tk-substancepainter\python\tk_substancepainter\application.py", line 87, in send_and_receive
    return self.send_and_receive.data
AttributeError: 'functools.partial' object has no attribute 'data'

functools.partial does not have a member data. Perhaps they meant partial.args, or the partial was supposed to be evaluated before that.

Found the root of the problem I think
2022-05-04 09:23:57,789 [31168 DEBUG sgtk.core.util.qt_importer] Unable to import module 'QtWebKit': No module named 'PySide2.QtWebKitWidgets
2022-05-04 09:23:57,789 [31168 DEBUG sgtk.core.util.qt_importer] Unable to import module 'QtWebEngineWidgets': module 'PySide2.QtWebEngineWidgets' has no attribute 'QtWebEngineWidgets'

I guess python 3 does not support QtWebEngine gonna try and find a work around for now

with python api being more integrated in Substance painter In going through and making a new engine for it seems to be going ok so far

Check if you can bypass this by setting SHOTGUN_SKIP_QTWEBENGINEWIDGETS_IMPORT in the startup environment.

Might be worth double checking with @Diego_Garcia_Huerta as he probably has this in a near finished state.

Hi there,

Thanks @Halil for pointing out this thread to me!

I have been following closely the updates of the Substance Painter python API and implementing a new engine from scratch for quite a while now, removing the client/server approach that in some cases caused trouble. It is only recently that I considered their python API was more or less on par with their QML/javascript, as initially was missing quite a few crucial features.

@Dfulton1 I think I am 95% there, I just need to do a cleanup pass on the code before I can make it public. I will try to make sometime this week/next week for this.

Cheers,

  • Diego
2 Likes

@Diego_Garcia_Huerta Great to hear I’m almost done with it on my end as well though mine is currently rather basic and needs some UI clean up.