Jump to content
Sign in to follow this  
Guest airhead

HOORAY! How to force sub-panel to open "undocked..."

Recommended Posts

It took a bit of faffing about, but I finally found a way to force a sub-panel to open in the 2d in an "undocked window..."I needed the gauge displayed to remain visible even if the user switches view modes, such as 2d or VC to Spot View.The solution is simple, yet elusive. The key lay in realizing that any sub-panel opened in any mode other than 2d View is by default "undocked."BOOL FSAPI mouse_cb0( PPIXPOINT relative_point, FLAGS32 mouse_flags){trigger_key_event (KEY_VIEW_MODE,0) ; trigger_key_event (KEY_PANEL_ID_TOGGLE,250) ; trigger_key_event (KEY_VIEW_MODE_REV,0) ; return FALSE;}The sequence KEY_VIEW_MODE; KEY_PANEL_ID_TOGGLE,250; KEY_VIEW_MODE_REV happens so quickly that the screen never "blinks..."Basically, it forces the sim to change to VC mode, open the sub-panel, then switch back to the 2d mode... Elegant and simple! ;)Hopefully this will help anyone else who might have a need for this.


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

Unfortunately, the "trick" doesn't work in Full Screen Mode... ;(I sure hope MS fixes this in the next version...


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

Bill,This seems to work, and could be refined to suit your needs. When you switch views away from the panel, you get an instance of PANEL_SERVICE_PANEL_CLOSE. Use this as a trigger to open the panel window you want.int panel_delay, panel_switch = 0;case PANEL_SERVICE_PANEL_CLOSE: panel_delay = 3; panel_switch = 1;break;case PANEL_SERVICE_PRE_UPDATE:if ( panel_switch == 1 ) panel_delay--;if ( panel_delay <= 0 ) { panel_switch = 0; panel_delay = 3; if ( !is_panel_window_visible_ident(0) ) panel_window_open_ident ( 50 ); }break;

Share this post


Link to post
Share on other sites

>Bill,>>This seems to work, and could be refined to suit your needs. >When you switch views away from the panel, you get an instance>of PANEL_SERVICE_PANEL_CLOSE. Use this as a trigger to open>the panel window you want.>if ( panel_switch == 1 ) panel_delay--;Thanks, Doug. I can't wait to try it out. I'm a bit unclear about the purpose of "panel_delay--;" though?Bill


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

I originally put this line directly in the PANEL_CLOSE case: if ( !is_panel_window_visible_ident(0) ) panel_window_open_ident ( 50 );It didn't work. I instituted the delay to ensure that the main panel would actually be closed by the time the test got made.Doug

Share this post


Link to post
Share on other sites

>I originally put this line directly in the PANEL_CLOSE case:> if ( !is_panel_window_visible_ident(0) )>panel_window_open_ident ( 50 );>It didn't work. I instituted the delay to ensure that the>main panel would actually be closed by the time the test got>made.BTW, I'm fixing to roll this solution into my invisible "hot spot" gauge that actually calls this window to see how it works... ;)FOUR MINUTES AND THIRTY-SEVEN SECONDS LATER...Doug, this works FANTASTIC! You are a true GEM... Thanks ever so much for the kindness! :-beerchug


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

I had to add a simple bit of "check code" to make sure that the sub-panel window is supposed to be open, but that was a trivial bit of effort. Thanks again!


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

Good to hear that it worked for you! As it turns out, the same procedure fixed a problem I was having with controlling propellor animations. It's a good thing you asked the question.Doug

Share this post


Link to post
Share on other sites

>Good to hear that it worked for you! As it turns out, the>same procedure fixed a problem I was having with controlling>propellor animations. It's a good thing you asked the>question.Serendipity strikes again! ;) I was tooling though the makemdl.parts.xml file and was somewhat surprised to find a snippet of code that was commented out by MS themselves:

<!--<part>	<name>LightGlass</name>	<effect>		<filename>fx_landing</filename>		<is_light>true</is_light>	</effect></part><part>	<name>light_land</name>	<effect>		<filename>fx_landing</filename>		<is_light>true</is_light>	</effect>	<visible_mask>		<keyword>light_states</keyword>		<mask>LIGHT_LANDING_MASK</mask>	</visible_mask></part>-->

It appears as though they were planning to implement a scheme to attach effects in the .mdl directly through the XML code... I guess they couldn't get it to work? :)


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest airhead

Saw that little bit as well, Bill. Looks like they were working on it, but bagged it for FS9 for some unknown reason (time, problems?). I believe in CFS3 they were defining internal "points" for attaching external effects for guns (muzzle flash, shell eject), damage (oil, coolant), etc., so apparently they can get that much to work. This would certainly simplify placing effects, as well as taking care of the issues with certain effect file parameters having no effect in regards to placement. I guess only time will tell if this shows up in the next version...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...