x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Skeletal Mesh Import from FBX does not respect materials set if there's no Material ID layer on the mesh

Some DCC packages do not export this layer if there's only one FBX material assigned to the node and all the mesh polygons use that same material. Simple fix in FbxSkeletalMeshImport.cpp:

        if (LayerElementMaterial)
         {
             switch(MaterialMappingMode)
             {
             // material index is stored in the IndexArray, not the DirectArray (which is irrelevant with 2009.1)
             case FbxLayerElement::eAllSame:
                 {    
                     Triangle.MatIndex = MaterialMapping[ LayerElementMaterial->GetIndexArray().GetAt(0) ];
                 }
                 break;
             case FbxLayerElement::eByPolygon:
                 {    
                     int32 Index = LayerElementMaterial->GetIndexArray().GetAt(LocalIndex);                            
                     if (!MaterialMapping.IsValidIndex(Index))
                     {
                         AddTokenizedErrorMessage(FTokenizedMessage::Create(EMessageSeverity::Warning, LOCTEXT("FbxSkeletaLMeshimport_MaterialIndexInconsistency", "Face material index inconsistency - forcing to 0")));
                     }
                     else
                     {
                         Triangle.MatIndex = MaterialMapping[Index];
                     }
                 }
                 break;
             }
         }
         else //if we dont have a material id layer, assume all triangles use the first material
             Triangle.MatIndex = MaterialMapping[0];

The else branch at the end I added fixes the problem.

Also, both the times the _skinXX suffix is removed, the string manipulation is done WRONG. In UnFbx::FFbxImporter::CreateUnrealMaterial line

MaterialFullName = MaterialFullName.LeftChop(Offset+1);

should be

MaterialFullName = MaterialFullName.Left(Offset);

In UnFbx::FFbxImporter::SetMaterialSkinXXOrder line

ImportData.Materials[MaterialIndex].MaterialImportName.LeftChop( Offset );

this line does NOTHING without an assignment operator, and also LeftChop should be just Left, like so

ImportData.Materials[MaterialIndex].MaterialImportName = ImportData.Materials[MaterialIndex].MaterialImportName.Left( Offset );

(if you didn't actually want to remove the SkinXX suffix from the MaterialImportName, just remove this line and comment, as it is confusing)

Product Version: Not Selected
Tags:
more ▼

asked Jul 31 '14 at 01:39 PM in Bug Reports

avatar image

rajkosto
188 24 31 145

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hi rajkosto,

I can send this information to our development team, but I would recommend submitting a pull request on GitHub to have your changes implemented into the Engine.

more ▼

answered Aug 01 '14 at 03:34 PM

avatar image rajkosto Aug 01 '14 at 03:36 PM

Send it, just saying what I needed to do to get my models imported properly.

avatar image Tim C ♦♦ STAFF Aug 07 '14 at 05:52 PM

We were trying to reproduce the original issue that you described, and have not had any success yet. Would you be able to provide the file for a model where this was happening for you and detail the steps you followed to export the model from your modeling software and import it into the Engine?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question