P3D v4 visibility conditions for scenery objects

Hi Arno,
In a scenerydesign.org thread of 2017, you mentioned a possibility to add visibility conditions to the model.def.xml where you then have to add it in the hierarchy editor to the model part visibility conditions. However, I do not know if you implemented it in MCX as there is no possibility to write in visibility conditions other than the ones that come in a drop down menu!
 

tgibson

Resource contributor
I believe you can write them by hand into the file in the SDK and then MCX will read that? Or perhaps you can do it in the MCX ModelDef.xml Editor?
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Hi,

If you add them to the modeldef.xml file, the drop down menu in the hierarchy editor will be updated to include them. The menu is build from the modeldef.xml content. To be safe you maybe need to open the hierarchy editor again after you modified the modeldef.xml file.
 
Right. As the hierarchy editor did not update to include them, I guess I must have made a mistake in the xml.
But thanks for the info.
 
But now I cannot even edit the modeldef.xml any longer. The minute I try to add a <, it throws an error: "Naam kan niet beginnen met het teken (name cannot start with the symbol).
I do not get it :confused:.
 

=rk=

Resource contributor
Please show us your XML, I'm sure it's a matter of syntax. You probably have the less than symbol in the wrong position. I have sucessfully modified the modeldef.xml, in order to produce sunglasses that render only during the day, so it does work.
 

=rk=

Resource contributor
Ok great, except to duplicate my results, I'm pretty sure you'd need to start with your default modeldef.xml and add entries to that. Try this thread for ideas.
 
Bless you, Rick.
That default modeldef.xml was where I had gone wrong (using the wrong adapted default modeldef.xml).
Now that it works in MCX, I still have to find out if it works in P3Dv4.5 (or not:()!
Will know after dinner.
Thanks a bunch.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
I'll check if typing a new condition works usually I just modify an exiting one.
 

=rk=

Resource contributor
Yes, new visibility conditions can be added. Both Arno's original example on his blog and my daytime condition, are written as new entries. I am sure it is a matter of syntax, you could probably copy/paste the entry on Arno's blog and then replace your visibility condition with his.
 
Probably you are right but I can not. I have to add the extra entry to the default modeldef.xml before I can edit anything.
Wish I knew what I am doing wrong.
Refer to this other thread as to how I feel like for the moment: a dumbfounded ass on a swabbering (neologism!) dinghy that is wondering how the heck he got himself there and how to get back to the mainland.
And no, the seasonal GP poly never shows up or it shows up all the time.
The problem is that I cannot find out whether it works or not until I shut down P3D, start it again, wait for 15 minutes and then find that it does not work.
When I load the mdl again there are no modeldef.xml entries any longer. So I have to start from scratch again and that has taken me about the whole day (the weather is bad so I had time) to do it, but to no avail.
I know I am probably doing something wrong but I have not the faintest what unless I can get some further help of some ass loving :):D experts of it over here.

PS: I cannot copy or paste, I does not work in MCX.
 

=rk=

Resource contributor
Ok, no problem, first off. You can edit the modeldef.xml in Notepad and since MCX loads from it, I usually make my edits outside MCX. Also, to save time, you can modify a model in MCX, while P3D runs and then call the new model from within the running P3D session. I know this from running many trial and error cycles with my glasses model and I see that you say that you intend to work with a GP - so - if this test and reload cycle does not work with a scenery ground polygon, which I believe it should, you can, for testing purposes, compile as a model object and test that way, until you have the vis condition right, then compile as a valid ground polygon.

Finally, it would probably be best to see what you have so far, if you could upload your modeldef.xml.
 
Here is my modeldef.xml entry:

<PartInfo>
<Name>season_winter_snow</Name>
<Visibility>
<Parameter>
<Code>
(E:ZULU MONTH OF YEAR, number) 10.0 &gt;= (E:ZULU MONTH OF YEAR, number) 3.0 &lt;= and if{ 1 } els { 0 }
</Code>
</Parameter>
</Visibility>
</PartInfo>
 
Well, how can anything be greater than 10 and less than 3?

Why don't you use (or adapt) the ready-made vis called season_winter (in the 4.5 modeldef), which correctly has an 'or' as the only logical logical connective:

Quote:
Code:
         (E:ZULU MONTH OF YEAR, number) 12.0 &gt;= (E:ZULU MONTH OF YEAR, number) 2.0 &lt;= or if{ 1 } els{ 0 }
 
Last edited:
Thanks, mjahn.
Did that already. Did not work. But I probably did something wrong once more (like forgetting to change the entry in the hierarchy editor). Checking once more.
Other question: how do you point your modeldef.xml path to some changed path. I do not seem to find any way to do that (I copied the original modeldef.xml to my temp folder where I add and make changes).
And my final question: How do you change the modeldef.xml entries AFTER you have used the GPW? MCX does not honor them as far as my experience goes.
 
As long as the MCX path is set up correctly, why change it. Just make a backup copy of the current modeldef, edit it, and see if your new code is accessible. Other than that I am out of my comfort zone; scenery isn't my thing.
 

tgibson

Resource contributor
Hi,

I think you have to reload the object to be converted before the modeldef file will change with your edits.

You set the path to the modeldef file in Options/FS Related Settings/ModelDefPath.

Hope this helps,
 

=rk=

Resource contributor
Well, how can anything be greater than 10 and less than 3?
Via this logic sir:

(E:ZULU MONTH OF YEAR, number) 12.0 &gt;= (E:ZULU MONTH OF YEAR, number) 2.0 &lt;= or if{ 1 } els{ 0 }
[/CODE]
Above is a direct copy/paste from the default P3Dv4.4 seasonal visibility condition section of the modeldef.xml. It goes without saying that it works, as written. Us scenery guys naturally recognize the implied sequencing of the calendar months, 1 through 12.

Other question: how do you point your modeldef.xml path to some changed path. I do not seem to find any way to do that (I copied the original modeldef.xml to my temp folder where I add and make changes).
Please don't trouble yourself with this step. I have applied a very similar variation of the above code to the attached modeldef.xml. Please locate the existing modeldef.xml to which MCX points, rename that file and place the attached file there. The next time you open MCX, the condition "season_winter_snow" will be available in the hierarchy editor. I do not specifically know how to apply the condition to a ground polygon. Could you not create the GP, re-import it and again compile it with the visibility condition applied?
 

Attachments

Top