• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Blender to FSX Without Toolset

Messages
33
Country
us-california
I don't make airplanes, only scenery objects (though I do static aircraft).
I currently use Sketchup .dae -> MCX .mdl -> ADE 1.70 .bgl -> FSX with no problems at all.

I want to use Blender in a similar workflow.

I tried Blender2FSX, but I'm using FSX:Steam with P3D 1.4 SDK (in the P3D default location) and the Toolset can't find it. Neither can Blender2P3D. MCX and ADE have no problems with the SDK. The Toolset is overkill for simple non-animated static models, but I'd use it if I could make it work.

Why can't I use Blender .x -> MCX .mdl?

I works fine if I use only Blender Materials. However, I can't get image textures. I have tried every combination of check boxes in the Direct .X options in Blender. No textures. If I examine the .x file from Blender, there is no reference to an image texture at all so MCX doesn't report any problems--it doesn't know image textures exist. There's lots of mesh and UV coordinates in the .x file, but no filename info.

My models with image textures render fine in Blender using either Blender Render or Cycles Render. I am not having any difficulty understanding how to use image textures in Blender--they all render fine. And MCX merrily converts my .x files without errors or warnings. Color diffuse and specular materials appear to display OK in MCX. Image textures not at all.

BTW exporting to 3ds has exactly the same result. Keep in mind, this has nothing to do with FSX. I can't get Blender image textures to work in MCX.

Eric
 
Last edited:

Ronald

Resource contributor
Messages
974
I use (Blender V2.77a) and B2FSX 0.86 to create aircraft models (only), have had the same type of error
I use the following work-around:
- I create a aircraft-model in Blender
- I export the model to .X and .XANIM format in my MDL project file folder with following options turned on:
-> [x] Apply Modifiers
-> [x] Export Animations
-> [x] Log Verbose
-> [x] Log File

DO NOT USE THE [x] Export MDL option! but do that manually (since this causes the error)

In my MDL project file folder I have the following (extra) ingredients:
- XToMDL.EXE
- modeldef.xml
- Batch-script that compiles my .X (and .XANIM) model into an .MDL file into that same folder.

This works perfect for me, since I now can clearly see all the XToMDL:
- compiler status messages
- compilation errors in real-time

I hope this setup works for you too Eric.
 
Messages
33
Country
us-california
Thanks, Ronald. The problem is, I can't get Blender2FSX 0.86 to even initialize. FSX:Steam does not have a functional SDK for B2FSX to use. Instead, I have to use the P3D SDK, but that has an entirely different path than the FSX path. I tried B2P3D and it looks like it's using a different path for P3D SDK than is used by my version. Maybe the solution is to post again in the B2FSX thread and see if one of the developers can modify the path to match the default Lockheed path for V1.4

I appreciate the help, and if I can get b2FSX working, I'll use your workaround.

In the mean time, I made some portable traffic barriers with Sketchup/MCX/ADE for my L65 scenery. From conception to seeing them in FSX took about 20 minutes. Maybe I should stick to what's working. :D

Eric
 

Ronald

Resource contributor
Messages
974
Some thoughts:
A - Have you tried going back in B2FSX / B2P3D version ?
B - Which version of which SDK do you have installed on your computer?
C - Have you tried this:
-> De-install the SDK's
-> Run a windows registry cleaner (to fix broken paths to the SDK's)
-> Re-install the SDK's
-> and [Initialize Toolset] again?

Since both the B2FSX and the B2P3D scripts look in your local Window Registry to find the already SDK's modules:

See the lines below in the FSX_Toolset.py script:
Code:
class InitOperator(bpy.types.Operator):
  """Update path to modeldef.xml, animation entries, etc..."""
  bl_label = "Initialize Toolset"
  bl_idname = "fsx.detect_sdk"
  
  def execute(self, context):
  try:
  # For Windows 64 bit
  handle=OpenKey(HKEY_LOCAL_MACHINE, 'SOFTWARE\\Wow6432Node\\LockheedMartin\\Prepar3D_SDK')
  (sdkdir,t)=QueryValueEx(handle, 'SetupPath')
  bpy.context.scene.fsx_modeldefpath = ''.join([sdkdir,"Environment Kit\\Modeling SDK\\bin\\modeldef.xml"])
  handle.Close()
  except FileNotFoundError:

  # For Windows 32 bit
  handle=OpenKey(HKEY_LOCAL_MACHINE, 'SOFTWARE\\LockheedMartin\\Prepar3D_SDK')
  (sdkdir,t)=QueryValueEx(handle, 'SetupPath')
  bpy.context.scene.fsx_modeldefpath = ''.join([sdkdir,"Environment Kit\\Modeling SDK\\bin\\modeldef.xml"])
  handle.Close()
 
Messages
33
Country
us-california
A couple hours ago, I decided to dig into the registry and py script. I came up with exactly what you have there. I included some comments that Blender included in the error message so I know it's reading my mods.

There are more paths to change in export_fsx.py. That one includes both FSX and P3D, but it was written for SDK V2 so I made those changes too. First order of business is to get Initialize to work, then deal with other error messages later.

I'm going to try your suggestion to de-install the SDK and start over. It's got to be something simple because the P3D SDK worked from the very beginning with MCX, ADE and a couple of others. I don't want to do anything that's going to affect how they work just to get B2FSX working.

Thanks for the help.

Eric
 

Ronald

Resource contributor
Messages
974
A couple hours ago, I decided to dig into the registry and py script. I came up with exactly what you have there. I included some comments that Blender included in the error message so I know it's reading my mods.
That is the most educative way when learning to solve this challenge Eric. Dive in, Learn the Blender-Python-API yourself and look for the error-strings inside the .PY source-codes to see and understand what went wrong exactly.

Here are a few -developer-grade-links to get you started with this process:
1. The original Blender to Direct X exporter : (the original one, where it all started)
- https://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Import-Export/DirectX_Exporter

2. Blender Python API reference overview: (needed to read and understand the B2FSX/P3D) source-codes
- https://www.blender.org/api/249PythonDoc/

3. An overview of all internal Blender data structures (very useful for understanding WHICH data is being extracted from a .blend file when exporting and CONVERTED into what else)
- http://www.atmind.nl/blender/blender-sdna.html

4. Python programming learning resources:
- https://www.python.org/
- http://www.learnpython.org/

5. How to create a Blender Python add-ons tutorials yourself: (to understand the B2FSX/P3D initialization routines)
- https://www.blender.org/api/blender_python_api_2_78_0/info_tutorial_addon.html
- https://en.wikibooks.org/wiki/Blend...ced_Tutorials/Python_Scripting/Export_scripts
- https://michelanders.blogspot.nl/p/creating-blender-26-python-add-on.html


There are more paths to change in export_fsx.py. That one includes both FSX and P3D, but it was written for SDK V2 so I made those changes too.
Correct!
TIP:it can be very useful to create a copy of the latest B2FSX/P3D and HARDCODE your own FSX and P3D paths into it?

First order of business is to get Initialize to work, then deal with other error messages later.
TIP: Take a look at the earlier version of the B2FSX/P3D scripts that DID initialize correctly on your computer in the past and copy code-portion of that

It's got to be something simple because the P3D SDK worked from the very beginning with MCX, ADE and a couple of others.
I don't want to do anything that's going to affect how they work just to get B2FSX working.
Agreed!
- TIP: Be sure to make backup-copies of everything that is working now! otherwise you can crash your entire production-flow-pipeline
- TIP: When technically possible, go back to a previous version of the B2FSX/P3D scripts, and work from there.
 

Dutcheeseblend

Resource contributor
Messages
1,541
Country
netherlands
I did something like this before the toolset was there. I exported to .x, imported that in MCX and exported that to FSX. Arno offered me some compatibility of MCX: if I started the object with MR, MCX automatically assigned a mouse rectangle to it. And also animation tags. In MCX I then had to assign the correct animations, but at least I could get something from Blender to FSX. But then came Felix with the toolset.
 
Messages
33
Country
us-california
Thanks, Ronald. I'm heading out to the desert for a week of trailer camping right after Christmas. I camp alone so I'll have plenty of time to work on this then with no distractions other than a daily hike and a nightly campfire.

Eric
 
Messages
33
Country
us-california
I did something like this before the toolset was there. I exported to .x, imported that in MCX and exported that to FSX. Arno offered me some compatibility of MCX: if I started the object with MR, MCX automatically assigned a mouse rectangle to it. And also animation tags. In MCX I then had to assign the correct animations, but at least I could get something from Blender to FSX. But then came Felix with the toolset.

I've seen some of your earlier posts. They were what told me I might be able to use Blender in my normal Sketchup > MCX > ADE for scenery. I don't have the added complication of animations. But if I can get B2FSX/P3D working, that will be a plus.

Eric
 
Messages
33
Country
us-california
Ok, it seems to be working now. I haven't tried everything as I don't even know how to use Blender2FSX yet. But it is installed, and 'Initialize Toolset' works without errors. I know Blender can find the P3D SDK, so I have confidence that everything else will work as advertised.

Most people probably won't experience this problem unless they are using FSX:Steam. The problem isn't Steam. It's that there is no SDK for Steam. For FSX development, you have to use the first version of P3D SDK which is identical to the one shipped with FSX Gold. RonH (?) did Blender2P3D for use with P3D SDK V2 and V3, NOT for V1.4 which is the only one that can be used with FSX. So there's the rub.

Here's what I did. In FSX_Toolset4FSX.py, delete everything between the two lines in lines in bold and add the two lines in between"

def execute(self, context):
sdkdir="c:\\Program Files (x86)\\Lockheed Martin\\Prepar3D SDK 1.4.4747.0\\"
bpy.context.scene.fsx_modeldefpath = ''.join([sdkdir,"Environment Kit\\Modeling SDK\\bin\\modeldef.xml"])

try:
tree = etree.parse(bpy.context.scene.fsx_modeldefpath)


Actually, the second non-bold line is the same as the one already there. Be careful of indents. I don't know how to make these lines non-proportional, but the two non-bold lines should be indented 4 spaces.

Then, in export_fsx.py, I changed this section as follows:

# building .MDL file directly
if self.Config.ExportMDL:

sdkdir="c:\\Program Files (x86)\\Lockheed Martin\\Prepar3D SDK 1.4.4747.0"

The bold lines are already there and included just for reference.

I noticed some errors in the existing scripts that included P3D paths. In the registry, LockheedMartin is spelled WITHOUT a space, but in the actual paths on the hard drive, the folders are Lockheed Martin. This is not consistent in FSX_Toolset4FSX.py. The errors occur in the 32 bit areas so I suspect the ones in the 64 bit areas were fixed, but the 32 bit were not noticed. Just a caution.

Thanks for all the help, the references and the encouragement, Ronald. Now when I head to the desert, I can spend my time on actual development instead of fixing and sharpening my tools.

Eric
 

Ronald

Resource contributor
Messages
974
Great to see that you are able to troubleshoot the B2* scripts Eric and that everything is now working correctly again.
Have fun in the desert!
 
Top