ultraleap / UnrealPlugin

Ultraleap SDK for the Unreal Engine.
263 stars 67 forks source link

Never closing #48

Closed barzorke closed 5 years ago

barzorke commented 5 years ago

The program is never closing. It keep UE4 in the hand task while the project seams to close correctly.

Process: Start with Visual Studio Close Unreal Editor Visual never stops.

Same with package solution.

Happen on ue4 4.20 & 4.21

It seams to come from

void FLeapWrapper::CloseConnection() 
{
    if (!bIsConnected)
    {
        //Not connected, already done
        UE_LOG(LeapMotionLog, Log, TEXT("Attempt at closing an already closed connection."));
        return;
    }
    bIsConnected = false;
    bIsRunning = false;
    CleanupLastDevice();

    //Wait for thread to exit - Blocking call, but it should be very quick.
// This Wait never ends
    ProducerLambdaFuture.Wait();

    //Nullify the callback delegate. Any outstanding task graphs will not run if the delegate is nullified.
    CallbackDelegate = nullptr;

    UE_LOG(LeapMotionLog, Log, TEXT("Connection successfully closed."));
    //CloseConnectionHandle(&connectionHandle);
}
getnamo commented 5 years ago

Duplicate of https://github.com/leapmotion/LeapUnreal/issues/24. This was fixed in https://github.com/leapmotion/LeapUnreal/commit/e8a536d3d1adebfd11feb5f036911a3bd58fd3ec (3.2.2). Seeing as last 4.21 release is before this fix, I went ahead and backported the 4.22 release to 4.21.

You can find the updated release here: https://github.com/leapmotion/LeapUnreal/releases/tag/v3.3.1

barzorke commented 5 years ago

Thanks you very much ! My project is 4.20 for now, is it possible too ?

barzorke commented 5 years ago

Duplicate of #24. This was fixed in e8a536d (3.2.2). Seeing as last 4.21 release is before this fix, I went ahead and backported the 4.22 release to 4.21.

You can find the updated release here: https://github.com/leapmotion/LeapUnreal/releases/tag/v3.3.1

Sorry, the new 4.21 version doesn't work. Hand show/hide at 0.0.0 when hand are in front of the leap, with no animation

getnamo commented 5 years ago

Whoops, just confirmed that the 3.3.1 for 4.21 was bugged. It seems that while I backported the code, the binary assets (.uasset) were modified in 4.22 and didn't load in 4.21 at all.

I've now updated the assets for the 4.21 release, re-download the same release in https://github.com/leapmotion/LeapUnreal/releases/tag/v3.3.1 as the links have been changed to have the correct builds.

Let me know if that release definitely works for you.

barzorke commented 5 years ago

Thanks it works :)

What about a release for 4.20 ? My project is in 4.20, I am just testing in 4.21 to help ^^

z3099644 commented 5 years ago

Since people are asking, I might as well throw my request in the ring for a rev 4.19 version too. =D

I tried putting it into a new 4.19 C++ project and it wouldn't build "LeapTransfer could not be compiled. Try rebuilding from source manually. I tried using RunUAT.bat to compile it and it gave me:

ERROR: System.NotSupportedException: The given path's format is not supported.
          at System.Security.Permissions.FileIOPermission.EmulateFileIOPermissionChecks(String fullPath)
          at System.Security.Permissions.FileIOPermission.QuickDemand(FileIOPermissionAccess access, String fullPath, Boolean checkForDuplicates, Boolean needFullPath)
          at Tools.DotNETCommon.FileReference..ctor(String InPath) in D:\Program Files\Epic Games\UE_4.19\Engine\Source\Programs\DotNETCommon\DotNETUtilities\FileReference.cs:line 23
          at BuildPlugin.ExecuteBuild() in D:\Program Files\Epic Games\UE_4.19\Engine\Source\Programs\AutomationTool\Scripts\BuildPluginCommand.Automation.cs:line 30
          at AutomationTool.BuildCommand.Execute() in D:\Program Files\Epic Games\UE_4.19\Engine\Source\Programs\AutomationTool\AutomationUtils\BuildCommand.cs:line 100
          at AutomationTool.Automation.Execute(List`1 CommandsToExecute, Dictionary`2 Commands) in D:\Program Files\Epic Games\UE_4.19\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:line 557
          at AutomationTool.Automation.Process(String[] Arguments) in D:\Program Files\Epic Games\UE_4.19\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:line 527
          at AutomationTool.Program.MainProc(Object Param) in D:\Program Files\Epic Games\UE_4.19\Engine\Source\Programs\AutomationTool\Program.cs:line 132
          at AutomationTool.InternalUtils.RunSingleInstance(Func`2 Main, Object Param) in D:\Program Files\Epic Games\UE_4.19\Engine\Source\Programs\AutomationTool\AutomationUtils\Utils.cs:line 712
          at AutomationTool.Program.Main() in D:\Program Files\Epic Games\UE_4.19\Engine\Source\Programs\AutomationTool\Program.cs:line 62
       (see D:\Program Files\Epic Games\UE_4.19\Engine\Programs\AutomationTool\Saved\Logs\UAT_Log.txt for full exception trace)

Not sure if that means anything to you? Or am I doing something wrongly?

getnamo commented 5 years ago

Too much changed for an easy backport for 4.20/4.19. A backport isn't in the works, but if you merge https://github.com/leapmotion/LeapUnreal/commit/e8a536d3d1adebfd11feb5f036911a3bd58fd3ec manually to your plugin version, it should work (with the older plugin state).

z3099644 commented 5 years ago

Sorry for being a noob.

I made the highlighted changes to LeapWrapper.cpp (green for new entries and deleted the red lines), but it's still not completely shutting down UE4 when I close the game.

Do I need to compile it or something?

getnamo commented 5 years ago

Correct. Typically you can drop the plugin into an unreal project with c++ and compile the project, the plugin will get compiled along with it. If you only have blueprint projects, make a blank c++ project or follow this guide to convert a blueprint project to c++ https://allarsblog.com/2015/11/04/converting-bp-project-to-cpp/. Once compiled you can copy the newly compiled plugins folder back to the desired project if you used a different project to do the compiling.

z3099644 commented 5 years ago

@getnamo , thanks heaps!

FYI, I was able to get it going in UE4.19.2 by going back to release "v3.2.1 for UE4.21".

I then merged e8a536d manually and, as per some previous instructions that you gave me, added the following lines in LeapMotion.build.cs:

    private string EngineDirectory
    {
        get { return Path.GetFullPath("../"); }
    }

below this place

    private string ModulePath
    {
        get { return ModuleDirectory; }
    }

With these changes the plug in compiled successfully. I'll test it out tomorrow. =)

Thanks again.

z3099644 commented 5 years ago

I tested the build that I described above and unfortunately it stopped leap working in my game altogether.