Markemp / Cryengine-Converter

A c# program to convert Crytek files to Collada (XML) format
https://www.heffaypresents.com/GitHub/
GNU General Public License v2.0
209 stars 53 forks source link

Collada file materials not importing due to spaces on full path #30

Closed draakuns closed 4 years ago

draakuns commented 4 years ago

Hi,

I tried to check why some collada files were not importing the materials, and I just saw something funny...

Collada file:

    <image id="Surface_Diffuse" name="Surface_Diffuse">
      <init_from>/C:\juegos\scuncomp\Data\/objects/spaceships/power_plants/a_and_r/lr-7 uopp/textures/lr-7_uopp_diff.tif</init_from>
    </image>
    <image id="Surface_Specular" name="Surface_Specular">
      <init_from>/C:\juegos\scuncomp\Data\/objects/spaceships/power_plants/a_and_r/lr-7 uopp/textures/lr-7_uopp_spec.tif</init_from>
    </image>
    <image id="Surface_Bumpmap" name="Surface_Bumpmap">
      <init_from>/C:\juegos\scuncomp\Data\/objects/spaceships/power_plants/a_and_r/lr-7 uopp/textures/lr-7_uopp_ddna.tif</init_from>

Collada (in blender) import log:

| input file      : C:\Juegos\scuncomp\Data\Objects\Spaceships\Power_Plants\A_and_R\LR-7 UOPP\LR-7_UOPP.dae
| use units       : no
| autoconnect     : no
+-- Armature Import parameters ----
| find bone chains: no
| min chain len   : 0
| fix orientation : no
| keep bind info  : no
**|! Image not found: C:\juegos\scuncomp\Data\\objects\spaceships\power_plants\a_and_r\lr-7
|! Image not found: C:\juegos\scuncomp\Data\\objects\spaceships\power_plants\a_and_r\lr-7
|! Image not found: C:\juegos\scuncomp\Data\\objects\spaceships\power_plants\a_and_r\lr-7**
Couldn't find an image by UID.
Couldn't find an image by UID.

As you can see, it is loading textures from a non existent path, and starts missing on the space on "lr7 uopp".

But not sure if this is your converter or just a blender issue-limitation, honestly...

Thanks, Draakuns

Markemp commented 4 years ago

This is a Blender limitation. It cannot read the .dds format that SC uses, where the .dds file just contains header info and the .dds.0, dds.1, etc files contain the actual textures. Blender tries to read the dds file and just doesn't recognize the format.

That is why the -tif argument exists. You can convert those dds files to tif format with an image converter, and then the Importer will look for the .tif version of the image file. The reason you are seeing those errors is that the image files weren't converted prior to trying to import into Blender. I'll update the docs to make this a bit more clear, so will leave this issue open until that is done.

draakuns commented 4 years ago

Hey Mark,

unfortunately, I converted every single dds on SC objects dir prior to the cga & cgf convert. I will double check, as I can be so lucky that from 15k DDS files I'm sure I got the model (cherrypicking) that failed dds conversion. Will check that, but what I was trying to show on the code window is that the Collada import seem to fail when the images dir contains spaces.

Anyways, will double check that the files are there, just in case it's a logging issue with the namespaces in Blender.

Will update! Draakuns.

Markemp commented 4 years ago

Oh shoot, I misread the original post. Yes, spaces are a problem in the current app. There might be a way to fix this, so I'll leave this issue open until then.

Markemp commented 4 years ago

I've tracked this down to a bug in Blender. I tried to wrap the path in quotes to see if it could find the file, but it still couldn't handle the spaces. I'm going to open a bug at Blender to see if they can get this fixed.

It's pretty rare for a Cryengine game to have a space in the directory. Almost every game out there uses underscores. No idea why SC had to be different on this particular folder. :(

Markemp commented 4 years ago

I think I got this fixed. Found a bug in the program. It will be updated as part of the 1.0.6 release.

Markemp commented 4 years ago

Fixed in 1.0.6.

draakuns commented 4 years ago

Thanks @Markemp It was only needed for a few SC files, but was an overall problem anyways...

Thanks again!