Cannot use apex cloth in Skeletal Mesh

I have a skeletal mesh with apex cloth in it.

It works fine until I once remove the clothing, and then apply it again, a window like this appears:

121141-cannotusecloth.png

It turned out that these code were added in ApexClothingUtils.cpp:

	// Check the influences on the original chunk to make sure the influences match
	{
		FSkelMeshSection& CheckOriginMeshSection = LODModel.Sections[OriginSectionIndex];
		FSkelMeshChunk& CheckOriginChunk = LODModel.Chunks[CheckOriginMeshSection.ChunkIndex];
		if(CheckOriginChunk.MaxBoneInfluences > MAX_INFLUENCES_PER_STREAM)
		{
			const FText Text = FText::Format(LOCTEXT("Error_TooManyInfluences", "Chunk {0} in Skeletal Mesh {1} has up to {2} influences on it's vertices. The maximum when using cloth is 4, reduce the number of influences and reimport the mesh to allow cloth on this mesh."),
											 FText::AsNumber(CheckOriginMeshSection.ChunkIndex),
											 FText::FromString(SkelMesh->GetName()),
											 FText::AsNumber(CheckOriginChunk.MaxBoneInfluences));

			FMessageDialog::Open(EAppMsgType::Ok, Text);

			// Can't associate, influences don't match
			return false;
		}
	}

I guess this is for cloth blending, and we are not going to use it.

So will deleting these code fix the problem for us? Or should we do anything else to make it work?

Thank you.

Hi Noah,

Removing that code would allow you to import that asset but it is a legitimate error that we unfortunately did not handle in the past. In order for the simulation mesh to work it must be skinned to the skeleton before the simulation step. This is handled for you in the APEX code. We pass in bone transforms and internally APEX calculates the skinning. Fixed vertices take this data outright, but simulated vertices still rely on the skinned ref position so their distance constraints can be updated.

APEX will only support four influences per bone, and will completely ignore anything else on that vertex. Because of this we added in this error because the result of the APEX skinning at more than four influences can be wildly incorrect. Really the best solution is to make sure your clothing section has no verts with more than four influences or you may run into issues.

Let me know if you need more info.

Thanks,

Benn.