1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Visibilty tag on Aircraft

Discussion in 'Modeling' started by Devinci, 15/4/12.

  1. Devinci

    Devinci

    Joined:
    27/3/10
    Messages:
    226
    Country:
    senegal
    Hello,
    I am trying to make an object appear and disappear with a click on a switch. But I'm new into xml and It's not working in fsx yet. I also have some issues with the mouse click not showing on certain objects. I tried to reset the scale and transform but without success.
    Code:
    <Animation name="TEST_SWITCH" guid="6fb8860d-52a2-4d84-8041-526c6e256644" length="50" type="Sim" typeParam2="TEST_SWITCH" typeParam="AutoPlay" />
    	<Animation name="TEST_VISIBILITY" guid="28bd9da6-7e2b-40d2-b00c-f0b30fc5c94c" length="50" type="Sim" typeParam2="TEST_VISIBILITY" typeParam="AutoPlay" />
    
    <PartInfo>
       <Name>TEST_SWITCH</Name>
       <AnimLength>50</AnimLength>
    		<Animation>
    			<Parameter>
    				<Code>(L:testswitch, bool) 100 *</Code>
    				<Lag>600</Lag>
    			</Parameter>
            </Animation>
       <MouseRect>
    			<Cursor>Hand</Cursor>
    			<tooltip_id>TEST_L:VARIABLES</tooltip_id>
    			<callback_code>
         (L:testswitch, bool) ! (>L:testswitch, bool)
    			</callback_code>
       </MouseRect>
    </PartInfo>
    
    
    <PartInfo>
       <Name>TEST_VISIBILITY</Name>
    	<VisibleInRange>
    	<Parameter>
    	  <Code>(L:testswitch, number) 100 *</Code>
     	  <Lag>10</Lag>
    	</Parameter>
    		<minvalue>0</minvalue>
    		<maxvalue>50</maxvalue>
    	</VisibleInRange>
    </PartInfo>
    
    
    I changed some code that looked like FS9 only. But in max which one should I use? (Test_Visibility or Test_ Switch) for the switch and object. Also for the mouse rect attach point?

    Thanks
  2. Devinci

    Devinci

    Joined:
    27/3/10
    Messages:
    226
    Country:
    senegal
    Here is the working. I found it here: http://www.aerodynamika.com/cgi-bin/yabb2/YaBB.pl?num=1311699730

    But the code was missing something. Also I had many issues with the different locations of modeldef.xml

    Did you know that max uses both modeldef files? the one in bin and the one in the plugin folder? I wish I knew it before! :D

    Code:
    <Animation name="hide_pilots_yoke" guid="54647385-cff7-679c-a657-9b9cd33e4f12" length="100" type="Sim" typeParam2="hide_pilots_yoke" typeParam="AutoPlay" />
        <Animation name="yoke_pilot" guid="54577386-cff7-679c-a658-ab9cd33e4f13" length="100" type="Sim" typeParam2="yoke_pilot" typeParam="AutoPlay" />
    
    <!--          Pilot's Yoke XML Scripts     -->
       <PartInfo>
        <Name>hide_pilots_yoke</Name>
            <MouseRect>
                <Cursor>Hand</Cursor>
                <TooltipText>Hide Pilot's Yoke</TooltipText>
                <CallbackCode>
                    (L:YokePilot,bool) ! (&gt;L:YokePilot,bool)
                </CallbackCode>
            </MouseRect>
       </PartInfo>
    
     
     
     <PartInfo>
        <Name>yoke_pilot</Name>
              <Visibility>
                   <Parameter>
                  <Code>(L:YokePilot,bool) 0 &gt; if{ 0 } els{ 1 }</Code>
                   </Parameter>
            </Visibility>
        </PartInfo>
  3. lionheart

    lionheart

    Joined:
    24/10/05
    Messages:
    5,979
    Country:
    us-arizona
    Hello Devinci,

    My humble apologies for not getting to you in time. I had some visibility codes that I could have shared.

    The yoke hide code is brilliant, works well.

    I have another that can hide one, unhide another (for engines and cowlings swapouts), and I have one that can switch through 3 items as well (for pilots and military loadouts) that I can share as well.

    Just let me know.


    Bill
    LHC
  4. lionheart

    lionheart

    Joined:
    24/10/05
    Messages:
    5,979
    Country:
    us-arizona
    I went ahead and posted the codes.


    This first one is Pilots; male, female, both, none. The fist block is the switch, the other 4 are the Hierarchies that disappear/appear that you attach the pilots (or things) to.
    Code:
    
        <Animation name="ave_pilot_selector" guid="25CD48DC-E813-4817-902E-0E8D2C229521" length="100" type="Sim" typeParam2="lhc_pilot_selector" typeParam="AutoPlay" />
    
    
     <PartInfo>
      <Name>ave_pilot_selector</Name>
        <Animation>
          <Parameter>
            <Code>
               (L:AVEpilot press,bool) 10 *
            </Code>
           <Lag>100</Lag>
          </Parameter>
        </Animation>
      <MouseRect>
      <Cursor>Hand</Cursor>
     <TooltipText>Pilot Selector System (%((L:AVE PILOT SHOW,enum))%{case}%{:0}Male)%{:1}Female)%{:2}Couple)%{:3}Empty)%{End}</TooltipText>
    <MouseFlags>LeftSingle+LeftRelease</MouseFlags>
    <CallbackCode>(M:Event) 'LeftSingle' scmp 0 == if{ (L:PILOT SHOW,enum) 1 + 4 % (>L:PILOT SHOW,enum) 1 (>L:XMLSND38,enum) 1 (>L:AVEpilot press,bool) } (M:Event) 'LeftRelease' scmp 0 == if{ (>L:AVEpilot press,bool) }</CallbackCode>
      </MouseRect>
      </PartInfo>
    
      <PartInfo>
        <Name>ave_pilot_male</Name>
        <Visibility>
          <Parameter>
            <Code>
              (L:AVE PILOT SHOW,enum) 0 ==
              (L:AVE PILOT SHOW,enum) 2 ==
              or
              if{ 1 } els{ 0 }
            </Code>
          </Parameter>
        </Visibility>
      </PartInfo>
    
      <PartInfo>
        <Name>ave_pilot_female</Name>
        <Visibility>
          <Parameter>
            <Code>
              (L:AVE PILOT SHOW,enum) 1 ==
              if{ 1 } els{ 0 }
            </Code>
          </Parameter>
        </Visibility>
      </PartInfo>
    
      <PartInfo>
        <Name>ave_pilot_couple</Name>
        <Visibility>
          <Parameter>
            <Code>
              (L:AVE PILOT SHOW,enum) 2 ==
              if{ 1 } els{ 0 }
            </Code>
          </Parameter>
        </Visibility>
      </PartInfo>
    
      <PartInfo>
        <Name>ave_no_pilots</Name>
        <Visibility>
          <Parameter>
            <Code>
              (L:AVE PILOT SHOW,enum) 3 ==
              if{ 1 } els{ 0 }
            </Code>
          </Parameter>
        </Visibility>
      </PartInfo>
    


    This one is for engines/cowlings swapping, etc.



    Code:
    
    
        <Animation name="lhc_luggage_unloader" guid="33AEF277-7CA7-40a1-95A0-3895B2E8A1DB" length="100" type="Sim" typeParam2="lhc_luggage_unloader" typeParam="AutoPlay" />
    
    
     <PartInfo>
      <Name>lhc_luggage_unloader</Name>
        <Animation>
          <Parameter>
            <Code>
               (L:lhc_pushbaggageunload,bool) 10 *
            </Code>
           <Lag>100</Lag>
          </Parameter>
        </Animation>
       <MouseRect>
      <Cursor>Hand</Cursor>
     <TooltipText>LUGGAGE LOAD AND UNLOAD (%((L:LHC_BAGGAGE_UNLOAD,enum))%{case}%{:0}LUGGAGE LOADED)%{:1}LUGGAGE UNLOADED)%{End}</TooltipText>
    <MouseFlags>LeftSingle+LeftRelease</MouseFlags>
    <CallbackCode>(M:Event) 'LeftSingle' scmp 0 == if{ (L:LHC_BAGGAGE_UNLOAD,enum) 1 + 2 % (>L:LHC_BAGGAGE_UNLOAD,enum) 1 (>L:XMLSND38,enum) 1 (>L:lhc_pushbaggageunload,bool) } (M:Event) 'LeftRelease' scmp 0 == if{ (>L:lhc_pushbaggageunload,bool) }</CallbackCode>
    </MouseRect>
      </PartInfo>
    
    
      <PartInfo>
        <Name>lhc_baggage_loaded</Name>
        <Visibility>
          <Parameter>
            <Code>
              (L:LHC_BAGGAGE_UNLOAD,enum) 0 ==
              if{ 1 } els{ 0 }
            </Code>
          </Parameter>
        </Visibility>
      </PartInfo>
    
    
      <PartInfo>
        <Name>lhc_baggage_unloaded</Name>
        <Visibility>
          <Parameter>
            <Code>
              (L:LHC_BAGGAGE_UNLOAD,enum) 1 ==
              if{ 1 } els{ 0 }
            </Code>
          </Parameter>
        </Visibility>
      </PartInfo>
    
    

    On the last one, you would use the first viz as Cowling on, second is Cowling Off. The engine would be linked to Cowling Off, and the Cowling linked to Cowling On. Thus, clicking Cowling Off switch will blink out the cowling and the engine instantly appears at the exact same time.

    Brilliant code. thanks to Doug Callen for that.


    Note that these use 'many' L:vars in them, so be careful in resetting them to other functions as they can be very tricky.
    Last edited: 20/4/12
  5. n4gix

    n4gix Resource contributor

    Joined:
    26/9/06
    Messages:
    9,055
    Country:
    unitedstates
    No it won't IF you have Max configured correctly!

    When I first set up Max, I configured it so that it would use only the modeldef.xml file in the ..\bin folder.

    Which is of course the same copy that GMax uses. Hence I only need to maintain a single source file for everything.

    The Max exporter will use the paths that you set up in Customize/Configure System Paths/3rd Party Plug-Ins:
    Code:
    New Entry              E:\FSX_SDK\Environment Kit\Modeling SDK\3DSM9\Plugins\
    New Entry1             E:\FSX_SDK\Environment Kit\Modeling SDK\bin\
    
    When exporting, it will look first in the ..\Plugins folder for modeldef.xml file. If it can't find it there, then it will look in the ..\bin folder!

    The path used by the compiler is of course specified in the CMD line parameter, so it can be located wherever you tell it to look...

    ...which should be of course the ..\bin folder! :D

    The GMax exporter/compiler automatically uses the single ..\bin\modeldef.xml file.
    Last edited: 20/4/12
  6. Devinci

    Devinci

    Joined:
    27/3/10
    Messages:
    226
    Country:
    senegal
    Thanks a lot Bill, this is gonna be very very useful!
  7. Devinci

    Devinci

    Joined:
    27/3/10
    Messages:
    226
    Country:
    senegal
    I only had the path to the plugin folder in max. But it seems to me the one in bin is used for the visibility and mouse clicks, etc and the one in plugin folder for animation manager.
    I also use the one in bin for the compile aircraft. I will try to only work on a single modeldef because it's very confusing.

    Thanks I'll try using both path in max, but I suppose I should delete the modeldef in the plugin folder so that max will use the one in bin?


    Regards,

Share This Page