• 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

Messages
5,214
You can already copy and paste. Why you think it's disabled?
I have not the faintest but I cannot copy the content of the modeldef.xml out of the modeldef.xml editor nor paste anything in it.
I can now add everything by hand and change things without running errors, so that is OK now.
 

rhumbaflappy

Administrator
Staff member
Resource contributor
Messages
5,947
Country
us-wisconsin
Try using this...

XML:
  <!-- time of day visibility -->

  <PartInfo>
    <Name>dawn</Name>
    <Visibility>
      <Parameter>
        <Code>
          (E:TIME OF DAY, enum) 0 == if{ 1 } els{ 0 }
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>

  <PartInfo>
    <Name>day</Name>
    <Visibility>
      <Parameter>
        <Code>
          (E:TIME OF DAY, enum) 1 == if{ 1 } els{ 0 }
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>

  <PartInfo>
    <Name>dusk</Name>
    <Visibility>
      <Parameter>
        <Code>
          (E:TIME OF DAY, enum) 2 == if{ 1 } els{ 0 }
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>

  <PartInfo>
    <Name>night</Name>
    <Visibility>
      <Parameter>
        <Code>
          (E:TIME OF DAY, enum) 3 == if{ 1 } els{ 0 }
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>

    <PartInfo>
    <Name>dawn_or_dusk</Name>
    <Visibility>
      <Parameter>
        <Code>
          (E:TIME OF DAY, enum) 0 == (E:TIME OF DAY, enum) 2 == or if{ 1 } els{ 0 }
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>

  <!-- end time of day visibility -->
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,885
Country
netherlands
I have not the faintest but I cannot copy the content of the modeldef.xml out of the modeldef.xml editor nor paste anything in it.
I can now add everything by hand and change things without running errors, so that is OK now.

With Ctrl-V you can pasted. I have pasted in samples from this thread into the editor this week. Of course edit mode must be enabled.
 

rhumbaflappy

Administrator
Staff member
Resource contributor
Messages
5,947
Country
us-wisconsin
Let's try something else. An object that is to be displayed at dawn, dusk, and night. There are 2 ways to do this.

XML:
    <PartInfo>
    <Name>no_day</Name>
    <Visibility>
      <Parameter>
        <Code>
          (E:TIME OF DAY, enum) 0 == (E:TIME OF DAY, enum) 2 == (E:TIME OF DAY, enum) 3 == or or if{ 1 } els{ 0 }
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>

    <PartInfo>
    <Name>no_day_better</Name>
    <Visibility>
      <Parameter>
        <Code>
          (E:TIME OF DAY, enum) 1 != if{ 1 } els{ 0 }
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>
 

rhumbaflappy

Administrator
Staff member
Resource contributor
Messages
5,947
Country
us-wisconsin
Here's something really twisted. It shows an object from dusk to dawn, but only during the summer. It is based from the no_day above, to show the use of even more variable conditions.

XML:
    <PartInfo>
    <Name>no_day_summer_only</Name>
    <Visibility>
      <Parameter>
        <Code>
          (E:ZULU MONTH OF YEAR, number) 6.0 &gt;= (E:ZULU MONTH OF YEAR, number) 8.0 &lt;= (E:TIME OF DAY, enum) 0 == (E:TIME OF DAY, enum) 2 == (E:TIME OF DAY, enum) 3 == or or and if{ 1 } els{ 0 }
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>

Note the or or and order. We loaded the 'stack' with conditions. Then we bring them off in the reverse order. We detect night or dusk or dawn, and it must be summer.
 

rhumbaflappy

Administrator
Staff member
Resource contributor
Messages
5,947
Country
us-wisconsin
More complicated yet:

XML:
    <PartInfo>
    <Name>not_2018_no_day_summer_only</Name>
    <Visibility>
      <Parameter>
        <Code>
          (E:LOCAL YEAR, number) 2018 != (E:LOCAL MONTH OF YEAR, number) 6.0 &gt;= (E:LOCAL MONTH OF YEAR, number) 8.0 &lt;= (E:TIME OF DAY, enum) 0 == (E:TIME OF DAY, enum) 2 == (E:TIME OF DAY, enum) 3 == or or and and if{ 1 } els{ 0 }
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>
 

rhumbaflappy

Administrator
Staff member
Resource contributor
Messages
5,947
Country
us-wisconsin
Last one for now:

This uses the object variable O:Weather.AmbientTemperature. It will display when using the Winter Wonderland weather theme... apparently the temps in that theme are at or below zero Celsius. Rick could use it to display a wool hat on his driver.

XML:
    <PartInfo>
    <Name>below_zero</Name>
    <Visibility>
      <Parameter>
        <Code>
          (O:Weather.AmbientTemperature, number) 0 &lt;= if{ 1 } els{ 0 }
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,885
Country
netherlands
Just a side note, inspired by all this discussion, I have started on implementing support for seasonal textures in the GPW with P3Dv4 output and also for normal P3Dv4 mdl files in MCX.
 
Messages
5,214
Great!

Thank you all once more.

PS: Arno, with ctrl+v it works but like I did it (by right clicking mouse and selecting paste) it did not.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,885
Country
netherlands
Ah, I never use the mouse to copy paste. Let me check what happens there.
 
Messages
5,214
Try using this...
etc...
That one is still intriguing me in MCX. In fact when I use those separate dawn, dusk, day and night entries, I would have to have several parts to do it because the hierarchy editor only shows either dawn, dusk, day or night!
Also thank you for explaining that you must interpret the OR OR AND in reverse. That is also an eyeopener for me.
 

rhumbaflappy

Administrator
Staff member
Resource contributor
Messages
5,947
Country
us-wisconsin
O:Weather.AmbientPrecipRate works.

XML:
    <PartInfo>
    <Name>precipitation</Name>
    <Visibility>
      <Parameter>
        <Code>
          (O:Weather.AmbientPrecipRate, enum) 0 != if{ 1 } els{ 0 }
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>

This displays an object if it is raining or snowing.

I can't get O:Weather.AmbientPrecipState to work. Maybe someone else can get it. You could have some snow on a doghouse roof as a model part when cold, and a lot more snow as a roof part if cold and precipitating, and no snow if not cold.

In P3D if I set the weather as cold and snow, then change the season to summer, it still shows cold and snow conditions. Cold objects and precip objects will still show. You could set conditions for date and temp and/or precip and maybe escape the problem of not being able to use O:Weather.AmbientPrecipState. If it rains below 0 temps, at least you would have ice over the existing snow.
 

rhumbaflappy

Administrator
Staff member
Resource contributor
Messages
5,947
Country
us-wisconsin
Wind of 15 knots+ :

XML:
    <PartInfo>
    <Name>wind_velocity_15kn+</Name>
    <Visibility>
      <Parameter>
        <Code>
          (O:Weather.AmbientWindVelocity, feet per second) 25.31496 &gt; if{ 1 } els{ 0 }
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>

Wind from the westerly direction:

XML:
    <PartInfo>
    <Name>wind_westerly</Name>
    <Visibility>
      <Parameter>
        <Code>
          (O:Weather.AmbientWindDirection, degrees) 255 &gt;= (O:Weather.AmbientWindDirection, degrees) 285 &lt;= and if{ 1 } els{ 0 }
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>

Combining these in combinations for a windsock might be a big undertaking. Lots of parts. Not sure if any of this can be used with animation, or if you'd use attachments, or use MCX merge function for parts.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,885
Country
netherlands
Dick, interesting to read that more variables work for scenery now. Last time I looked most weather things did not work.
 

rhumbaflappy

Administrator
Staff member
Resource contributor
Messages
5,947
Country
us-wisconsin
Hi Christian.

Ha! You're right. I must have tried a dozen things. So simple. Thanks for replying. :)

XML:
    <PartInfo>
    <Name>rain</Name>
    <Visibility>
      <Parameter>
        <Code>
          (O:Weather.AmbientPrecipState, mask) 4.0 == if{ 1 } els{ 0 }
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>

    <PartInfo>
    <Name>snow</Name>
    <Visibility>
      <Parameter>
        <Code>
          (O:Weather.AmbientPrecipState, mask) 8.0 == if{ 1 } els{ 0 }
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>
 
Messages
5,214
Dick, since you are a moderator, I think it is worthwhile to make sure that this thread is made a sticky!
Now I have to always add some unhelpful comments to be able to find it back afterwards (I have read it dozens of times already and still need to once in a while check this thread to see where I went wrong again:().
I would think that Arno could agree also?
 

rhumbaflappy

Administrator
Staff member
Resource contributor
Messages
5,947
Country
us-wisconsin
Hi Roby.

I've stuck it for now, and Arno or I can unstick it later if it is no longer needed or relevant.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,885
Country
netherlands
I got inspired to update MCX with some features so you don't have to fiddle with the modeldef.xml and the reverse Hungarian notation yourself anymore. Working on it :)
 

rhumbaflappy

Administrator
Staff member
Resource contributor
Messages
5,947
Country
us-wisconsin
Now that we know how to change the visibility of a model's part with RPN code, is there a way to change a texture with RPN code?
 
Top