millighost opened this issue on Aug 29, 2011 · 104 posts
FigureSculptor posted Fri, 02 November 2012 at 7:15 PM
Quote - Seems like the new format changes etc pretty much screwed the importer over, am I right? At least when I try to import the genesis.dsf from Studio 4.5 it gives tons of errors.
The problem you're experiencing (I think) is that 4.5 supports two different .dsf versions, one that's the old fashioned JSON text file, and a new compressed file format. Fortunately, the new format is actually nothing more than a file in the old format that's been gzipped. That's easy enough to account for in the scripts. In the four dsf_xxx_load.py files, you can add an import at the top:
import gzip
and then in the load_file method, change the code to un-gzip the data before parsing if the parse operation gives an error, like so:
<span style="font-family:'courier new', courier;"> @classmethod def load_file (self, filename, opts = None): try: jdata = json.load (open (filename, 'r')) except ValueError: f = gzip.open(filename, 'rb') file_content = f.read() decoder = json.JSONDecoder() jdata = decoder.decode(file_content.decode("utf-8")) si_arm = self.get_armature_from_jdata (jdata) return si_arm </span>
You'll have to make the change in four different files (dsf_arm_load, dsf_geom_load, dsf_morph_load, dsf_uvset_load). I've fixed a few other issues with 2.64 and/or DS 4.5, so if Millighost gives the okay, I'll share my revised scripts.
Another change I've made that some people might be interested in is supporting the import of multiple morph targets or uvsets at once. I'm also about 90% done an addition that imports the armature and pose data out of a .duf file (might also work with .dsf - haven't checked). Again, if Millighost gives teh okay, I'll share the revised scripts.