[RESOLVED] Camera PDK Troubles

jake_lm
Posts: 12
Joined: Thu May 04, 2017 1:21 pm

[RESOLVED] Camera PDK Troubles

Postby jake_lm » Tue Aug 08, 2017 7:00 pm

Hello,

I have been trying to setup the camera PDK sample with Visual Studio but I am having trouble. So far I have been able to build the cameraPDK sample and get a DLL file, where I then put it into the AppData/Roaming/Lockheed Martin/Prepar3d v3 folder.

I had an issue originally where the project wanted me to use Windows SDK 8.1, but I have 10 so I switched the includes to that. Does that make any difference?

When I startup Prepar3D with the DLL file inside the Prepar3D v3 folder, nothing happens. In the SDK it says to check if the camera generated, is it talking about checking the camera config file? If so, I have checked and there definitely isn't any new cameras there. I have also checked in Prepar3D and nothing seemed to change.

What exactly does the camera PDK sample change in Prepar3D? I find the description in the documentation is very poor, so if anybody has any insight to what I did wrong or what the sample does that would be great.

Thanks

User avatar
Rob McCarthy
Lockheed Martin
Posts: 623
Joined: Wed Aug 24, 2011 1:37 pm

Re: Camera PDK Troubles

Postby Rob McCarthy » Wed Aug 09, 2017 12:34 pm

Sorry to hear you're having issues. We made extensive improvements to our external interfaces and documentation in version 4 that hopefully clears up some confusion when setting up complex samples.

Prepar3D needs to know which external .dll files to load and at what location. This is done by either using the dll.xml or add-on.xml methods. Both of these specify paths to the .dll file so technically the .dll file itself does not need to be moved unless you want it in a different location. More info on these methods can be found in the learning center. Once the .dll is correctly loaded the camera will be selectable within Prepar3D, no modifications will be made to any config files.

Regards,
Rob McCarthy
Rob McCarthy
Prepar3D® Core Lead

jake_lm
Posts: 12
Joined: Thu May 04, 2017 1:21 pm

Re: Camera PDK Troubles

Postby jake_lm » Wed Aug 09, 2017 5:25 pm

The only useful part of the documentation I found was this:

----------------------------------------------------------------------------------------------------------------------------------------------------
The Camera PDK Sample is a simple project that demonstrates the camera control capabilities available through the PDK. Similar functionality is also available in SimConnect.
The Camera PDK Sample consists of the following files:
DLLMain.cpp: This file defines the start and end point for this DLL. This file also contains the class definition to support the camera PDK.
DLL.xml: Definition file specifying the start and end point for this DLL
Camera.def: Export the functions DLLStart and DLLStop
Setting Up the Project

To build the project:
Open the CameraPDK.sln found in the SDK at <Prepar3D SDK Path>\PDK\CameraSystemPrototypes\CameraSystemPDK with Visual Studio 2015.
Right-click on Solution. Select Build to begin building the Sample.
NOTE: Paths denoted with < > represent paths on your machine that may vary based on your installation. Please ensure you have input these paths correctly, as failure to do so may cause the build to fail.

Installing the Camera PDK Example

This section discusses installation of the Camera PDK Sample. This section assumes that you have built the project and that it has generated a valid CameraPDK.dll file.
Either copy the DLL.xml (one should be available in the working directory) to your roaming app folder, %APPDATA%\Lockheed Martin\Prepar3D v4.
OR
Add the add-on to your DLL.xml using a supported add-on installation method detailed here (in order to preserve existing entries). Note that the default folder for dll configuration file is ProgramData and thus the FileLocation=Roaming argument must be specified.
Run Prepar3D and verify the new camera is created at startup. If not, please refer to the Troubleshooting & Limitations section below.
----------------------------------------------------------------------------------------------------------------------------------------------------
I have followed this, as located the dll.xml file and added it to the Prepar3D v4 folder in AppData.

The result is the same and nothing happens. Does Prepar3D have a log file that I could use to troubleshoot? The problem is that I have no idea what could be failing, since the steps are so simplistic.

michaelwiki
Posts: 9
Joined: Tue Apr 11, 2017 6:05 pm

Re: Camera PDK Troubles

Postby michaelwiki » Wed Aug 09, 2017 5:50 pm

I found that to keep from having to modify any xml files, you can take the output folder:

.\Prepar3D v4 SDK 4.0.23.21468\PDK\CameraSystemPrototypes\CameraSystemPDK\Output\x64\Debug\CameraPDK

and copy it to

%userprofile%\Documents\Prepar3D v4 Add-ons

Then the next time you launch P3D, it should prompt to with: Enable add-on": "CameraPDK"

jake_lm
Posts: 12
Joined: Thu May 04, 2017 1:21 pm

Re: Camera PDK Troubles

Postby jake_lm » Wed Aug 09, 2017 7:39 pm

I found that to keep from having to modify any xml files, you can take the output folder:

.\Prepar3D v4 SDK 4.0.23.21468\PDK\CameraSystemPrototypes\CameraSystemPDK\Output\x64\Debug\CameraPDK

and copy it to

%userprofile%\Documents\Prepar3D v4 Add-ons

Then the next time you launch P3D, it should prompt to with: Enable add-on": "CameraPDK"
I tried this just now with no results unfortunately. Still it appears that nothing happens.
To further clarify, the exact order of my steps follows:
1. Open Visual Studio solution from the Camera PDK folder
2. Fix all #include errors by putting the correct file paths in the project properties
3. Retarget the project to the Windows 10 SDK, because in its current state it uses the Windows 8 SDK
4. Built the DLL
5. Put the dll.xml into the AppData Prepar3D v3 folder, along with the dll itself for good measure.
I then tried to:
6. Copy the entire output folder to the Addons folder, in Documents/Prepar3D v3

Have I missed/done anything incorrectly?

michaelwiki
Posts: 9
Joined: Tue Apr 11, 2017 6:05 pm

Re: Camera PDK Troubles

Postby michaelwiki » Wed Aug 09, 2017 8:38 pm

Did you copy to "Documents/Prepar3D v3" ? If so, it needs to be "Documents\Prepar3D v4 Add-ons".

The directory name is "Prepar3D v4 Add-ons". It is on the same level as the "Prepare v4 Files" in Documents. "Prepar3D v4 Add-ons" directory is scanned on startup of P3D.

Also, for the target platform, I left it 8.1, and never needed to change that, even on a Windows 10 machine.

jake_lm
Posts: 12
Joined: Thu May 04, 2017 1:21 pm

Re: Camera PDK Troubles

Postby jake_lm » Wed Aug 09, 2017 8:55 pm

Did you copy to "Documents/Prepar3D v3" ? If so, it needs to be "Documents\Prepar3D v4 Add-ons".

The directory name is "Prepar3D v4 Add-ons". It is on the same level as the "Prepare v4 Files" in Documents. "Prepar3D v4 Add-ons" directory is scanned on startup of P3D.

Also, for the target platform, I left it 8.1, and never needed to change that, even on a Windows 10 machine.
Sorry, I did in fact copy to Prepar3D v3 Add-ons. I'm going to try retargeting my platform to 8.1.

michaelwiki
Posts: 9
Joined: Tue Apr 11, 2017 6:05 pm

Re: Camera PDK Troubles

Postby michaelwiki » Wed Aug 09, 2017 8:59 pm

You are running version 4, correct? You keep typing v3 in your posts.

jake_lm
Posts: 12
Joined: Thu May 04, 2017 1:21 pm

Re: Camera PDK Troubles

Postby jake_lm » Wed Aug 09, 2017 9:20 pm

You are running version 4, correct? You keep typing v3 in your posts.
No I am running V3. Does it make any difference?

User avatar
Rob McCarthy
Lockheed Martin
Posts: 623
Joined: Wed Aug 24, 2011 1:37 pm

Re: Camera PDK Troubles

Postby Rob McCarthy » Thu Aug 10, 2017 12:03 pm

Samples in v3 were not updated to use the new add-on.xml method which makes setup easier. Your plugin .dll should load if the dll.xml is in your "%appdata%\Lockheed Martin\Prepar3D v3" directory and also contains the path to your .dll. No modifications to the solution should be necessary (retargeting, etc.).

Regards,
Rob McCarthy
Rob McCarthy
Prepar3D® Core Lead

jake_lm
Posts: 12
Joined: Thu May 04, 2017 1:21 pm

Re: Camera PDK Troubles

Postby jake_lm » Thu Aug 10, 2017 1:35 pm

Then the next time you launch P3D, it should prompt to with: Enable add-on": "CameraPDK"
Does this happen as soon as you launch Prepar3D, before even the scenario selector comes up? Or is this after you load a scenario?

User avatar
Rob McCarthy
Lockheed Martin
Posts: 623
Joined: Wed Aug 24, 2011 1:37 pm

Re: Camera PDK Troubles

Postby Rob McCarthy » Thu Aug 10, 2017 1:43 pm

You will not see this prompt if you are using a dll.xml to load your .dll. This only applies to the add-on.xml system.

Regards,
Rob McCarthy
Rob McCarthy
Prepar3D® Core Lead

jake_lm
Posts: 12
Joined: Thu May 04, 2017 1:21 pm

Re: Camera PDK Troubles

Postby jake_lm » Thu Aug 17, 2017 6:02 pm

I was able to get the cameraPDK working, thanks for the help. For whatever reason the file path that the dll.xml goes isn't what it says in the tutorial.

I do have another question, about the cameraPDK. When running it, the cameraPDK sample creates a small little camera window in the top left corner of the main screen. The window is just a little camera that has a few different modes. This little camera box can be resized and moved around. Which PDK function would I want to look at in order to make this camera the main screen?

Thanks,
Jake

User avatar
Rob McCarthy
Lockheed Martin
Posts: 623
Joined: Wed Aug 24, 2011 1:37 pm

Re: Camera PDK Troubles

Postby Rob McCarthy » Thu Aug 17, 2017 8:21 pm

Glad to hear that fixed it. In the sample there is a RegisterInternalWindow function. You can specify the name of the desired window here.

Regards,
Rob McCarthy
Rob McCarthy
Prepar3D® Core Lead


Return to “Software Development Kit (SDK) Questions”

Who is online

Users browsing this forum: No registered users and 2 guests