Trying to view transient skeletal merged mesh crashes engine

Hi,

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.

I am running 5.7.4-51

Thanks for any advice.

Russell

[Attachment Removed]

Steps to Reproduce
Enable Skeletal Merging Plugin

Setup a simple merge of two meshes during begin play.

Apply the merged mesh to a skeletal mesh component on that actor.

In the details panel double click on the newly merged mesh to open it in the Mesh Editor panel.

Crash

[Attachment Removed]

Hey there,

Thanks for raising this. I’ve logged an issue you can follow here: https://issues.unrealengine.com/issue/UE-372252 it can take a bit for it to appear.

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.

Dustin

[Attachment Removed]

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.

[Attachment Removed]

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:

https://github.com/EpicGames/UnrealEngine/commit/d9358e5a97915716a7d8282c8d625b019238f890

Dustin

[Attachment Removed]

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?

Thanks,

Russ

[Attachment Removed]

Dustin,

Thanks for all the information.

Russ

[Attachment Removed]