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

P3D v4 Model part visibility XML gauge

Deano1973

Resource contributor
Messages
384
Country
unitedkingdom
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
Messages
6,830
Country
germany
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.
 

Deano1973

Resource contributor
Messages
384
Country
unitedkingdom
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
Messages
6,830
Country
germany
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.
 
D

Deleted member 1281

Guest
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>
 

Deano1973

Resource contributor
Messages
384
Country
unitedkingdom
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 :)
 

Deano1973

Resource contributor
Messages
384
Country
unitedkingdom
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?
 
D

Deleted member 1281

Guest
It sure should. Maybe check for duplicate files, also be aware that the list may show lower-case names separately from upper case ones.
 

Deano1973

Resource contributor
Messages
384
Country
unitedkingdom
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
Messages
1,803
Country
us-virginia
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
 

Deano1973

Resource contributor
Messages
384
Country
unitedkingdom
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.
 

Roy Holmes

Resource contributor
Messages
1,803
Country
us-virginia
Dean,
You can fix the throttle thing easily by moving the generic entry to below the specific entries in the modeldef
Roy
 
Top