Steve_Yorkshire Posted July 24 Share Posted July 24 Default Torque 4.x material importer was making non-suffix (myMaterial) materials if a suffix (myMaterial_mat) already existed, rather than using the existing one. This is because on import it only checks for the material name (myMaterial), if the name is not found it defaults to making a material with the suffix (myMaterial_mat). However when checking if a material exists, it ONLY looks for non-suffix, and once it has decided the material does not exist and needs to be created, ONLY THEN does it look for suffix (_mat), and if it finds it, it will NOT use it, because it has already decided a NEW material must be created. This leads to problems with editing one material when the other exists, with 2 matierals now pointing to mapTo="myMaterial"; In source/T3D/assets/assetImporter.cpp ~line 1723 in ProcessMaterialAsset function: //... bool foundExistingMaterial = false; if (activeImportConfig->UseExistingMaterials) { if (activeImportConfig->AlwaysAddMaterialSuffix)//yorks start { StringTableEntry suffix = activeImportConfig->AddedMaterialSuffix;// .c_str(); char buf[1024]; dSprintf(buf, sizeof(buf), "%s%s", assetName, suffix); //Con::printf("buffer= %s", buf); assetName = buf; }//yorks end //check to see if the definition for this already exists StringTableEntry existingMatAsset = MaterialAsset::getAssetIdByMaterialName(StringTable->insert(assetName)); if (existingMatAsset != StringTable->EmptyString() && existingMatAsset != StringTable->insert("Core_Rendering:NoMaterial")) //... Now it checks if the suffix material already exists BEFORE it decides whether a new one should be created, and only if the active import configuration wants it to use the suffix (_mat). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.