I’m hoping you can help me out. I’m using the Merge Meshes blueprint function within the Skeletal Merging Library. It does seem to work in that I see my merged mesh in a PIE environment, but if I double click on the transient mesh I get an engine crash.
I have a more elaborate native function that does more, but comes to the same result.
The reason this happens is that the edit mode toggle check doesn’t check whether the edited mesh has a mesh description, which it relies on. There are potentially 2 bugs here where the mesh merge library doesn’t generate a mesh with a mesh description, and we don’t gate editing in that case.
I have 2 suggestions:
1: Turn off editing on skeletal meshes before opening a transient mesh like this. (Open an already existing mesh and leave editing mode)
2: You can modify SkeletalMeshModelingToolsModule.cpp with the code below.
//Add the include for IPersonaToolkit.h
#include "IPersonaToolkit.h"
//Modify this function.
void FSkeletalMeshModelingToolsModule::CheckEnableEditingToolModeOnOpen(TWeakPtr<ISkeletalMeshEditor> InSkeletalMeshEditor)
{
bool bEditingModeActive = true;
GConfig->GetBool(ConfigSection, ConfigEditingModeActiveKey, bEditingModeActive, GEditorPerProjectIni);
//ADD THIS: Check if skeletal mesh is transient or generated, if not, don't toggle edit mode.
TSharedPtr<ISkeletalMeshEditor> SkeletalMeshEditor = InSkeletalMeshEditor.Pin();
USkeletalMesh* Mesh = SkeletalMeshEditor->GetPersonaToolkit()->GetMesh();
//
if (bEditingModeActive && !IsEditingToolModeActive(InSkeletalMeshEditor) && Mesh->HasMeshDescription(0) //add this final check)
{
OnToggleEditingToolsMode(InSkeletalMeshEditor);
}
}
The downside of the above is that if you switch to edit mode after opening the skeletal mesh, you will still crash because of the missing mesh description.
No, we don’t have a direct flow for that. You would need to expose or add the conversion of static mesh to skeletal mesh to the flow. This is possible, you would want to use FStaticToSkeletalMeshConverter::InitializeSkeletonFromStaticMesh(), but it would be pretty intensive for the mesh merge since it’s synchronous. My recommendation is to pre-convert your static meshes to skeletal meshes for mesh merging. This workflow is frequently requested, so it’s on our radar for the future.
Side note: Because you’re doing a lot of merging, Mutable does merging asynchronously and in a method that allows streaming. Something to keep in mind if you run into perf issues.
I submitted a more complete fix for the first issue that would prevent the crash and also prevent you from accidentally editing the mesh to cause the same crash. You could pull this from:
Thank you [mention removed] , I’ll give the code a try.
I do have another question, but can start a new thread if needed. With doing runtime merging, is there a way to merge a static mesh onto the skeletal mesh also? I see I can turn a static mesh UAsset into skeletal mesh UAsset within the content browser, but for my uses that will result in a whole lot of skeletal meshes. Is there an example of getting a transient skeletal mesh from static mesh at runtime?