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

FS2004 Help with a set of 3d parts: visibility issues (SOLVED)

Messages
1,407
Country
mexico
Hello lads

I am working with springed buttons and I need to learn more about <minvalue> </minvalue> and <maxvalue> </maxvalue> statements.

For example, this part code is working as I am expecting: The part named bell429_CAL_TOGGLE_cc_sw is the button itself; while bell429_CAL_AUTO_annun_on and bell429_CAL_MAN_annun_on are just detached polygons from the button and both were slightly moved upward. Their function is "turn on" or "turn off" depending on the value assigned by a left mouse click. Both polygons are linked to bell429_CAL_TOGGLE_cc_sw, so they can travel together within the animation (which is ok and it is doing what I need). The button has three states:

- no click: both annunciators off.
- 1st click: CAL AUTO annunciator is on and CAL MAN annunciator is off.
- 2nd click: CAL AUTO annunciator is off and CAL MAN annunciator is on.
- 3rd click: the cycle will begin again.

HTML:
    <!-- Row 1_SW 3 CAL TOGGLE AUTO-MAN springed button with an annunciator lamp which toggles ON/OFF only -->
            <!-- CAL_TOGGLE Button animation-->
      <part>
          <name>bell429_CAL_TOGGLE_cc_sw</name>
              <animation>
                  <parameter>
                      <code>
                          (L:bell429_CAL_TOGGLE_button,bool) 100 *
                      </code>
                      <lag>200</lag>
                  </parameter>
              </animation>
              <mouserect>
              <cursor>Hand</cursor>
              <tooltip_text>CAL TOGGLE</tooltip_text>
              <callback_code>
                      (L:bell429_CAL_TOGGLE_button,bool) ! (&gt;L:bell429_CAL_TOGGLE_button,bool)
                      (L:bell429_CAL_TOGGLE_control, number) ++ 3 % (&gt;L:bell429_CAL_TOGGLE_control, number)
              </callback_code>
              </mouserect>
      </part>

            <!-- CAL AUTO Annunciator toggle -->
   <part>
    <name>bell429_CAL_AUTO_annun_on</name>
    <visible_in_range>
       <parameter>
             <code>
             (A:Circuit general panel on, bool) (L:bell429_CAL_TOGGLE_control, number) 1 == &amp;&amp;
             if{ 1 } els{ 0 }
             </code>
       </parameter>
       <minvalue>1</minvalue>
    </visible_in_range>
   </part>

            <!-- CAL MAN Annunciator toggle -->
   <part>
    <name>bell429_CAL_MAN_annun_on</name>
    <visible_in_range>
       <parameter>
             <code>
             (A:Circuit general panel on, bool) (L:bell429_CAL_TOGGLE_control, number) 2 == &amp;&amp;
             if{ 1 } els{ 0 }
             </code>
       </parameter>
       <minvalue>1</minvalue>
    </visible_in_range>
   </part>

I used an exact replica of this code in other button and now, both annunciators are turning on at the same time; I don't understand why. Can you spot the difference?
HTML:
      <!-- Row 1_SW 2 NORM/ZOOM springed button with an annunciator lamp which toggles ON/OFF only -->
            <!-- NORM_ZOOM Button animation-->
      <part>
          <name>bell429_NORM_ZOOM_cc_sw</name>
              <animation>
                  <parameter>
                      <code>
                          (L:bell429_NORM_ZOOM_button, bool) 100 *
                      </code>
                      <lag>200</lag>
                  </parameter>
              </animation>
              <mouserect>
              <cursor>Hand</cursor>
              <tooltip_text>NORM/ZOOM</tooltip_text>
              <callback_code>
                      (L:bell429_NORM_ZOOM_button, bool) ! (&gt;L:bell429_NORM_ZOOM_button, bool)
                      (L:bell429_NZ_control, number) ++ 3 % (&gt;L:bell429_NZ_control, number)
              </callback_code>
              </mouserect>
      </part>

            <!-- NORM Annunciator toggle -->
   <part>
    <name>bell429_NORM_annun_on</name>
    <visible_in_range>
       <parameter>
             <code>
             (A:Circuit general panel on, bool) (L:bell429_NZ_control, number) 1 == &amp;&amp;
             if{ 1 } els{ 0 }
             </code>
       </parameter>
       <minvalue>1</minvalue>
    </visible_in_range>
   </part>

            <!-- ZOOM Annunciator toggle -->
   <part>
    <name>bell429_ZOOM_annun_on</name>
    <visible_in_range>
       <parameter>
             <code>
             (A:Circuit general panel on, bool) (L:bell429_NZ_control, number) 2 == &amp;&amp;
             if{ 1 } els{ 0 }
             </code>
       </parameter>
       <minvalue>1</minvalue>
    </visible_in_range>
   </part>

As a side note, in all annunciators I've been using in the Bell 429, I used <minvalue>1</minvalue> without any trouble...until now. I don't know if this is related or not; and most important: how? If I understood well, the 'and' expressions will return a value of '1' if they are true and '0' otherwise. So, the <minvalue>1</minvalue> expressions are saying that the polygons will only visible when the 'and' expressions are true, Am I right?

Also, related to this, the only explanation about <minvalue> </minvalue> statment I was able to find, was made by Tom Gibson and I will show my personal note about it:

For a 3d part, "visible_in_range" statement explanation by Tom Gibson.

General syntax:
HTML:
  <part>
  <name>###</name>
  <visible_in_range>
  <parameter>
    <code>
      .
      .
      .
    </code>
  </parameter>
  <minvalue>A</minvalue>
  <maxvalue>B</maxvalue>
  </visible_in_range>
  </part>

Where ### is the part name; note that it is just "inside" that statement /endstatement pair (<visible_in_range> </visible_in_range>). A, B are constants.

"In range" is set by the minvalue statement.
True is 1 or greater, false is less than that.

If the value is less than 1, then the visible_in_range statement is outside the range (i.e. false) and the part becomes invisible.

///////////////////////////////////////////////////////////////
/// This is opposed to the more usual boolean ///
/// determination - 0 is false; anything else is true. ///
//////////////////////////////////////////////////////////////

Nevertheless, I tried different values combining <minvalue> </minvalue> with <maxvalue> </maxvalue> statements. Can anybody would be so kind to provide a more detail explanation about those statements?

In advance, thank you.
All the best,
Sergio.
 
Last edited:

tgibson

Resource contributor
Messages
10,801
Country
us-california
Hi,

I use 1 as a minvalue as well and it works OK.

Did you check that both annunciators have the correct name in your CAD program? Check that one is NORM and one is ZOOM.

Are you sure that you don't have some old code in the makeMDL file used by another part that also affects those variables?
 
Messages
1,407
Country
mexico
Hi Tom

I performed a double check on variable names; also, I changed them a few times and the result is the same. I will swap variable names one more time and see what happens.

Are you sure that you don't have some old code in the makeMDL file used by another part that also affects those variables?
As I am using ULE, that's imperative. So far, I've been careful each time I made changes on those files. It won't hurt to study them again and see for strange and/or duplicated variable names.

Related to visibility conditions and <minvalue> </minvalue> statement, I found this useful information which complements yours (made by Fr. Leaming):

Visiblility Controled By Custom L: Boolean Variable:

In the following example, a custom L:var (bool) is used to control visibility. The <minvalue> of 1 insures that whatever parts are Linked to the <name> node in GMax will be visible only when the bool variable is TRUE ( =1)
HTML:
<part>[/I]
[I]     <name>SR20_chute_down</name>
                 <visible_in_range>
                      <parameter>
                           <code>(L:ChuteDown, number)</code>
                       </parameter>
                       <minvalue>1</minvalue>
                 </visible_in_range>
</part>

Visiblility Controled By Range of Custom L: Variable:

In the following example, a custom L:var is used to control visibility. Using <minvalue> and <maxvalue>, will cause whatever parts are Linked to the <name> node in GMax wil be visible only when the variable is within the range of values specified
Code:
HTML:
<part>

      <name>chute_down_vis1</name>
             <visible_in_range>
                   <parameter>
                        <code>(L:ChuteTimer, number)</code>
                    </parameter>
                    <minvalue>325</minvalue>
                    <maxvalue>399</maxvalue>
            </visible_in_range>
</part>

In both of the cases above, I've illustrated use of a custom L: variable. You can use the exact same templates with a stock FS variable.


Thank you.
 
Last edited:
Messages
1,407
Country
mexico
Hello

I verified names in all makemdl.parts.xml files and I cound't find repeated part or variable names -which is good-; did the same in my Gmax files. I'll keep working on code variations to see what could be wrong.
 
Messages
1,407
Country
mexico
Hi there

I found the problem. Somehow, the button and both annunciators were corrupted. I suspect I did a the following:
I reseted the Xform with all items linked together; big mistake. That is my best shoot of what happened.

AFAIK, the only possible solution for this is one of the following:
  • Merge the offending part(s) from an unaltered scene or... model a new one if you have to.
  • In my case: I have in a safe place all parts which have been imported from 3DS Max.
  • I deleted all offending parts and merged a fresh button, "brand new" if you want into the scene.
  • After that, I detached the polygons wich will serve as annunciators and just to be sure anything couldn't be wrong with animations; I reseted the Xform in the three parts before to link them again.
Just a reminder of this; many times we've been warned!!! Before to reset the Xform in a set of parts which you are certain (or suspect) were linked, unlink them before you reset their Xform. Failing to this, you will be in the same boat as I was: You will not be able to detect possible errors in animations! Everything will seem to you "fine" and it won't.

With "clean" parts, I set the new pivots and animate in the usual way. Now, the switch is doing exactly what is meant to be and everything is fine; finally...:teacher:

I really hope that this could save someone many headaches; thank you all.

All the best,
Sergio.

P.S. The scripts in the begining of this thread, are the ones I am using now; they work like a charm! ;)
 
Last edited:

n4gix

Resource contributor
Messages
11,662
Country
unitedstates
Ah, Sergio got bitten by the "Linked X-Form Rescale Disaster!"

Here are some hints to perhaps save some extra work in the future:
  1. Always Save As (next iteration number) your work prior to making any Scale Reset operations, or any other major un-recoverable changes for that matter.
  2. Open the Dope Sheet to verify that the Scale on any specific object needs to be Reset.
  3. Isolate the objects (including any that are Linked) from the rest of the scene by "Hiding" all other parts.
  4. Unlink any Linked objects.
  5. Perform your Scale Reset operation. If things go sideways, load your previously saved scene and recover your work!
  6. If the (re)Scale worked correctly, (re)Link the objects and Unhide the rest of the scene's objects.
  7. Save As (next iteration number) to establish a safe fallback file for the future.
I must emphasize the absolute necessity of saving your work frequently!
 
Messages
1,407
Country
mexico
Hello Fr. Leaming

As always, the information kindly provided is very welcome! With Tom's help and yours combined, this is for sure a complete walk around of this potential issue.

In the earlier days, I learned from many develeopers the good habit to save frequently using incremental naming convention.

Thank you very much.
All the best,
Sergio.
:)
 
Last edited:
Top