HoudiniEngineForUnreal icon indicating copy to clipboard operation
HoudiniEngineForUnreal copied to clipboard

Unable to cook HDA after PIE session

Open haowang1013 opened this issue 3 years ago • 0 comments

Hi,

The plugin has a bug that the Houdini engine ticking is not resumed after PIE, which makes it impossible to cook/build any HDAs afterwards.

Repro steps:

  1. Start the editor, then start PIE immediately.
  2. Close PIE, try to cook/build any HDAs in the project.
  3. Nothing happens.

The bug is in

void FHoudiniEngineEditor::RegisterEditorDelegates()
{
	...
	if (FHoudiniEngine::Get().IsTicking())
	{
		const bool bWasConnected = FHoudiniEngine::Get().GetSessionStatus() == EHoudiniSessionStatus::Connected;
		EndPIEEditorDelegateHandle = FEditorDelegates::EndPIE.AddLambda([&, bWasConnected](const bool bEndPIEIsSimulating)
		{
			if (bWasConnected)
			{
				// If the Houdini session was previously connected, we need to reestablish the connection after PIE.
				// We need to restart the current Houdini Engine Session
				// This will reuse the previous session if it didnt shutdown, or start a new one if needed.
				// (HARS shuts down when stopping the session, so we cant just reconnect when not using Session Sync)
				FHoudiniEngineCommands::RestartSession();
			}
#if 1
			else
			{
				FHoudiniEngine::Get().StartTicking();				
			}
#endif
			FEditorDelegates::EndPIE.Remove(EndPIEEditorDelegateHandle);
		});
	}	
}

So if the houdini engine wasn't connected before PIE, bWasConnected will be false and the plugin will never attempt to resume the ticking when PIE ends. The part within the #if 1/#endif section is my fix and I can veirfy it works.

haowang1013 avatar Feb 15 '22 08:02 haowang1013