Game Development Community

Help, importing suddenly stopped working...Is there a limit to material.cs?

by penbit · in Torque 3D Professional · 10/30/2009 (6:18 pm) · 3 replies

So far I've imported tons dea meshes with multiple materials on without any problems. Today, for some reason they come without materials, with that orange no material map on them.
In that particular folder, I have dozens of meshes, imported without problems so I thought maybe each folder has some limit. Although the material.cs has been updating itself properly. I imported the same mesh to a different folder, first it showed up. Then I imported another mesh, now it doesn't come with materials at all.

I'm completely baffled. The whole art pipeline process was working flawlessly for the whole week, now I can't import anything all of a sudden. No changes on the computer, no new drivers, no plugins touched etc.

I'm sure it's not my models, I'm trying the models I bought, they used to import fine, now they all come without materials. Also after the models comes with that orange no material map, I can't change the map, it doesn't save, it doesn't update.

Update: no matter how many different folders, how many simple boxes, my materials never show up. It magically stopped working!?! Exactly the same folder, with exact same dea meshes with same names and uvmapping showed up yesterday, but not now?





#1
10/30/2009 (11:04 pm)
Could this be a problem with Material name clashes? ie. If you have 2 DAE models (in different folders) that have the same material names, then they will both use the same Torque Material.

As a sanity test, try removing/renaming the relevant materials.cs files so they are not executed (and the Materials are not created), then re-import the DAE models to see if they work.

Also - check the console for suspicious errors/warnings.
#2
10/31/2009 (6:46 am)
Thanks Chris, I actually solved it. Removing material.cs helped but then I had to re-import tons of meshes that reside in the same folder so I had to find what was really causing it.

And now, you're not going to believe what caused the problem:)

It started when I imported a mesh with name "1024groundfloor.dea". So any mesh and material that starts with a "number" actually corrupts that folder's material.cs. After that, any new mesh that has different name like mytestbox doesn't show up with materials in the same folder. Make a new folder, import a mytestbox.dea with materials, it imports fine. But then import a new mesh into that folder with the name 1024box, you can't import anymore into that folder. Deleting the dea with the name that starts with a number doesn't suffice, I had to remove the material definition of that file from material.cs. Strange but true.

I just wanted to name my mesh innocently to indicate the size of units so I could have series of blocks like 256, 512, 1024, heh, I never thought that would be the problem.

Thanks for the reply. I'm generally very happy with collada pipeline, great work:)
#3
11/01/2009 (4:46 pm)
Thanks for the follow-up, penbit. Glad you are back up and running.

Quote:And now, you're not going to believe what caused the problem:)

Actually, this makes a lot of sense (once you know what is going on). The collada loader (in its ongoing attempt to make everything 'just work'), generates Material object names using the following format:

<dae_base_name>_<material_name>

Unfortunately in your case, the dae_base_name part was '1024groundfloor', which produces an invalid TorqueScript object name. Object names must be valid 'C' tokens consist of only alphanumeric characters (A-Z, 0-9, _) and must not start with a number.

As soon as this badly-named object had been added to materials.cs, the script was doomed! :-O T3D would fail to execute the script (you would have seen syntax errors in the console log) and the Materials in that file would not be created (or possibly only the ones after the badly-named one.....not certain).

In any case, this is effectively a bug in the collada loader, which should ensure that the Material names it generates are always valid. I'll have this fixed up for the next release of Torque so you will be able to use whatever naming scheme you like for your DAE files.