Hi to all,
I'm working on a 3d cockpit, following this "standard" procedure:
What I would like to do is create a custom variable, to be used in substitution of default variables inside modeldef.xml. Continuing the previous example, I would create a custom variable MY_G_FORCE:
and then refer it in XML:
I worked with Cabin Comfort example, and while it works fine as 2D gauge, I was unable to use its variables in modeldef.xml for 3D gauges: I tried to connect to its variable BankAngle, using all of the following:
Then I went in debug mode in C++, and I saw that the function bool CABINGaugeCallback :: GetPropertyValue (SINT32 id, FLOAT64* pValue) is called only for updating the 2D gauge, and not for 3D gauge.
As you can see in Cabin Comfort example, the variable is referred in this section of CabinComfort.xml:
Does anybody have any suggestion? I'm really interested in porting all of the logic in C++ as I'm a developer, and I feel much more comfortable with it than with XML.
Thanks very much in advance!
Mauro
I'm working on a 3d cockpit, following this "standard" procedure:
- create an XML variable in modeldef.xml file, using simulator token variables. Example:
Code:<PartInfo> <Name>needle_g_force</Name> <AnimLength>85</AnimLength> <Animation> <Parameter> <Code>(A:G FORCE, GForce) 10 * 50 + 0 max 170 min 2 /</Code> </Parameter> </Animation> <MouseRect> <Cursor>Hand</Cursor> <TooltipText>GFORCE %((A:G FORCE, GForce))%!2.1f! g</TooltipText> </MouseRect> </PartInfo>
- in 3dsmax, I link an animated object (es, a needle) with that variable via FSTools
- the 3d object is exported as .x file, with an associated .xanim file containing the animation description
- via XToMdl.exe tool, I convert the .x file in an .mdl file, to be used as internal model for my airplane
What I would like to do is create a custom variable, to be used in substitution of default variables inside modeldef.xml. Continuing the previous example, I would create a custom variable MY_G_FORCE:
Code:
//C++
bool GForceGaugeCallback::GetPropertyValue (SINT32 id, FLOAT64* pValue)
{
...
FLOAT64 gforce = aircraft_varget(get_aircraft_var_enum("G FORCE"), get_units_enum("GForce"), 0);
gforce = 10*gforce + 50;
*pValue = gforce < 0 ? 0 : (gforce > 170) ? 170 : gforce;
*pValue /= 2;
...
}
and then refer it in XML:
Code:
<!--modeldef.xml-->
<PartInfo>
<Name>needle_g_force</Name>
<AnimLength>85</AnimLength>
<Animation>
<Parameter>
<Code>(L:MY_G_FORCE, GForce)</Code>
</Parameter>
</Animation>
...
</PartInfo>
I worked with Cabin Comfort example, and while it works fine as 2D gauge, I was unable to use its variables in modeldef.xml for 3D gauges: I tried to connect to its variable BankAngle, using all of the following:
- <Code>(C:CABIN:BankAngle, degrees)</Code>
- <Code>(C:BankAngle, degrees)</Code>
- <Code>(C:CABIN:BankAngle)</Code>
- <Code>(L:CABIN:BankAngle, degrees)</Code>
- <Code>(L:BankAngle, degrees)</Code>
Then I went in debug mode in C++, and I saw that the function bool CABINGaugeCallback :: GetPropertyValue (SINT32 id, FLOAT64* pValue) is called only for updating the 2D gauge, and not for 3D gauge.
As you can see in Cabin Comfort example, the variable is referred in this section of CabinComfort.xml:
Code:
<Element id="Element">
<FloatPosition>120.000,55.000</FloatPosition>
<GaugeText id="GaugeText">
<Bold>True</Bold>
<FontColor>yellow</FontColor>
<FontHeight>11</FontHeight>
<GaugeString>%((C:CABIN:BankAngle))%!2.2f!</GaugeString>
<HorizontalAlign>RIGHT</HorizontalAlign>
<Size>80,13</Size>
<Transparent>True</Transparent>
</GaugeText>
</Element>
Does anybody have any suggestion? I'm really interested in porting all of the logic in C++ as I'm a developer, and I feel much more comfortable with it than with XML.
Thanks very much in advance!
Mauro