• 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 Toolset

Your error may be due to the registry entry for P3D

Code:
        try:
            # For P3D Windows 64 bit
            handle=OpenKey(HKEY_LOCAL_MACHINE, 'SOFTWARE\Wow6432Node\Lockheed Martin\Prepar3D v3 SDK')
            (sdkdir,t)=QueryValueEx(handle, 'SetupPath')
            bpy.context.scene.fsx_modeldefpath = ''.join([sdkdir,"Modeling SDK\\bin\\modeldef.xml"])
            handle.Close()
        except FileNotFoundError:
            # For P3D Windows 32 bit
            handle=OpenKey(HKEY_LOCAL_MACHINE, 'SOFTWARE\\Lockheed Martin\Prepar3D v3 SDK')
            (sdkdir,t)=QueryValueEx(handle, 'SetupPath')
            bpy.context.scene.fsx_modeldefpath = ''.join([sdkdir,"Modeling SDK\\bin\\modeldef.xml"])
            handle.Close()

You may also need the updates from my previous post about filename issues. I suggest you go back to blender 2.73 maybe even 2.6x not sure.

There is also a spot in the export_fsx.py file.

Code:
            try:
                # For P3D Windows 64 bit
                handle=OpenKey(HKEY_LOCAL_MACHINE, 'SOFTWARE\\Wow6432Node\\Lockheed Martin\\Prepar3D v3 SDK')
                (sdkdir,t)=QueryValueEx(handle, 'SetupPath')
                handle.Close()
            except FileNotFoundError:
                # For P3D Windows 32 bit
                handle=OpenKey(HKEY_LOCAL_MACHINE, 'SOFTWARE\\Lockheed Martin\\Prepar3D v3 SDK')
                (sdkdir,t)=QueryValueEx(handle, 'SetupPath')
                handle.Close()
 
Your error may be due to the registry entry for P3D

You may also need the updates from my previous post about filename issues. I suggest you go back to blender 2.73 maybe even 2.6x not sure.

There is also a spot in the export_fsx.py file.

Hi Ron,

After those changes, it worked fine on Blender 2.77a! Let's see if the export will go well in the next few days.
For now, I'm only concerned on making the control surfaces move, so no VC, engines (or maybe just one if I have time) or landing gear.

Thank you for your help! ;)
 
Hi all, I tried to modify the export fsx_py code as suggested by Ron in order to make it work with Blender v2.77. As far as I know I know I didn't leave anything out however on export I am getting the following error:

Traceback (most recent call last):
File "C:\Program Files\Blender Foundation\Blender\2.77\scripts\addons\io_scene_fsx\__init__.py", line 137, in execute
from . import export_fsx
File "C:\Program Files\Blender Foundation\Blender\2.77\scripts\addons\io_scene_fsx\export_fsx.py", line 1171
ImageFiles = [basename(Util.ReplaceFileNameExt(Texture.image.filepath, ".dds"))
^
IndentationError: unindent does not match any outer indentation level

location: <unknown location>:-1

In the meantime I also installed the P3d toolset and everything seems to exporting fine.

Can anyone help pls?

Regards
Daniel
 
You have an issue with Python. It is a program language that use indentation in the file structure to delineate functions. Other programs use things like begin end or curly braces, download blender to p3d. You can see there what I did.
 
Thank you both for the reply. Up till now what I did is just follow what Ron posted in one of the previous posts to correct the error with fsx toolset. Unfortunately I have no experience in python whatsoever. So even though I only modified the export_fsx.py file, if there is something wrong in it, will an error also come up in the _init_py file as well?
I did download the p3d toolset and tried to refer to it but I couldn't see anything diferent once modified so it must be something I'm missing. As I said I am no expert in python at all.

Thank you for your time.

Daniel
 
Hello,...

I know that these changes can be done by each (though with possible problems to the user),... are there plans to do the fixes and replace the files above (in original post). Or have the fixes been applied already? Just trying to verify what has been done or not done.

Waiting patiently :)
 
Hi,

I'm Trying to use XtoMDL with Blender2FSX, and I always get this error:

Code:
Traceback (most recent call last):
  File "C:\Users\Baptiste\AppData\Roaming\Blender Foundation\Blender\2.77\scripts\addons\io_scene_fsx\export_fsx.py", line 232, in Export
    assert getsize(ensure_ext(self.Config.filepath,'.MDL'))
  File "D:\Autres\Blender\2.77\python\lib\genericpath.py", line 50, in getsize
    return os.stat(filename).st_size
FileNotFoundError: [WinError 2] Le fichier spécifié est introuvable: 'D:\\Autres\\Prepar3D V3\\SimObjects\\Airplanes\\Cessna_140\\Test 140.x.MDL'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Baptiste\AppData\Roaming\Blender Foundation\Blender\2.77\scripts\addons\io_scene_fsx\__init__.py", line 139, in execute
    Exporter.Export()
  File "C:\Users\Baptiste\AppData\Roaming\Blender Foundation\Blender\2.77\scripts\addons\io_scene_fsx\export_fsx.py", line 239, in Export
    raise ExportError("Export to .MDL failed. XToMdl.exe returned an error.")
io_scene_fsx.export_fsx.ExportError: Export to .MDL failed. XToMdl.exe returned an error.

location: <unknown location>:-1
Any Ideas?

Thanks,

Eiden
 
Hi,

I'm Trying to use XtoMDL with Blender2FSX, and I always get this error:

Code:
Traceback (most recent call last):
  File "C:\Users\Baptiste\AppData\Roaming\Blender Foundation\Blender\2.77\scripts\addons\io_scene_fsx\export_fsx.py", line 232, in Export
    assert getsize(ensure_ext(self.Config.filepath,'.MDL'))
  File "D:\Autres\Blender\2.77\python\lib\genericpath.py", line 50, in getsize
    return os.stat(filename).st_size
FileNotFoundError: [WinError 2] Le fichier spécifié est introuvable: 'D:\\Autres\\Prepar3D V3\\SimObjects\\Airplanes\\Cessna_140\\Test 140.x.MDL'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Baptiste\AppData\Roaming\Blender Foundation\Blender\2.77\scripts\addons\io_scene_fsx\__init__.py", line 139, in execute
    Exporter.Export()
  File "C:\Users\Baptiste\AppData\Roaming\Blender Foundation\Blender\2.77\scripts\addons\io_scene_fsx\export_fsx.py", line 239, in Export
    raise ExportError("Export to .MDL failed. XToMdl.exe returned an error.")
io_scene_fsx.export_fsx.ExportError: Export to .MDL failed. XToMdl.exe returned an error.

location: <unknown location>:-1
Any Ideas?

Thanks,

Eiden
Hi Eiden,
I still have Blender 2.72 in use but get a similar message when using skinned mesh animations which still have IK Constraints in it.
In my case I select all bones in pose mode, then bake Pose-Animation-Bake Action with parameter Visual Keying set on.
Afterwards you can delete the IK Constraints on the bones that have them and the animaton is "frozen" to all bones.
This makes export work again, it is the same with FSX and P3D SDK.
But keep the file with the IK Constraints if you want further development on it. Don´t know if there is a more elegant way to solve the problem, at least it works for me.
Hope that helps
Joerg
 
Hi Joerg,

Thanks for your help. Unfortunately, I haven't use any bone or Skinned mesh animation. It's just simple animations with the toolset.

I've put empty plain axis linked to my pieces to animate, can they be at the origin of my problem?

ss+(2016-07-29+at+12.26.16).jpg


Thanks,

Eiden
 
There is an issue with blender 2.77 and the Blender to fsx toolset. Go back to blender 2.75 or earlier.
 
Ok, let's start with stating that I'm ashamed I find this issue only now... Probably due to my lack of knowledge about FSX materials.

Anyway.

I decided to replicate the material properties settings from the FSX Materials page of the SDK. Immediately with the first spec setting, I couldn't find anything in the FSX materials tab of Blender that sets the Specular Value (see below), or Specular Level (as it is referred to in MCX). Checking the export files with MCX reveals that this value will always be at 50, from Blender, regardless of the Specular Shader or any setting selected in Blender.

upload_2016-8-3_14-38-16.png


In other words, it's just absent. Can somebody confirm that?
And, is there any way this Specular Value can be set in the Toolset? I am willing to do it myselves, but some encouragement/guidance from any of you is highly preferred (don't know a thing about the code side of the toolset...).

Looking forward to hearing your opinions ;)

Daan
 
It seems to me, in playing with the various settings, that the final MDL is getting its specular intensity from the base Blender material settings (screenshot attached), and the specular power term (the "hotness" of the highlight) from the Blend2FSX setting. I know that turning the spec intensity to zero results in no specularity in the final MDL. You might always be seeing it at 50% because that's the default Blender setting for new materials.

blender_spec_settings.jpg
 
And, is there any way this Specular Value can be set in the Toolset? I am willing to do it myselves, but some encouragement/guidance from any of you is highly preferred (don't know a thing about the code side of the toolset...).

Ok, got it so far that I have added a new slider in the FSX Material Params tab, and with this a value can be set which is even placed in the right position in the .x file. Quite an achievement for me. Now I need to make sure it is also taken along in the .mdl.

Bill: my tests always gave 50, regardless any setting in Blender. The resulting model in FSX doesn't look like it should for the settings. Will do some more testing yet, to confirm any opinion ;)
 
Ok, my testing:

upload_2016-8-3_15-50-40.png


So, hardness is 1. Eventually, the Specular Power (or Specular Level) should therefore be 1. I export to .X and .MDL.

Now open the .X with MCX:

upload_2016-8-3_15-52-18.png


Now open the .MDL with MCX:
upload_2016-8-3_15-52-59.png


You see what I mean? If the Specular Level (as MCX calls it) is 0, it will be automatically set to 50 (as per the comments in the FSX Material SDK).

Now I set the Specular Level to 34 (random number) in the .X file using MCX, export it to .MDL, but what do I get? This:
upload_2016-8-3_15-55-33.png


So apparently the X to MDL conversion isn't doing well either. Sigh...

But I at least managed to get a selected value written to the .X. The value of 'Specularity' which the B2X exporter takes to write to the .X file, isn't available apparently, because it will always be at 0 in the .X file. Should be here:
upload_2016-8-3_15-58-40.png


Hmm...
 
I am interested in this for my Blender to P3D toolset.

Should the specular power/level be set in the Material part also?

Material mat1 {
0.5411; 0.513; 0.6780; 1.0000;;
0.000000 <------ here too?
 
I am interested in this for my Blender to P3D toolset.

Should the specular power/level be set in the Material part also?

Material mat1 {
0.5411; 0.513; 0.6780; 1.0000;;
0.000000 <------ here too?

Probably, yes. I already added a provision to do this.

In the original script, the values at this and the other place are from the variable "Specularity" which is defined in the export toolset. It gets the hardness from the Blender material Spec settings, but that should be at least >1. So it's either 'keep the >1 in mind' or 'add another slider in the FSX Material Params'. Used formula for "Specularity":

Code:
# Map Blender's range of 1 - 511 to 0 - 1000
Specularity = 1000 * (Material.specular_hardness - 1.0) / 510.0

I must admit that, after finding this piece of code, apparently there's no problem with the toolset, except that it doesn't accept values =<1. So if I made someone upset, I apologize.

Now I still need to find out why it's not taken along to the .MDL. In the .X file, the Specular Level/Power/Hardness is OK, but in the .MDL conversion it is reset to 50.
 
Now I still need to find out why it's not taken along to the .MDL. In the .X file, the Specular Level/Power/Hardness is OK, but in the .MDL conversion it is reset to 50.

Ack, please forget this. It was switched off by the No base material specular thing..
 
I tried a similar test with gmax. Set the specular to 100. Export to mdl. I then import to MCX - see 100. I export MCX to x file. I then XtoMDL (P3D) and import back to MCX - still 100.

Also with gmax the question I had above - with MCX it stays as 0.00000.

Also with gmax the specular level is 0-999 -guess the reason for the blender range change.
 
Hi Daan!

Here is another issue that I found. If you sets "Specular Map Power Scale" > 255 you get an error when you export your model. I was also working on the specular problem that you are working on. But you have much more done than I have. So I will work on fixing the "Specular Map Power Scale problem". I will send you my fix once I get it done so that we can have all of the fixes together.

Thanks, Kris. :-)
 
Back
Top