• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

P3D v4 Model part visibility XML gauge

#1
Hi folks,

A quick question for the XML experts. I'm looking to make my aircraft's port propeller spinner "disappear" when the airplanes's "Door_2" is activated. This second exit is the engine cover, which is removed upon opening the second exit. Having the spinner vanish will allow more of the engine and prop assembly to be visible. ( This is something that I'd also be happy to accomplish using a mouse rect ).

I've done much reading here and elsewhere, but I don't believe that I can assign such a code to the part in question ( Prop1_still.1 ) as it's already parented to another part and of course animated itself. So far, this is where I'm at in my understanding of how this process works;

1) Create the necessary code with a GUID in XML format

2) Edit the modeldef.xml with the new name of the XML code in question so the sim can recognise and read the required effect.

3) In FSDS, use an attach point to which the part in question can be parented, named for the new effect.

4 ) Compile the model, marvel at how everything works perfectly first time :rolleyes:

I'm a total newbie to XML, but I have looked at lots of such gauges and can see the fundamentals of how it all works. Piccy attached of the spinner off in MCX - if anyone can point me in the right direction to get me started I'd be very happy. Will continue to experiment in the meantime...

Propellerassembly.jpg
 

Heretic

Resource contributor
#2
Every part may only have a single visibility tag assigned. If you're lazy, you may as well edit the default tag for prop0_still to include a door2 condition check. But a new, custom code block in the modeldef file is recommended to keep things clean.

Try to start with something simple and visible, like hiding the wing when the battery switch is off.

The modeldef is only used by the modeling program and during compilation. The sim itself doesn't care.

And bookmark this: https://msdn.microsoft.com/en-us/library/cc526981.aspx
It's going to be your new best friend.
 
#3
Thanks Heretic! I've got the definitions page on bookmark as well as the XML guide and a few other posts here too. It's dizzying how many possibilities there are. I'm used to working with HTML so I can see how XML gets itself together, but I'm not as well up on how a piece of XML gets itself attached to a particular part. Is referencing the part within the XML sufficient, as long as the name of the newly created XML gauge is present in modeldef upon compilation?

I suspect that it's going to take me a while to get used to this new world of possibilities so will only be doing simple stuff with this project for now, i.e, only the spinner visibility! :)
 

Heretic

Resource contributor
#4
I can't help with FSDS, but in (G)Max, visibility and mouse rectangle tags are saved as part properties (animation tags as keyframe properties or so). You basically use the animation manager or attachpoint tool to browse the partnames and simply click "add" to add it to the selected part.

Back in FS9 days, it was enough to give a part the name of an animation in makemdl.parts to tell the compiler what goes where, but FSX does it differently.


Don't worry about the markup too much. The scripts themselves are the things that have a detrimental effect on mental health.
 
#5
Added to modeldef.xml, this should get you going. No GUID needed for vis codes.

Code:
<PartInfo>
<Name>Spinner_vis</Name>        <!-- show part only when exit 2 is closed -->
<Visibility>
<Parameter>
<Code>
  (A:EXIT OPEN:1, bool) !
</Code>
</Parameter> 
</Visibility>
</PartInfo>
Attach vis tag Spinner_vis to a small cube part hidden somewhere out of sight (within the spinner itself if you want). Then link the spinner to the cube making the cube parent and the spinner child.

If you are compiling for P3D using the P3D SDK XtoMdl you can add a mouserect to any visible part of the model thus:

Code:
<PartInfo>
<Name>Exit Toggle</Name>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>Open/close Exit</TooltipText>
<CallbackCode>
  (>K:TOGGLE_AIRCRAFT_EXIT) (>K:SELECT_2)
</CallbackCode>
</MouseRect>
</PartInfo>
 
#6
Wow, thanks mjahn! I'll give this a go as soon as I get a chance and report back. I'm using FSDS which requires parent parts with no geometry for animations, so I'll use that to attach the vis tag and see how I go. All very interesting stuff, thanks again :)
 
#7
Sadly no joy with this - added the initial script to modeldef.xml in FSX SDK / Environment Kit / Modelling / Bin but it won't show in FSDS's FSX Aircraft Visibility tags list. Checked other lists just in case but it's not there. Tried numerous configurations including adding the line <copy>prop_anim</copy> to bring it in line with other visibility scripts in the xml but nothing changed.

Will keep tinkering and report back. Even if the tag didn't do what it's supposed to it should be showing in the list?
 
#9
It sure should. Maybe check for duplicate files, also be aware that the list may show lower-case names separately from upper case ones.
I've just realised that my modeldef.xml contains many custom scripts that are not showing in FSDS, despite the Preferences pointing to the correct place and file. Very odd. Will try to figure out why it's only detecting the standard scripts. Could be a duplicate I suppose but the program is pointing to the updated file so it's a bit odd.
 

Roy Holmes

Resource contributor
#10
Dean,
It has been a while since I used FSDS, but it is the only such tool I have used.
There is a file called PartDataDefs that needs to have a visibility entry for each of your parts like prop0_still. That is also where attachment points go.
The only other thing that I recall as being relevant is where you have modeldef entries for parts like separate specific throttles but there is also a generic throttle entry above them. FSDS finds the generic entry and uses that while ignoring the specific one
I notice that the file references FSMakeMdl but I believe it still applies when you use XToMdl.
Roy
 
#11
Dean,
It has been a while since I used FSDS, but it is the only such tool I have used.
There is a file called PartDataDefs that needs to have a visibility entry for each of your parts like prop0_still. That is also where attachment points go.
The only other thing that I recall as being relevant is where you have modeldef entries for parts like separate specific throttles but there is also a generic throttle entry above them. FSDS finds the generic entry and uses that while ignoring the specific one
I notice that the file references FSMakeMdl but I believe it still applies when you use XToMdl.
Roy
Thanks Roy, hope you're well! Your point about FSDS and the modeldef entires explains why my Reporter's throttle banks won't animate correctly - I'll have a look at the PartDataRefs and see if I can't iron out the issue and get the animations working as they should.