microdee/UE4-SpaceMouse

Spacemouse needs new build for UE 5 official Release

aknittel1 opened this issue · 20 comments

Hoping for a new build soon.

yes yes, same link will be replaced when I'll make the build and as before I'll notify people

I'm assuming that every point release of Unreal is going to require you to rebuild this driver, or was this a unique issue with EA and Preview versions of UE 5?

I'm a WIndows developer for many years and I don't understand why this just isn't a DLL that loads independent of the versions of UE? Is there some aspect of the UE development model that is unique to drivers or is this just the way you decided to implement this one? Did the actual interface change to force you to rebuild this? Although I understand development enough, I'm really loathe to have to rebuild UE and add that to my artist list of things to do and I'm sure you are.

I think you mentioned in the releases for the UE EA and previews 1 and 2 that you wished more end users would take over the buld burden, but I don't understand why ANYONE has to do that, including YOU the supplier of the driver.

Can you explain?

As a wise Australian phrase says "Naaah mate, nah mate, na mate"

I agree, I find this aspect of Unreal annoying as well, but Unreal plugins and in turn Unreal modules are not merely dynamic libraries using a plugin interface you can swap around in runtime, and updates are not binary compatible with each-other due to how it's designed. The code you write in Unreal modules can be a lot more intertwined into Engine systems than with a regular plugin interface pattern, mostly thanks to the Unreal reflection and garbage collection system.

This is also because Unreal can decide in build time whether your modules inside your project will be dynamically linked, or statically linked, or if the library files will live on their own or be embedded into the executable, or on some platforms a monolithic library. Because of this massive flexibility Unreal has a thick layer of abstraction on top of exporting/importing as you might imagine.

You might see here that only the source stays the same, but Unreal build tools might generate vastly different binaries according to a lot of circumstances. That's also why Epic ended up designing a system for plugins where distributing source is a lot more convenient than pre-building it for the end user, therefore advocating open-source approach. Even you need to submit only your plugin sources to the Marketplace and Epic will build it themselves for you. The fact that I upload the pre-built binaries to Github as well myself is actually pretty uncharacteristic when it comes to open-source Unreal plugins. I realize I'm behind schedule with UE5 all the time, but that's only because I'm super busy with other projects.

I'm making a pre-built release now as well, but meanwhile you might also see; you can just plop this repository into your Unreal project as a submodule and Unreal Build Tool will pick it up and build it / link it automagically. You said you're a Windows developer, with Unreal stuff this should be a push of a button for you.

Thanks for explaining! Very informative and the "Naaah mate, nah mate, na mate" have me a chuckle. Greatly appreciate your time in this project. 🙏

PreBuilt binaries on Github has been updated for the release version of 5.0.0

David, thanks for both the explanation and the release!

I'm ready to add your git hub source code as a submodule to my project. I assume in UE I'm issuing this command in the UE command line:

git submodule add

Is that it? So does a "submodule" folder get created?

I'm ready to add your git hub source code as a submodule to my project. I assume in UE I'm issuing this command in the UE command line:

git submodule add

Is that it? So does a "submodule" folder get created?

nah na na na the command is right everything else is wrong.

  1. Unreal doesn't know about git, it doesn't have a "command line" (it has an internal console but that's different), and git doesn't know about Unreal. if you want to use git from command line then use regular Windows Powershell. But you might find it easier to use a git GUI, I highly recommend GitExtensions.
  2. On the command line use this
    git submodule add https://github.com/microdee/ue4-spacemouse.git Plugins/SpaceMouse
    I don't know where you got that "submodules folder" nonsense
  3. GitExtensions has a good support of submodules and it's easier to work with them there
  4. But if you're not familiar with git you can just copy sources to a subfolder inside your project plugins folder and call it a day. I've mentioned submodules because once you're familiar with git, they're a pretty handy tool in your version controlling repertoire

This of course requires the project to have source code so Unreal can build the plugin with it. Blueprint only project doesn't work. You can add source code by just creating a C++ class in editor.

HA! Wow all I want to do is pre build your source code with the UE 5 point releases so you don't have to. Isn't following this video and simply downloading your source from the github web site the easiest thing to do? I assume I have to upgrade the engine first and then follow this tutorial for your stuff.

https://www.youtube.com/watch?v=2HHJ6AYnwFw

Yeah if you don't want to do it per-project you can create pre-packaged versions, but as project plugins you don't need to. I wrote a command-line automated workflow for what's inside the video called Nuke.Unreal. That is used in this test project which I also use to make the github releases: https://github.com/microdee/UE4-SpaceMouse-TestProject. Nuke is a build automation and execution engine written in C# which is a whole different can of worms, and it's not at all a commonly used workflow with Unreal actually.

Well, almost there. I guess I just don't understand how UE 5 dev environment is integrating with the dev tools. I installed .net core and the latest dotnet SDK. Do I need to actually install Visual Studio 2019 as well?

I was hoping to avoid all that and expecting UE to have enough internal dev support to just need an SDK and dot net. I really do NOT want to be sucked in to being a UE developer at this level. I'm a creator who happens to be using a plugin that needs to keep pace with the point releases. I want the easiest way to rebuild your plugin that doesn't require me to set up an entire build environment. Is that even possible? Blender does NOT require me to be a Python developer.

The command line I'm using in the C:\Program Files\Epic Games\UE_5.0\Engine\Build\BatchFiles folder is:

runuat BuildPlugin -plugin="D:\Data\Downloads\Browser\SpaceMouse-Win64-1.2.4.5.0.0-Source\SpaceMouse.uplugin" -package="D:\Data\Downloads\Browser\SpaceMouse-Win64-1.2.4.5.0.0-Source\SpaceMouse500Prebuild"

Here's the log

Log started at 4/20/2022 12:41:31 PM (2022-04-20T16:41:31Z)
No config file at H:\OneDrive\Documents\Unreal Engine\UnrealBuildTool\BuildConfiguration.xml
Configuration will be read from:
C:\Users\aknit\AppData\Roaming\Unreal Engine\UnrealBuildTool\BuildConfiguration.xml
Log file: C:\Users\aknit\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+Program+Files+Epic+Games+UE_5.0\UBT-UnrealEditor-Win64-Development.txt

Note: Android toolchain NDK r21b recommended
Command line: "C:\Program Files\Epic Games\UE_5.0\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" UnrealEditor Win64 Development -Project=D:\Data\Downloads\Browser\SpaceMouse-Win64-1.2.4.5.0.0-Source\SpaceMouse500Prebuild\HostProject\HostProject.uproject -plugin=D:\Data\Downloads\Browser\SpaceMouse-Win64-1.2.4.5.0.0-Source\SpaceMouse500Prebuild\HostProject\Plugins\SpaceMouse\SpaceMouse.uplugin -iwyu -noubtmakefiles -manifest=D:\Data\Downloads\Browser\SpaceMouse-Win64-1.2.4.5.0.0-Source\SpaceMouse500Prebuild\HostProject\Saved\Manifest-UnrealEditor-Win64-Development.xml -nohotreload "-log=C:\Users\aknit\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+Program+Files+Epic+Games+UE_5.0\UBT-UnrealEditor-Win64-Development.txt"
ERROR: Platform Win64 is not a valid platform to build. Check that the SDK is installed properly.
BuildException: Platform Win64 is not a valid platform to build. Check that the SDK is installed properly.
at UnrealBuildTool.UEBuildTarget.Create(TargetDescriptor Descriptor, Boolean bSkipRulesCompile, Boolean bForceRulesCompile, Boolean bUsePrecompiled) in d:\build++UE5\Sync\Engine\Source\Programs\UnrealBuildTool\Configuration\UEBuildTarget.cs:line 703
at UnrealBuildTool.BuildMode.CreateMakefile(BuildConfiguration BuildConfiguration, TargetDescriptor TargetDescriptor, ISourceFileWorkingSet WorkingSet) in d:\build++UE5\Sync\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 726
at UnrealBuildTool.BuildMode.Build(List`1 TargetDescriptors, BuildConfiguration BuildConfiguration, ISourceFileWorkingSet WorkingSet, BuildOptions Options, FileReference WriteOutdatedActionsFile, Boolean bSkipPreBuildTargets) in d:\build++UE5\Sync\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 267
at UnrealBuildTool.BuildMode.Execute(CommandLineArguments Arguments) in d:\build++UE5\Sync\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 237
at UnrealBuildTool.UnrealBuildTool.Main(String[] ArgumentsArray) in d:\build++UE5\Sync\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.cs:line 593
WriteFileIfChanged() wrote 0 changed files of 0 requested writes.
Timeline:

[ 0.000]
0.000
[ 0.873]

Let's make sure i'm not going down a rabbit hole I don't need to. You said:

"But if you're not familiar with git you can just copy sources to a subfolder inside your project plugins folder and call it a day."

I already have a plugins folder in every project I have and subfolder called SpaceMouse. In that folder are your prebuilt binaries folders. Are you saying if I downloaded the source version of that instead of the pre-built binaries, UE would just recompile them without me installing any of the DEV support tools (VS, .NET Core, .NET SDK)?

BTW, I don't really want to maintain source in every project folder I have, so whatever answer you give me, can I not just apply it to the plugins folder under where UE is installed (C:\Program Files\Epic Games\UE_5.0\Engine\Plugins) and maintain the source that is compiled in ONE place for ALL projects and delete that spacemouse plugin folder from each separate project? All my projects use the same latest version of UE at any time.

I'm going to make this even simpler. You're mentioning project folders is confusing me. THis is where I have the prebuilt spacemouse plugin:

C:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Spacemouse

You have two files in github: one I downloaded, unzipped and copied into the folder above:

SpaceMouse-Win64-1.2.4.5.0.0-PreBuilt (1).zip

The other file is:

SpaceMouse-Win64-1.2.4.5.0.0-Source.zip

So if I replace the prebuilt files that I have in C:\Program Files\Epic Games\UE_5.0\Engine\Plugins\Spacemouse with the files from source, are you saying that Unreal will automagically rebuild that source whenever I update to the next point release? Example, now they have updated to 5.0.1? Will it do this WITHOUT any of the development environment we just spoke about?

Don't understand why we cant just change the ""EngineVersion"" in your .uplugin file where i placed the prebuilt version to make it "compatible" with UE 5.0.1 ?

"FileVersion": 3,
"Version": 1,
"VersionName": "1.2.4",
"FriendlyName": "SpaceMouse",
"Description": "Control the active editor viewport camera with 3DConnexion SpaceMice",
"Category": "Input Devices",
"CreatedBy": "microdee",
"CreatedByURL": "http://mcro.de",
"DocsURL": "https://github.com/microdee/UE4-SpaceMouse",
"MarketplaceURL": "com.epicgames.launcher://ue/marketplace/product/ad5ae5bca73f4a84a693394a0542fc92",
"SupportURL": "https://github.com/microdee/UE4-SpaceMouse/issues",
"EngineVersion": "5.0.0",
"CanContainContent": false,
"Installed": true,
"Modules": [

Success after installing VS 2022.

Now the only question is in your .plugin source file does the following line need to be set for the target engine?

"EngineVersion": "5.0.0",

In my case with 5.0.1 that just came out:

"EngineVersion": "5.0.1",

Now that I can rebuild your source i'd like to ask a question on optimizing the speed of the pan/scroll/orbit with the "view" out the viewport. Let me explain. Blender's interface seems to "adjust" to how near the nearest object i in the viewport. I can say this empirically, but not having reviewed the Python code it's a guess. Regardless, what I DON'T like about UE, no matter what HID driver (mouse wheel, move mouse) is controlling the viewport when you are very far away from objects in viewport, it takes forever moving away/towards them without adjusting the camera speed. If you are CLOSE to object, orbiting/panning/scrolling should allow for finer control.

What I would like to see and I suspect is implemented in Blender, is a way for the SpaceMouse drive to auto-adjust the camera speed based on how far away the closest object is in the viewport. So if you are orbiting/panning/scrolling a model that is close, you get a finer-grained (slower) orbiting/panning, and conversely if all the objects are far away the opposite would happen: the camera would speed up. I also think as a refinement of this concept that the user should be able to specify a target boundary in from the edges of viewport.

Rather than camera speed, another candidate would be auto-adjusting your Rotations/sec or Translations/sec parameters.

BTW, Blender could just be managing its viewports this way and "accelerating" the movements of whatever the HID is doing. SO I may be wrong about this being the driver doing this. It seems to me that a driver would NOT have access to the semantics of the waht is being shown in the viewport. For all I know there is a setting in UE that controls this.

Is this viable to implement? What scenario would this not work as I've described it?

Wow that was a hard birth,

On the compiler side, you said you're a "Windows developer for many years now" but you didn't have Visual Studio? Were you using Cygwin? It would be an interesting challenge I guess to make Unreal use Cygwin, but as far as I've seen their Windows platform code relies on many compiler intrinsics of MSVC.

Also, of course UE will not provide C++ compilers, that would be insane. No large scale project I've worked with does that. You have to install that on your own. I agree though they could at least guide the user how to install it. On Windows you'll need Visual Studio with C++ for Game Development loadout, but as a Windows Developer™ I thought you already have that.

For the version change, as I mentioned earlier API wise nothing changes between Unreal patches (5.0.0 vs 5.0.1) but ABI wise they change a lot, and I also wrote down in detail why. I also said why that means when you compile from source you have to change nothing (except maybe the version in JSON)

About the camera movement, you can bind increase/decrease camera speed exponent to buttons on your spacemouse. It makes it pretty quick to adjust speed and go through large scale worlds.

<rant>
I don't think so I'll implement a speed based on distance thing, because unintuitively that's very ambiguous, especially your regular large scale scenes in Unreal with lots of objects in them, the official 3DConnexion plugin does it with their unified navigation library, but I don't agree with them :D. I don't like automatic solutions in UX, takes away control and finesse from the user and belittles them. This goes against modern UX paradigms I know, but modern UX in general treats their users like clueless children, voids them any respect and assumes they just wouldn't comprehend the complexity of manually setting a slider or something, or just telling them what's the software actually doing. I know I'm not exactly cash-money-woke with my attitude, but I stand by the term RTFM.
</rant>

"I also said why that means when you compile from source you have to change nothing (except maybe the version in JSON)".

I assume you mean the .plugin file? The ONLY thing UE was complaining about from 5.0ea to 5.0 was a compatibility issue. If NOTHING changed in your source I don't see why we just couldn't have changed the .plugin file to tell UE nothing had changed and that it has been marked as compatible, instead of me going through all the trouble of rebuilding the source, unless I'm missing something.

"EngineVersion": "5.0.0",

In my case with 5.0.1 that just came out:

"EngineVersion": "5.0.1",

I scanned your source and that is the only place a version is mentioned.

I can only repeat myself: #76 (comment)

Source in C++ is not the full story, especially with Unreal, Unreal also has extra tools (Unreal Header/Build Tool) which is run before every build, actually UBT orchestrates the entire build,. but they generate extra source code before giving it to the compiler, mostly for the reflection, but it organizes files into Jumbo/Unity builds as well, These generated files are not API's anymore and not traditionally developer facing, they become part of the Unreal ABI (Application Binary Interface) and that also changes between Unreal patches (5.0.0 -> 5.0.1). This is a fully automatic process, the developer don't need to change their source for this.

I'll close this issue as it's a design flaw of Unreal Engine, and we cannot do anything about it.