Jump to content

Recommended Posts

Posted

This is a note for developers.  X-Plane handles interior lighting with two datarefs:

sim/cockpit2/switches/instrument_brightness_ratio[n]

sim/cockpit2/switches/panel_brightness_ratio[n]

These datarefs are arrays that hold up to 16 values (indexes 0-15).  The range of value is between zero and one.  The default values found in these array variables when loading an aircraft is 0.75 for all indicies.

When using a plug-in to manage these datarefs, it is important that you reset all the array values of these datarefs to 0.75 when unloading the aircraft, otherwise, the next aircraft loaded can load with the previous lighting settings.  If the previous aircraft had some lighting set to zero, then the next aircraft loaded can have dark instrumentation and look like the unit is off when it is not.

Here's the code I use to set lighting upon exiting the aircraft:

void Controls_reset_lighting(void)
{
float i[16] = {0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75,};
XPLMSetDatavf(xp_DR_inst_brt, i, 0, 16);
XPLMSetDatai(xp_DR_nav2_power, 1);
XPLMSetDatai(xp_DR_gps_fuse, 1);

}

Posted

Tom,

Would it also be a good idea to set/reset all the values of the same Datarefs on "startup" of the plugin for "your" aircraft, thus insuring that no matter what any other aircraft plugin does "yours" will always work as designed?

Jim

Posted

Definitely, and I do that on the Falco...at least on a lot of datarefs, I could probably stand to do it on a few more, but it's the "cleanup" on exit that is a courtesy to the end user so they don't have problems with subsequent aircraft that I was wanting to convey.

Something about setting datarefs by plugin is carrying over to the following loaded aircraft.  I'll ask about this one to laminar.

Posted

When using a plug-in to manage these datarefs, it is important that you reset all the array values of these datarefs to 0.75 when unloading the aircraft, otherwise, the next aircraft loaded can load with the previous lighting settings.  If the previous aircraft had some lighting set to zero, then the next aircraft loaded can have dark instrumentation and look like the unit is off when it is not.

Maybe this should be logged as a bug so Austin/Ben can fix?  Seems to me that XPlane should be resetting all datarefs to a default state upon loading an aircraft.

Posted

there's 4,000+ datarefs to audit.

we're in a growing phase for x-plane where it is moving into a phase where plugins almost didnt exist to where they're basically required to do anything interesting.

quirks like this are to be expected, its good to raise them, but its best to do it in a way that doesnt point any fingers to angrily. :)

  • Downvote 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...