Blender 4.1.1 py3dna DLL load failed #55

Open
opened 2024-07-19 05:46:51 +08:00 by Igameart · 9 comments
Igameart commented 2024-07-19 05:46:51 +08:00 (Migrated from github.com)

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

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](https://github.com/user-attachments/assets/fa26e985-97dd-42e2-8cba-cd9f2f8337bc)
Igameart commented 2024-07-19 06:25:14 +08:00 (Migrated from github.com)

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.

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 commented 2024-08-18 05:57:47 +08:00 (Migrated from github.com)

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.

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 commented 2024-08-18 08:23:12 +08:00 (Migrated from github.com)

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!

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 commented 2024-08-18 14:12:31 +08:00 (Migrated from github.com)

Glad to hear that!

Glad to hear that!
Igameart commented 2024-08-18 15:10:55 +08:00 (Migrated from github.com)

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!

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!
booomji commented 2024-10-30 14:30:47 +08:00 (Migrated from github.com)

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

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 commented 2024-10-30 15:50:23 +08:00 (Migrated from github.com)

The dna viewer won't work in blender out of the box. You've got to write a mesh building script to innterpret the dna as a blender ready mesh. I'm writing one of my own that's partially complete, but it's a lot of work so I'm not releasing it for free lol


From: behram @.>
Sent: Tuesday, October 29, 2024 11:31 PM
To: EpicGames/MetaHuman-DNA-Calibration @.
>
Cc: Chris Legasse @.>; Author @.>
Subject: Re: [EpicGames/MetaHuman-DNA-Calibration] Blender 4.1.1 py3dna DLL load failed (Issue #55)

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


Reply to this email directly, view it on GitHubhttps://github.com/EpicGames/MetaHuman-DNA-Calibration/issues/55#issuecomment-2445977420, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABH7PC5IYQPTH4JN3DS7ONDZ6B4K3AVCNFSM6AAAAABLDPKHB6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBVHE3TONBSGA.
You are receiving this because you authored the thread.Message ID: @.***>

The dna viewer won't work in blender out of the box. You've got to write a mesh building script to innterpret the dna as a blender ready mesh. I'm writing one of my own that's partially complete, but it's a lot of work so I'm not releasing it for free lol ________________________________ From: behram ***@***.***> Sent: Tuesday, October 29, 2024 11:31 PM To: EpicGames/MetaHuman-DNA-Calibration ***@***.***> Cc: Chris Legasse ***@***.***>; Author ***@***.***> Subject: Re: [EpicGames/MetaHuman-DNA-Calibration] Blender 4.1.1 py3dna DLL load failed (Issue #55) 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 — Reply to this email directly, view it on GitHub<https://github.com/EpicGames/MetaHuman-DNA-Calibration/issues/55#issuecomment-2445977420>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABH7PC5IYQPTH4JN3DS7ONDZ6B4K3AVCNFSM6AAAAABLDPKHB6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBVHE3TONBSGA>. You are receiving this because you authored the thread.Message ID: ***@***.***>
booomji commented 2024-10-30 16:27:27 +08:00 (Migrated from github.com)

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

Hey totally understand . Good luck and write back when it's functional. Cheers, b
kalebzaki4 commented 2024-12-19 05:29:04 +08:00 (Migrated from github.com)

omg

omg
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: CGNICO/Metahuman_DNA_Calibration#55
No description provided.