- Messages
- 1,258
- Country
Ok, This is a treasure hunt to go through the xml files in the Official\OneStore\fs-base-aircraft-common\ModelBehaviorDefs\Asobo\Transponder folder. I took the AS330.xml file and tried to figure out how it worked with the Pitts.
The key in this whole thing is the naming in the model glif file agrees with the parameters in the xml files.
So I looked at the Pitts interior.xml. You can view it in notepad++ with the json plugin or your favorite editor. Or if you update blender you can import the gltf file and see the node names.
In the Pitts the transponder texture for the AS330 is $AS330_screen and I will leave it as that as that would me changing the gltf file. This is the same as the panel.cfg naming. There is no need to change the panel.xml, nothing there for the transponder.
So I changed:
ASOBO has provided the js/css/html KT76C.htl/.js/.css files in the core system for use to use, so the panel.cfg is pointing to existing code, there is no need to reinvent the wheel.
Now we need a KT76C.xml - I took the AS330.xml and copied it into a project folder. Renamed all the AS330 to KT76C inside the xml. I removed the button 8 and 9 stuff since there is no 8 and 9 in the 76C.
As an example - here is part of the xml files.
I kept the ASOBO name - but I think you could change to LHC, but I am unsure if it impacts things. (edit: yes it would because some calls are to templates in the core files - leave as ASOBO).
Do not mix older modeldef.xml code with these templates. These templates are great. You just need to know what names to give to your nodes, parts and animations. They have to agree with the parameters like -
<KT76C>TRANSPONDER</KT76C>
<BTN_ID>#ID#</BTN_ID>
<PREFIX>#KT76C#_Push</PREFIX>
and
<NODE_ID>#PREFIX#_#BTN_ID##SUFFIX_ID#</NODE_ID>
<ANIM_NAME>#PREFIX#_#BTN_ID##SUFFIX_ID#</ANIM_NAME>
<PART_ID>#PREFIX#_#BTN_ID#</PART_ID>
This is the new stuff. You get the "values" of these parameters from the
<DefaultTemplateParameters>
area of other templates. This treasure hunt is difficult.
So the model gltf file needs NODE_IDs, ANIM_NAMEs, and PART_ID that will agree with the parameters and the way they are "built".
The PREFIX "value" is taken from the #KT76C# value and then we concatenate "_PUSH" (without the quotes)
This makes PREFIX = TRANSPONDER_Push
Now BTN_ID = #ID# which depends on what button is pushed. (This all happens behind the scenes with Coherent_GT js/css/html talking to the code files C++ and then the XML files. (This is all magic to me right know)
If VFR button.
NODE_ID value is #PREFIX#_#BTN_ID##SUFFIX_ID# - so that is TRANSPONDER_Push + _ + VFR + the suffix id - This is more magic as there is code below that gets this value.
edit: ANIM_NAME value is #PREFIX#_#BTN_ID##SUFFIX_ID# - so that is TRANSPONDER_Push + _ + VFR + the suffix id - This is more magic as there is code below that gets this value.
This is the reason I said you can't change ASOBO to LHC, because this is a core html template you don't have.
I assume the SUFFIX_ID is _1. It adds the underscore too.
So NODE_ID = TRANSPONDER_Push _VFR_1. If you look at the gltf file we have an node with that name.
edit: And ANIM_NAME = TRANSPONDER_Push _VFR_1. If you look at the gltf file we have an animation with that name.
So the PART_ID is built the same way. Your model has to agree with the way ASOBO has setup the parameters.
One more file change. I had to change the Pitts_Interior.xml and change AS330 to KT76C.
That is what's needed for the file change.
What's needed is a list of ALL the template parameters and NODE_ID, PART_ID and ANIM_NAME. This is a huge task. And then somehow add them to Blender2MSFS utility.
To build a package I followed what WorkingTitle and MrTommymxr do. I used planeconverter to make packages with a SimObject folder and ModeBehaiviorDef folder. Placed the new KT76C.xml in modeBehaviorDef and the other files in the SimObject. This modified the ASOBO Pitts.
I will be adding this to the Unofficial SDK documentation.
Edit: minor edits done.
The key in this whole thing is the naming in the model glif file agrees with the parameters in the xml files.
So I looked at the Pitts interior.xml. You can view it in notepad++ with the json plugin or your favorite editor. Or if you update blender you can import the gltf file and see the node names.
In the Pitts the transponder texture for the AS330 is $AS330_screen and I will leave it as that as that would me changing the gltf file. This is the same as the panel.cfg naming. There is no need to change the panel.xml, nothing there for the transponder.
So I changed:
to[VCockpit03]
size_mm=440,100
pixel_size=440,100
texture=$AS330_Screen
htmlgauge00=Generic/Transponders/AS330/AS330.html, 0,0,440, 100
[VCockpit03]
size_mm=440,100
pixel_size=440,100
texture=$AS330_Screen
htmlgauge00=Generic/Transponders/KT76C/KT76C.html, 0,0,440, 100
ASOBO has provided the js/css/html KT76C.htl/.js/.css files in the core system for use to use, so the panel.cfg is pointing to existing code, there is no need to reinvent the wheel.
Now we need a KT76C.xml - I took the AS330.xml and copied it into a project folder. Renamed all the AS330 to KT76C inside the xml. I removed the button 8 and 9 stuff since there is no 8 and 9 in the 76C.
As an example - here is part of the xml files.
to<Template Name="ASOBO_AS330_Template">
<DefaultTemplateParameters>
<ID>1</ID>
<Condition Check="CIRCUIT_ID">
<True>
<FAILURE>(A:CIRCUIT ON:#CIRCUIT_ID#, Bool)</FAILURE>
</True>
<False>
<FAILURE>(A:CIRCUIT GENERAL PANEL ON, Bool)</FAILURE>
</False>
</Condition>
<ANIM_NEVER_FAILS/>
<EMISSIVE_DEFAULT_VALUE>0.5</EMISSIVE_DEFAULT_VALUE>
<AS330>TRANSPONDER</AS330>
</DefaultTemplateParameters>
<UseTemplate Name="ASOBO_GT_Helper_Suffix_ID_Appender">
<TEMPLATE_TO_CALL>ASOBO_AS330_SubTemplate</TEMPLATE_TO_CALL>
</UseTemplate>
</Template>
<Template Name="ASOBO_KT76C_Template">
<DefaultTemplateParameters>
<ID>1</ID>
<Condition Check="CIRCUIT_ID">
<True>
<FAILURE>(A:CIRCUIT ON:#CIRCUIT_ID#, Bool)</FAILURE>
</True>
<False>
<FAILURE>(A:CIRCUIT GENERAL PANEL ON, Bool)</FAILURE>
</False>
</Condition>
<ANIM_NEVER_FAILS/>
<EMISSIVE_DEFAULT_VALUE>0.5</EMISSIVE_DEFAULT_VALUE>
<KT76C>TRANSPONDER</KT76C>
</DefaultTemplateParameters>
<UseTemplate Name="ASOBO_GT_Helper_Suffix_ID_Appender">
<TEMPLATE_TO_CALL>ASOBO_KT76C_SubTemplate</TEMPLATE_TO_CALL>
</UseTemplate>
</Template>
I kept the ASOBO name - but I think you could change to LHC, but I am unsure if it impacts things. (edit: yes it would because some calls are to templates in the core files - leave as ASOBO).
Do not mix older modeldef.xml code with these templates. These templates are great. You just need to know what names to give to your nodes, parts and animations. They have to agree with the parameters like -
<KT76C>TRANSPONDER</KT76C>
<BTN_ID>#ID#</BTN_ID>
<PREFIX>#KT76C#_Push</PREFIX>
and
<NODE_ID>#PREFIX#_#BTN_ID##SUFFIX_ID#</NODE_ID>
<ANIM_NAME>#PREFIX#_#BTN_ID##SUFFIX_ID#</ANIM_NAME>
<PART_ID>#PREFIX#_#BTN_ID#</PART_ID>
This is the new stuff. You get the "values" of these parameters from the
<DefaultTemplateParameters>
area of other templates. This treasure hunt is difficult.
So the model gltf file needs NODE_IDs, ANIM_NAMEs, and PART_ID that will agree with the parameters and the way they are "built".
The PREFIX "value" is taken from the #KT76C# value and then we concatenate "_PUSH" (without the quotes)
This makes PREFIX = TRANSPONDER_Push
Now BTN_ID = #ID# which depends on what button is pushed. (This all happens behind the scenes with Coherent_GT js/css/html talking to the code files C++ and then the XML files. (This is all magic to me right know)
<UseTemplate Name="ASOBO_KT76C_Push_Button_Template">
<BTN_ID>VFR</BTN_ID>
<TOOLTIPID>TT:COCKPIT.TOOLTIPS.XPDR_VFR</TOOLTIPID>
</UseTemplate>
<UseTemplate Name="ASOBO_KT76C_Push_Button_Template">
<BTN_ID>0</BTN_ID>
</UseTemplate>
<UseTemplate Name="ASOBO_KT76C_Push_Button_Template">
<BTN_ID>1</BTN_ID>
</UseTemplate>
If VFR button.
NODE_ID value is #PREFIX#_#BTN_ID##SUFFIX_ID# - so that is TRANSPONDER_Push + _ + VFR + the suffix id - This is more magic as there is code below that gets this value.
edit: ANIM_NAME value is #PREFIX#_#BTN_ID##SUFFIX_ID# - so that is TRANSPONDER_Push + _ + VFR + the suffix id - This is more magic as there is code below that gets this value.
<UseTemplate Name="ASOBO_GT_Helper_Suffix_ID_Appender">
<TEMPLATE_TO_CALL>ASOBO_KT76C_SubTemplate</TEMPLATE_TO_CALL>
</UseTemplate>
This is the reason I said you can't change ASOBO to LHC, because this is a core html template you don't have.
I assume the SUFFIX_ID is _1. It adds the underscore too.
So NODE_ID = TRANSPONDER_Push _VFR_1. If you look at the gltf file we have an node with that name.
edit: And ANIM_NAME = TRANSPONDER_Push _VFR_1. If you look at the gltf file we have an animation with that name.
So the PART_ID is built the same way. Your model has to agree with the way ASOBO has setup the parameters.
One more file change. I had to change the Pitts_Interior.xml and change AS330 to KT76C.
<Behaviors>
<Include ModelBehaviorFile="Asobo\Common.xml"/>
<Include ModelBehaviorFile="Asobo\Misc\Accelerometer.xml"/>
<Include ModelBehaviorFile="Asobo\Transponder\KT76C.xml"/>
<Include ModelBehaviorFile="Asobo\NAVCOM\NavComSystem.xml"/>
<!-- HTML INSTRUMENTS ################### -->
<Component ID="Accelerometer">
<UseTemplate Name="ASOBO_Accelerometer_Template">
</UseTemplate>
</Component>
<Component ID="KT76C">
<UseTemplate Name="ASOBO_KT76C_Template">
</UseTemplate>
</Component>
That is what's needed for the file change.
What's needed is a list of ALL the template parameters and NODE_ID, PART_ID and ANIM_NAME. This is a huge task. And then somehow add them to Blender2MSFS utility.
To build a package I followed what WorkingTitle and MrTommymxr do. I used planeconverter to make packages with a SimObject folder and ModeBehaiviorDef folder. Placed the new KT76C.xml in modeBehaviorDef and the other files in the SimObject. This modified the ASOBO Pitts.
I will be adding this to the Unofficial SDK documentation.
Edit: minor edits done.
Last edited: