FTK 1.1.28.11065 - Addon Builder - FSX Portovers - Invisible Aircraft -

Hi Folks

Addon Builder - FSX Portovers - Invisible Aircraft -

Since June 2015's FTK
all attempts I've made to portover a default FSX aircraft,
has resulted in an invisible model.

Both in hangar, and in-game.

Previously,
default FSX aircraft conversions
had all displayed their visual models.
e.g. DC-3, Caravan, Goose, etc.



Has anyone else experienced this ?

Does it happen for you ?
Could someone please test for the DC-3 ?



Many thanks
ATB
Paul
 
Hey Paul,
Some things to try out:
  1. It might be a failing SimData file ==> Check your ContentErrors.log file.
  2. When you select the aircraft from the hangar and return to the Map, do you get a message saying that the model failed to load?
  3. What aircraft are you trying to convert, so we can try it out as well? If it's the DC-3, I've converted it before and I've had no probelms with it. When I have the time, I'll fire up Flight and convert it again just to be sure.
  4. Download Granny Viewer from the link in this thread and try to open the .model file with it.
Regards,
KavindaJD
 
Hi Folks

Cheers Kavinda for reminding me
that the failure dialog is displayed
on attempting to load in-game,
and not as I'd thought, in-hangar.

As you'd suspected,
a faulty simData file, (engines),
was inhibiting the DC-3 being displayed.



DC-3 now displays in hangar again,
but still failing in-game,
though now due to a different error,
from one of the model's internal lua scripts.

Error executing LUA script:
[string " local result..."]:
14: attempt to perform arithmetic on local 'result' (a nil value)


Just a guess -
The only scripts containing at least 14 lines -

Probable - Line 8 - contains 10 / 0, i.e. error.
Code:
local result
local l0
if (varget("L:EmergencyThrottleInUse", "bool", 0) ~= 1) then
  l0 = (varget("S:Engine.ThrottlePercent", "percent", 0) * 0.010000)
  if (l0 >= 0) then
  result = ((l0 * -50) + 50)
  else
  result = (((l0 / 0.000000) + 1) * 50)
  end
  result = varset("L:Engine1ThrottlePosition", "percent", 0, result)
else
  result = varget("L:Engine1ThrottlePosition", "percent", 0)
end
return (result * 0.010000)
Possible - Line 5 - Starter index 2, (index 0 to 3).
Code:
local result
local l1
local l0
l0 = varget("S:Engine.Starter", "bool", 1)
l1 = varget("S:Engine.Starter", "bool", 2)
if ((l0 + l1) == 0) then
  result = 25
else
  if l0 then
  result = 0
  else
  if l1 then
  result = 50
  end
  end
end
return (result * 0.020000)


I'll hexedit them later,
and have another attempt loading.



Many thanks
ATB
Paul
 
Hey Paul,

Glad you got the DC-3 showing.
If it is OK with FS-Tester, I would like to release his invaluable tool to the community, and with Steve's FTK you can edit the animation script without having to hex edit them.

First up is a tool adapted by FS-Tester to spit out all the data from a .model file. It is a command line exectutable called Treewalker.exe. I've uploaded it here.
It will display all the data on the CMD panel which is not that useful when you are trying to comb through it, so you have to append it to a temporary text file (this is denoted by the ">" symbol).
Code:
Usage:
Treewalker.exe INPUTFILE.model >"PathandNameoftemporaryfile"
Eg: Treewalker.exe "C:\Users\<Admin>\Desktop\DC3\Flight\DouglasDC3v1\Simobjects\Airplanes\DC-3\model\Douglas_DC3_Exterior.model" >"C:\Users\<Admin>\Desktop\DC-3ModelData.txt"
The above would have taken the model and extracted all of the data and pasted it all into a .txt file, which you can physically refer to.

========================================================================================================================================

Next, you can actually change the animation script for a specific bone in the model using the ConversionOptions.xml file.
Lets assume that you used Treewalker and got the scripts out of it. You need to scroll right down to get the AnimationInfos.
The start of the section is indicated by this piece of text:
Code:
  void * AnimationInfos:
Then there should be something vaguely similar like this (not an exact match of course - Animation scripts would be different!):
Code:
  Value:
  AnimationInfos[469]: (ptr: 024CE2AC)
  AnimationInfos[0]:
  Name: "Bone_2"
  StartTime: 0.000000
  EndTime: 3.333000
  AnimationScript: "return varget("S:Propeller.LeverPercent", "percent", 0) * -0.002778 + 0.277778"
  VisibilityScript: (null)
  AutoPlay: 1
  RandomStart: 0
  InputAction = 0
  AnimationInfos[1]:
  Name: "Bone_3"
  StartTime: 0.000000
  EndTime: 3.333000
  AnimationScript: "return varget("S:Propeller.LeverPercent", "percent", 0) * -0.002778 + 0.277778"
  VisibilityScript: (null)
  AutoPlay: 1
  RandomStart: 0
  InputAction = 0
This is how we debug animation script in the model. As you can see, you can search for any piece of misbehaving script in the text file created by Treewalker.

For instance you could have (guessing the bone name here!):
Code:
  Name: "Bone_15"
  StartTime: 0.000000
  EndTime: 3.333000
  AnimationScript: "
local result
local l1
local l0
l0 = varget("S:Engine.Starter", "bool", 1)
l1 = varget("S:Engine.Starter", "bool", 2)
if ((l0 + l1) == 0) then
result = 25
else
if l0 then
result = 0
else
if l1 then
result = 50
end
end
end
return (result * 0.020000)
"
  VisibilityScript: (null)
  AutoPlay: 1
  RandomStart: 0
  InputAction = 0
In which case, you know that animation attached to Bone_15 is at fault. We can change anything about the Bone as well as create new bones with the Toolkits ConversionOptions file.

========================================================================================================================================

I would suggest that you copy the ConversionOptions.xml present in the root folder of the Flight Toolkit and paste it in your aircraft conversion working foler and rename it so it's identifiable; e.g: "ConversionOptions_DC3.xml"
Open the file up with a text editor such as Notepad++.
Immediately you should see how the Toolkit processes the animation information from the .mdl. The ScriptVariableReplacement tags allow us to control what the toolkit converts the FSX animations into.
Right now you shouldn't get too concerned about that.
To replace the script of a specific bone you need to add some .xml into the bottom of the xml file, just before the </SimBase.Document> Tag.
We start by adding the following:
Code:
  <ConversionOptions.ModelOptions>
  <AssetID></AssetID>
  <BoneOptions>
     <BoneName></BoneName>
     <AnimationScript></AnimationScript>
     <VisibilityScript></VisibilityScript>
  </BoneOptions>
  </ConversionOptions.ModelOptions>
</SimBase.Document>
That lays the foundations. First off, the AssetID is the GUID of the model(.mdl) file you are trying to convert.
You can find this by opening the .mdl file with ModelConverterX and getting the GUID from the Object Information Window. Alternatively, you can get the GUID from the conversion log/window that you get when you run Addon Builder. For example:
Code:
Converting MDL ('Douglas_DC3': 4c7e9e81-3e6d-4123-bd7a-de3a2d132990) to Flight .Model...
Paste the guid from the output window into the AssetID slot in your COP.xml (ConversionOptions) file.
Now for bone name, you need to identify the bone that the faulty script is attached to. As an example, I used Bone_15 earlier.
Now in the AnimationScriptTag is where the correct script goes into. If you feel that there is something wrong with the original script, change it and then put it between the tags.
Be careful when using the greater than or less than symbols; > and <. These could be interpreted as xml so use "&lt" and "&gt" as an alternative. Read about it here under Entity References.

The VisibilityScript tag is optional, but I have it there to show what else is possible to change. Take a look at the xml file "...Flight Toolkit\SimPropSymbols\Toolkit\propConversionOptions.xml".
As you can see there are some more options available:
Code:
  <SetDef>
  id  = "{2A29315A-4CDC-43D6-9EF5-9E1D1DFAA245}"
  name  = "BoneOptions"
  policy  = "inclusive">
  <property name = "BoneName"/>

  <property name = "ReferencePoint"/>
  <property name = "AnimationScript"/>
  <property name = "VisibilityScript"/>
  <property name = "InputAction"/>
  </SetDef>
Once you are happy and it's saved, you need to make sure that you use it when you convert. I am assuming that you are using the GUI version of ContentConverter.exe, in which case, you need to point the tool to the location of the "ConversionOptions_DC3.xml" file in the New Content Wizard.


Sorry if it's a lot of information to take into all in one go. It would have been better in a document so I can add some pictures to clarify things but I have had little time lately.
In shot, when you use it for a while, you will get used to it. ;)
I would have missed out something, so don't hesitate to ask!

This is all supported in 1.1.29

Regards,
 
Last edited:
Paul, w.r.t. the script:
local result
local l1
local l0
l0 = varget("S:Engine.Starter", "bool", 1)
l1 = varget("S:Engine.Starter", "bool", 2)
....
I think your 2nd analysis is the correct one. How many engines does your aircraft have? If it is a twin-engined aircraft, then the indices for the starter should be:
l0 = varget("S:Engine.Starter", "bool", 0)
l1 = varget("S:Engine.Starter", "bool", 1)

l1 = varget("S:Engine.Starter", "bool", 2) is specifying Engine #3, which, obviously, does not exist for a twin-engined aircraft, so will return a null value, causing the error you are seeing.

regards,
FS Tester
 
Top