STEAM GROUP
Blender Source Tools BleST
STEAM GROUP
Blender Source Tools BleST
196
IN-GAME
1,433
ONLINE
Founded
8 November, 2013
All Discussions > Help > Topic Details
MarioMan 30 May, 2015 @ 8:38am
[FIXED] Import script generates thousands of materials, one per polygon
First of all, thank you for maintaining such a helpful script for the Source engine. It seems that there is a bug in the import script that causes separate material slots to be created for each polygon in a mesh instead of one per actual material in the mesh. I am trying to use this script with Titanfall models. Here is what I'm seeing: http://i.imgur.com/sPzahS6.png
I'm not the only person with the issue. Here is another user that posted the same problem with this tool, likely when importing meshes from a different game: http://blenderartists.org/forum/showthread.php?307815-Remove-1000-materials
Any help would be great. Thanks for reading my post.
Last edited by Artfunkel; 7 Jun, 2015 @ 7:29am
< >
Showing 1-15 of 23 comments
Zappy 30 May, 2015 @ 8:41am 
I've had this happen with a Team Fortress 2 cosmetic or two before (but not many), however I think it's more a fault with the decompiler than the Blender Source Tools (although I admit I didn't check the affected cosmetic meshes in Notepad++, so it could be either).
MarioMan 30 May, 2015 @ 8:43am 
Originally posted by Vintage:
I've had this happen with a Team Fortress 2 cosmetic or two before (but not many), however I think it's more a fault with the decompiler than the Blender Source Tools (although I admit I didn't check the affected cosmetic meshes in Notepad++, so it could be either).
Hmm. Could be. It's just that Crowbar decompiles the model quickly while Blender Source Tools takes forever to run the script on problematic meshes.
Zappy 30 May, 2015 @ 8:46am 
I assume it takes Blender long to import these mega-material-filled meshes because it needs a little time to set up each and every material, and with thousands of materials...
Artfunkel 30 May, 2015 @ 11:33am 
Please upload the file you're trying to import.
ZeqMacaw 30 May, 2015 @ 2:22pm 
Ugh. This might be a problem with the latest Crowbar (0.24), as indicated in this GameBanana thread[tf2.gamebanana.com].

Please upload the original (MDL and related) files for the model that is giving trouble so we can troubleshoot and fix the problem.
ZeqMacaw 30 May, 2015 @ 2:43pm 
I just tested a TF2 model with Crowbar 0.24 and 0.19 using Blender 2.73 with BleST 2.4.1.

The model can be found here in TF2: tf2_misc_dir.vpk -- models\workshop\player\items\medic\robo_medic_physician_mask

With Crowbar 0.24, the full path of the material name is listed in the mesh SMD files (reference and lod1). Example:
models\workshop\player\items\medic\robo_medic_physician_mask\robo_medic_physician_mask

With Crowbar 0.19, only the file name is listed in the mesh SMD files. Example:
robo_medic_physician_mask

I made the change in Crowbar 0.24 to write the full path if that is what was found in the MDL file because that's the data that was used to make the MDL.

My guess is that the full name is being clipped in BleST, but should not be. I am not sure what the length limit is for the material name.
Zappy 30 May, 2015 @ 2:47pm 
Originally posted by ZeqMacaw:
I made the change in Crowbar 0.24 to write the full path if that is what was found in the MDL file because that's the data that was used to make the MDL.
Oh, so that's actually completely intentional. I think it's a stupid change, since $CDMaterials...
Last edited by Zappy; 30 May, 2015 @ 2:47pm
ZeqMacaw 30 May, 2015 @ 2:49pm 
In MDL version 48 studiomdl.exe source code, the length limit seems to be 260 (which probably corresponds to the limit used by Windows).
ZeqMacaw 30 May, 2015 @ 2:51pm 
Originally posted by Vintage:
Originally posted by ZeqMacaw:
I made the change in Crowbar 0.24 to write the full path if that is what was found in the MDL file because that's the data that was used to make the MDL.
Oh, so that's actually completely intentional. I think it's a stupid change, since $CDMaterials...

To avoid other problems and for learning what others actually used to make a model, writing what was actually used to make the MDL seemed best overall.
Artfunkel 30 May, 2015 @ 4:24pm 
The maximum length of a Blender datablock name is 63 bytes of UTF-8, so it's Blender itself doing the trimming.

That also means that it's going to be a pain to import those very long material names properly as Python strings deal with characters, not bytes.

The solution I'm currently in favour of is detecting the common directory at the start of each material name and removing it, which makes Crowbar putting it in a bit pointless. :) Could you possibly stick the common directory into the QC as $cdmaterials instead?
Zappy 31 May, 2015 @ 12:23am 
Originally posted by Artfunkel:
Could you possibly stick the common directory into the QC as $cdmaterials instead?
I agree.

Plus, if you (ZeqMacaw) want to give people what's used to compile the models, you shouldn't include it, since with DMXes, one can set a material directory root (like $CDMaterials, except not used in texture groups), such as models/player/scout/, and then the materials will be named scout_blue for example, which StudioMDL will interpret as models/player/scout/scout_blue even though the material name is only scout_blue. At least I'm fairly certain that's what's going on. Why would people give the full material path as the material name in a modelling tool when also using $CDMaterials and a material root thing, anyway?

If you need me to confirm that material root thing does this, I can try, but I won't do it if you don't ask me to.
Devieus 31 May, 2015 @ 11:48pm 
Originally posted by ZeqMacaw:
Originally posted by Vintage:
Oh, so that's actually completely intentional. I think it's a stupid change, since $CDMaterials...

To avoid other problems and for learning what others actually used to make a model, writing what was actually used to make the MDL seemed best overall.
I've found this actually confuses people more, it's best to use the $cdmaterials for its intended use. I help people on a regular basis, sometimes they fill out the $cdmaterials, but not change the materials on the mesh, then they're surprised the model can't find the textures.
MarioMan 4 Jun, 2015 @ 8:27pm 
Thanks everyone for looking into this. It seems my best best is to simply use an older version of Crowbar. Thanks for all the help and the development of such useful tools.
Artfunkel 7 Jun, 2015 @ 7:31am 
Very long datablock names are now truncated with a warning. This means that all materials on the model this thread is about will end up being the same, but trying to be clever about fixing it didn't seem appropriate.
Zappy 7 Jun, 2015 @ 8:15am 
Truncated, as in cut down to 64(?) characters, or removing anything before a / or \?
< >
Showing 1-15 of 23 comments
Per page: 1530 50

All Discussions > Help > Topic Details
Date Posted: 30 May, 2015 @ 8:38am
Posts: 23