Format conversion

If you have problems understanding something or getting started, ask here

Moderator: joepal

Format conversion

Postby learning » Sun Sep 20, 2015 9:13 pm

I post here cause it's a newbie question, but I really wanna know: is there a way to convert formats of MH assets (clothes/hairs) between .npz and .obj+.mhclo formats? Is it at all possible to scavenge the .obj and .mhclo files from .npz? Maybe there is some script or something?

On a related note, is it possible to stop MH from making .npz files for some or all assets? This conversion has a chance to screw everything up and it does no good at all. We would be better off if we could just turn it off.
learning
 
Posts: 317
Joined: Mon Feb 24, 2014 9:36 am

Re: Format conversion

Postby duststorm » Mon Sep 21, 2015 7:57 am

It appears there is a bug that pops up sometimes in npz conversion or loading of those files, but I have not yet had the time to investigate it.
No, currently there is no tool to convert binary back to ascii files, though it is possible to do using the API. But the original files are never deleted when conversion happens.
If you put proxy files in the makehuman installation folder, it will never automatically compile them, only those in your home folder.

As for a disable feature: work is better spent in fixing the bug than disabling the binary format.
MakeHuman™ developer
User avatar
duststorm
 
Posts: 2569
Joined: Fri Jan 27, 2012 11:57 am
Location: Belgium

Re: Format conversion

Postby ThomasL » Mon Sep 21, 2015 12:53 pm

It seems like the .mhpxy and .npz files are really zip archives, so if you change the file extension you should be able to extract the files. Unfortunately, this is of little help, because the archives extract to .npy files which do not seem to be any of the usual archive formats.

Alternatively, you can load the clothing in MH and export as a mhx2 (= json) file. The proxy seed mesh and the fitting data are there in ascii format.
ThomasL
 
Posts: 1139
Joined: Tue Sep 15, 2009 2:46 am

Re: Format conversion

Postby learning » Mon Sep 21, 2015 10:08 pm

duststorm wrote:No, currently there is no tool to convert binary back to ascii files, though it is possible to do using the API. But the original files are never deleted when conversion happens.

How difficult is it to do? Can you point me to any info that'd help me devise such a tool? I kinda need it.


duststorm wrote:As for a disable feature: work is better spent in fixing the bug than disabling the binary format.

Can we have both? I'm sure there is some use of .npz I don't know about (proprietary assets, maybe?), but personally I see no reason for them at all. This binary format autoconversion does nothing for me apart for causing trouble. I end up resorting to a hack of disabling write permissions in certain folder to block the binary files from spawning.

ThomasL wrote:It seems like the .mhpxy and .npz files are really zip archives, so if you change the file extension you should be able to extract the files. Unfortunately, this is of little help, because the archives extract to .npy files which do not seem to be any of the usual archive formats.

Yeah, I know what they are. I'm one of the people who see the world through Linux console:

Code: Select all
$ file worksuit.npz
worksuit.npz: Zip archive data, at least v2.0 to extract

$ unzip -l worksuit.npz
Archive:  worksuit.npz
  Length      Date    Time    Name
---------  ---------- -----   ----
    34296  2015-04-15 22:54   texco.npy
       99  2015-04-15 22:54   fgstr.npy
    55968  2015-04-15 22:54   fvert.npy
   120496  2015-04-15 22:54   vface.npy
    45236  2015-04-15 22:54   coord.npy
       84  2015-04-15 22:54   fgidx.npy
     3843  2015-04-15 22:54   nfaces.npy
     7066  2015-04-15 22:54   group.npy
    55968  2015-04-15 22:54   fuvs.npy
---------                     -------
   323056                     9 files

$ file texco.npy
texco.npy: data


This all doesn't help too much/at all. I need a way to convert this data format (numpy?) back into plain text.
learning
 
Posts: 317
Joined: Mon Feb 24, 2014 9:36 am

Re: Format conversion

Postby duststorm » Tue Sep 22, 2015 1:51 pm

learning wrote:
duststorm wrote:No, currently there is no tool to convert binary back to ascii files, though it is possible to do using the API. But the original files are never deleted when conversion happens.

How difficult is it to do? Can you point me to any info that'd help me devise such a tool? I kinda need it.

If you look at the compile_proxies and compile_meshes.py scripts, you'd have to do the same thing, only the opposite. Open the proxy file, then call the saveTextProxy() method, same for the mesh.
MakeHuman™ developer
User avatar
duststorm
 
Posts: 2569
Joined: Fri Jan 27, 2012 11:57 am
Location: Belgium

Re: Format conversion

Postby real_eyes » Mon Oct 05, 2015 6:26 am

duststorm wrote:If you look at the compile_proxies and compile_meshes.py scripts, you'd have to do the same thing, only the opposite. Open the proxy file, then call the saveTextProxy() method, same for the mesh.


I have looked at the compile_proxies.py and proxy.py source and cannot find a saveTextProxy() method. do i have to write one? or am I looking in the wrong place?
real_eyes
 
Posts: 2
Joined: Wed Sep 23, 2015 1:12 pm

Re: Format conversion

Postby duststorm » Mon Oct 05, 2015 2:17 pm

real_eyes wrote:I have looked at the compile_proxies.py and proxy.py source and cannot find a saveTextProxy() method. do i have to write one? or am I looking in the wrong place?

Indeed, it appears that this method does not exist yet.
If you write it, feel free to offer it to the project as a bitbucket pull request (or attach a patch to the forum) :)
MakeHuman™ developer
User avatar
duststorm
 
Posts: 2569
Joined: Fri Jan 27, 2012 11:57 am
Location: Belgium

Re: Format conversion

Postby learning » Mon Oct 05, 2015 9:44 pm

I am lost. How does MH compile them in the first place then?
learning
 
Posts: 317
Joined: Mon Feb 24, 2014 9:36 am

Re: Format conversion

Postby duststorm » Tue Oct 06, 2015 10:44 am

I just fixed the bug in the binary format, so I suppose all of this is no longer necessary.
cfr: http://bugtracker.makehumancommunity.org/issues/962
MakeHuman™ developer
User avatar
duststorm
 
Posts: 2569
Joined: Fri Jan 27, 2012 11:57 am
Location: Belgium

Re: Format conversion

Postby learning » Wed Oct 07, 2015 12:47 am

That's great, but I would still like a decompiler or some guidance on how to make one though.
learning
 
Posts: 317
Joined: Mon Feb 24, 2014 9:36 am


Return to Newbies

Who is online

Users browsing this forum: No registered users and 3 guests

cron