Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blender 4.1.1 py3dna DLL load failed #55

Open
Igameart opened this issue Jul 18, 2024 · 8 comments
Open

Blender 4.1.1 py3dna DLL load failed #55

Igameart opened this issue Jul 18, 2024 · 8 comments

Comments

@Igameart
Copy link

Please don't crucify me for posting this, but I'm trying to use the python cmd version of dna/dnacalib in blender but I need to know if it's even possible in the first place. I cannot afford maya, and the MetaPipe and MetaTransfer tools are both expensive so I am trying to create a low cost alternative for blender.

My addon contains a folder called dnacalib, which contains the x64 release builds of dnacalib, which I built myself in python 3.10.

I have the following lines at the top of my addon script:

current_dir = os.path.dirname(os.path.abspath(__file__))
dnacalib_dir = os.path.join(current_dir, 'dnacalib')

sys.path.append(dnacalib_dir)
try:
    import _py3dnacalib
except ImportError as e:
    print(f"Failed to import _py3dnacalib: {e}")

try:
    from dna import DataLayer_All, FileStream, Status, BinaryStreamReader, JSONStreamWriter
except ImportError as e:
    print(f"Failed to import from dna: {e}")

Attempting to import these gives me the following error 100% of the time:

Failed to import _py3dnacalib: DLL load failed while importing _py3dnacalib: The specified module could not be found.
Failed to import from dna: DLL load failed while importing _py3dna: The specified module could not be found.

I am new to python, new to writing blender addons, and new to working with MetaHuman DNA. But already, I've got an addon that can retarget a rig and geometries from a base metahuman mesh, to a modified mesh with the same topology.
image

@Igameart
Copy link
Author

Igameart commented Jul 18, 2024

Okay, new development. I realized I may have compiled with the wrong python version, which I did. I recompiled it with version 3.11.7, which matches my blender environment, now I am getting a new error:

NameError: file /dna/lib/window/dna.py line 359: name 'FileStream_create' is not defined

EDIT:
So, the solution I found, was to open up dna.py, look for every instance of __new__decorator(, and insert _py3dna. before the first argument of every occurrence.

To test that everything is working, I loaded a sample dna, then saved it as a readable json, all from within blender, and it worked. Not sure if this issue needs closing, because I did have to make changes to dna.py to make this function.

@n0phx
Copy link

n0phx commented Aug 17, 2024

Please try again with the latest release, the above mentioned problem with FileStream_create was due to the used Swig version for the build. Earlier only Swig 4.0.x was supported, now the latest release also works on 4.1.x. In any case, this should no longer happen.

@Igameart
Copy link
Author

Igameart commented Aug 18, 2024

I'm going to try this shortly. My current solution requires a custom build of dnacalib, and I don't know if I'm allowed to share that with my tool once it's released, so if this fixes it that would be awesome.

EDIT:
Okay, so that did in fact fix the problem. Thank you!

@n0phx
Copy link

n0phx commented Aug 18, 2024

Glad to hear that!

@Igameart
Copy link
Author

Yep! The addon now clones the repo, builds the source with cmake, then copies each compiled element into a folder the addon can access. So I no longer have to worry about sharing custom builds and potentially violating the terms of service.

Thanks for the fix!

@EpicGames EpicGames deleted a comment from kalebzaki4 Oct 10, 2024
@booomji
Copy link

booomji commented Oct 30, 2024

Hey do you have an getting started tutorial on this ?
If I clone your repo how can I get the dna viewer to show up in blender ? Cant wait to get this working.

Cheers,
b

@Igameart
Copy link
Author

Igameart commented Oct 30, 2024 via email

@booomji
Copy link

booomji commented Oct 30, 2024

Hey totally understand . Good luck and write back when it's functional.
Cheers,
b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants