EpicGames / MetaHuman-DNA-Calibration

https://epicgames.github.io/MetaHuman-DNA-Calibration/
Other
452 stars 118 forks source link

DLL load failed #18

Closed xintang082 closed 1 year ago

xintang082 commented 1 year ago

hi when I tpyed code import dna

import sys sys.moudles["dna"]

it showed

Error: ImportError: file D:/MegaScanLibrary/support/plugins/maya/7.0/MSLiveLink/DHI/lib/Windows/python3\dna.py line 15: DLL load failed: 找不到指定的模块。

my maya version 2022

anyone knows how to fix this , many thanks

smilicev commented 1 year ago

Hi @xintang082,

we have this clash, and we are working on this issue. Current workaround is to add this snippet to your script:

ROOT_DIR = f"{ospath.dirname(ospath.abspath(__file__))}/..".replace("\\", "/")
ROOT_LIB_DIR = f"{ROOT_DIR}/lib"
if platform == "win32":
    LIB_DIR = f"{ROOT_LIB_DIR}/windows"
elif platform == "linux":
    LIB_DIR = f"{ROOT_LIB_DIR}/linux"
else:
    raise OSError(
        "OS not supported, please compile dependencies and add value to LIB_DIR"
    )

# Add bin directory to maya plugin path
if "MAYA_PLUG_IN_PATH" in environ:
    separator = ":" if platform == "linux" else ";"
    environ["MAYA_PLUG_IN_PATH"] = separator.join([environ["MAYA_PLUG_IN_PATH"], LIB_DIR])
else:
    environ["MAYA_PLUG_IN_PATH"] = LIB_DIR

# Adds directories to path
syspath.insert(0, ROOT_DIR)
syspath.insert(0, LIB_DIR)

This snippet is all of our examples.

https://github.com/EpicGames/MetaHuman-DNA-Calibration/blob/5d19123f0c2f3d6b2b80edd11ac19e14fdaf15b8/examples/dnacalib_rename_joint_demo.py#L26

smilicev commented 1 year ago

I will close this issue. If experience similar difficulties please reopen this issue with more details.