• 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 visibility conditions for scenery objects

tgibson

Resource contributor
Messages
11,327
Country
us-california
Rick,

Please note that the code says OR, while Manfred and the original poster said AND. A big difference.
 

=rk=

Resource contributor
Messages
4,450
Country
us-washington
Indeed...are you sure that and was there? I try to copy/paste whenever possible, so it didn't even occur to my simple mind, that the operator, or whatever you call the and/or term, had been changed from the norm. Anyway, the XML has the "or" term.
 
Messages
5,214
Yep, the AND code was. Sorry.
I have tried so many changes to the modeldef.xml that I was not sure anymore which one I tried last.
But still, the original thread read that I could not add a new entry in MCX for the modeldef.xml as long as I did not put it in the default xml first! And I can still not!
Once you have used the GPW, I can not change anything anymore because the modeldef.xml shows blank and I get an error when I want to write something in it.
That is why (on Rick's advice) I made a copy of the default one and wrote in my own extra entry for the thing I wanted to do and point MCX to the copy of it.
I then could not find (and still could not) find a way to point MCX to the path of this copy. Must have overlooked it 10 times at the least.
I also tried OR in mjahn's
(E:ZULU MONTH OF YEAR, number) 12.0 >= (E:ZULU MONTH OF YEAR, number) 2.0 <= or if{ 1 } els{ 0 }
[/CODE] already before he said it was not a logical thing to do, but that gave me a texture/polygon that showed up in all seasons.
Also, I do not think it is necessary to define visibility once again after having used the GPW because then the polygon does not show up anymore at all and if I do not change it afterwards, it does.
Gee, I wish I could share screens with somebody to explain better. I am on Skype (not to day any longer because it is dinner time but perhaps tomorrow?).

Cheers,

Roby
 

tgibson

Resource contributor
Messages
11,327
Country
us-california
Arno,

I just got the same unhandled exception in the MCX modeldef editor when trying to change <Sim> to <Code>. I entered Edit mode, double clicked the word Sim to select it and then typed the letter C. Got the error.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,859
Country
netherlands
I haven't looked at the crash yet, but will try to do it soon.
 

=rk=

Resource contributor
Messages
4,450
Country
us-washington
Toby, please confirm that you replaced the original modeldef.xml with the one I uploaded with your visibility condition added. If this works, as I believe it will, we could go about adapting it to your procedure.
 

rhumbaflappy

Administrator
Staff member
Resource contributor
Messages
5,932
Country
us-wisconsin
Using the 4.5 SDK default modeldef.xml, you set the visibility condition using the Hierarchy Editor. This image is for summer season only:

VisibilityCondition.png


And it works for me.
 

rhumbaflappy

Administrator
Staff member
Resource contributor
Messages
5,932
Country
us-wisconsin
And regarding the modeldef.xml... you don't need that at all. you can create a file called seasons.xml, and use that as the dictionary:

seasons.png


Here's that file containing just code for the seasons.

XML:
<?xml version="1.0" encoding="utf-8" ?>
<ModelInfo>

  <!-- Season visibility -->

  <PartInfo>
  <Name>season_spring</Name>
    <Visibility>
      <Parameter>
        <Code>
          (E:ZULU MONTH OF YEAR, number) 3.0 &gt;= (E:ZULU MONTH OF YEAR, number) 5.0 &lt;= and if{ 1 } els{ 0 }
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>

  <PartInfo>
    <Name>season_summer</Name>
    <Visibility>
      <Parameter>
        <Code>
          (E:ZULU MONTH OF YEAR, number) 6.0 &gt;= (E:ZULU MONTH OF YEAR, number) 8.0 &lt;= and if{ 1 } els{ 0 }
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>

  <PartInfo>
    <Name>season_fall</Name>
    <Visibility>
      <Parameter>
        <Code>
          (E:ZULU MONTH OF YEAR, number) 9.0 &gt;= (E:ZULU MONTH OF YEAR, number) 11.0 &lt;= and if{ 1 } els{ 0 }
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>

  <PartInfo>
    <Name>season_winter</Name>
    <Visibility>
      <Parameter>
        <Code>
          (E:ZULU MONTH OF YEAR, number) 12.0 &gt;= (E:ZULU MONTH OF YEAR, number) 2.0 &lt;= or if{ 1 } els{ 0 }
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>

  <!-- end season visibility -->

</ModelInfo>

Exit MCX after pointing to the xml file you want, then restart MCX. It loads and uses the new Dictionary. You can verify it's presence by the Object Hierarchy button when you assign the visibility.
 
Messages
5,214
And finally it works for me too. Better late than never!
Now on to the texturing part
Thank you all,

Roby
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,859
Country
netherlands
Hi,

I had a look at the crash. This indeed happened when the XML code in the editor was not valid and could not be parsed. If you pasted an entire new block of XML code in the editor it would work, but not if you would type the lines.

I have now hopefully made the editor more robust, it will be in the next development release. When you type invalid code, it will keep the parsed modeldef as it was before (so without your edits) and a red marking is shown in the editor to indicate which line has a problem. Once the XML code is valid again it will be fully parsed again and all your changes are available.

Hopefully this makes it more robust, but let me know if there are still issues.
 

rhumbaflappy

Administrator
Staff member
Resource contributor
Messages
5,932
Country
us-wisconsin
Glad you got it working! As far as I know, only the E: variables will work. The O: variables, which are supposed to be for library objects, don't seem to work.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,859
Country
netherlands
In scenery only a limited set is supported indeed, mainly E, but I thought even that not complete. But it's better than nothing.
 
Messages
5,214
They should work somehow (maybe not yet in MCX) because I have seen them in some payware.
Maybe it was a Lua script?
 

Pyscen

Resource contributor
Messages
2,993
Country
us-texas
Hi,

I had a look at the crash. This indeed happened when the XML code in the editor was not valid and could not be parsed. If you pasted an entire new block of XML code in the editor it would work, but not if you would type the lines.

I have now hopefully made the editor more robust, it will be in the next development release. When you type invalid code, it will keep the parsed modeldef as it was before (so without your edits) and a red marking is shown in the editor to indicate which line has a problem. Once the XML code is valid again it will be fully parsed again and all your changes are available.

Hopefully this makes it more robust, but let me know if there are still issues.

Hello Arno,

I haven't received any notifications concerning this update as of yet.
 
Messages
5,214
Thank you, Arno.
But I have another question:p: would it be possible to also enable "copy and paste"?
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,859
Country
netherlands
You can already copy and paste. Why you think it's disabled?
 
Messages
5,214
I hate to continue this thread but still I think that it is worthwhile (unless I am this dumb ass pictured in this other thread:)):
Looks like the following modeldef.xml does not work (at least not on my computer in P3Dv4,5):
<PartInfo>
<Name>Vis time of day</Name>
<Visibility>
<Parameter>
<Code>
(E:TIME OF DAY, Enum) 2 &gt;= (E:TIME OF DAY, Enum) 0 &lt;= or if{ 1 } els { 0 }
</Code>
</Parameter>
</Visibility>
</PartInfo>
In the hierarchy editor it shows as 'custom_vis_time_of_day_00' and the modeldef.xml also shows it that way (but only afterwards).
Once more I am probably doing something wrong but I based myself on the info that I found in this thread.
For sure you have to read it through to the end at least 10 times and you will still not be sure of what is the right way to do it as a consequence of contradicting or less than complete info (I also tried it with 'number' instead of 'Enum' but to no avail).
But the seasons do work (at least they did before Arno updated MCX and I have not yet checked whether it still works).
One more thing I noticed is that (once more, on my computer AFAIK) the seasonal variations of Ground poly only work if you close down P3D and start anew in a different season i.e. starting in winter and then go to summer, the snow would still be there. But if you started in summer no snow would show up and changing to winter season it would, but not vice versa.
So much for my findings for today.

Cheers,

roby
 
Top