Comments on: Plugins: Do Not Register Drawing Callbacks That Do Not Draw https:/2018/01/plugins-do-not-register-drawing-callbacks-that-do-not-draw/ Developer resources for the X-Plane flight simulator Mon, 15 Jan 2018 17:04:19 +0000 hourly 1 https://wordpress.org/?v=6.6.1 By: Steve.Wilson https:/2018/01/plugins-do-not-register-drawing-callbacks-that-do-not-draw/#comment-24793 Mon, 15 Jan 2018 17:04:19 +0000 http://developer.x-plane.com/?p=8189#comment-24793 In reply to Saar.

That works, but the older Wiki site did not require that. We would have one more step to research something, and time is valuable. Why there was any need to change the look of the information is beyond me. Developers don’t give 2 cents about how pretty a site is, only how quickly they can drive to the answers they need. Get a graphics guy involved and… 😉

Good idea to resolve the code display problem.

We have these beautiful widescreen displays these days, and they’re a boon to use, as long as practical decisions are made. The SDK site only uses half of the available width.

]]>
By: Ben Supnik https:/2018/01/plugins-do-not-register-drawing-callbacks-that-do-not-draw/#comment-24783 Sat, 13 Jan 2018 18:31:27 +0000 http://developer.x-plane.com/?p=8189#comment-24783 In reply to Ulrich.

Yeah, the use of the declaration with no buffer overrun conventions is definitely a mistake – one that dates back to the original API. In the modern extensions we’ve used callbacks, so that no one is ever filling in someone else’s buffer.

This kind of thing is hard to fix – a wise person once told me (one blog commment ago 😉 that amongst the golden rules of API design are to not introduce incompatible changes.

]]>
By: Saar https:/2018/01/plugins-do-not-register-drawing-callbacks-that-do-not-draw/#comment-24782 Sat, 13 Jan 2018 18:13:05 +0000 http://developer.x-plane.com/?p=8189#comment-24782 In reply to Tyler Young.

Hi,

I humbly suggest to add a button, before the code example, to allow to display the code in a popup window where all the width assets will be used. If it will be colored too then great.

My 2 cents, if LR doesn’t want to invest in this, just copy paste the code to your editor, that’s what I have done.

Cheers

]]>
By: Ulrich https:/2018/01/plugins-do-not-register-drawing-callbacks-that-do-not-draw/#comment-24781 Sat, 13 Jan 2018 17:51:47 +0000 http://developer.x-plane.com/?p=8189#comment-24781 On 2): I picked a random example, finding code that made my hair stand up:

PLUGIN_API int XPluginStart(
char * outName,
char * outSig,
char * outDesc)
{
strcpy(outName, “HelloWorld3Plugin”);
strcpy(outSig, “xpsdk.examples.helloworld3plugin”);
strcpy(outDesc, “A Hello World plug-in for the XPLM300 SDK.”);

It’s very much against about all safe C programming conventions to pass back strings like that! (I’d use (e.g.) “const char **outSig” in the formal parameters and then “*outSig = String_Literal”. Of course for dynamically created texts that has to be more careful. The other safe alternative is to pass the buffer limits as formal parameters, like “size_t lenOutSig”, allowing to use “strncopy(outSig, String, lenOutSig)” for example.

]]>
By: Ulrich https:/2018/01/plugins-do-not-register-drawing-callbacks-that-do-not-draw/#comment-24780 Sat, 13 Jan 2018 17:42:10 +0000 http://developer.x-plane.com/?p=8189#comment-24780 I’m not a plugin developer, but I think the golden rules (for whatever feature) are (in chronological order):
1) Provide the right API
2) Provide a correct (ideal) usage example (real-world usable)
3) After you told people how to do it correctly in 2), tell them what not to do.
4) Avoid any incompatible changes to the API (i.e.: changes to the specification).

Steps 2) and 3) could be one if you define exact rules what is allowed, and everything that is no allowed is forbidden then (telling what is allowed, and what is forbidden, amy leave some grey zone behind).

At the moment, some specs are rather “thin”, like https:/sdk/xplm_Phase_Objects/ 😉

]]>
By: xplanefan https:/2018/01/plugins-do-not-register-drawing-callbacks-that-do-not-draw/#comment-24779 Sat, 13 Jan 2018 14:20:34 +0000 http://developer.x-plane.com/?p=8189#comment-24779 In reply to Ben Supnik.

Ah, I see what you mean now…I was thinking on a much smaller scale.

]]>
By: Ben Supnik https:/2018/01/plugins-do-not-register-drawing-callbacks-that-do-not-draw/#comment-24774 Sat, 13 Jan 2018 00:21:12 +0000 http://developer.x-plane.com/?p=8189#comment-24774 In reply to Steve.Wilson.

For non-2-d rendering, put the sim into “2-d panel only” mode – we’ll bypass stuff in the rendering engine that you can’t get at via the SDK.

]]>
By: Steve.Wilson https:/2018/01/plugins-do-not-register-drawing-callbacks-that-do-not-draw/#comment-24767 Fri, 12 Jan 2018 17:03:05 +0000 http://developer.x-plane.com/?p=8189#comment-24767 In reply to Ben Supnik.

1. That’s disappointing, since there is a use model for disabling non-2D rendering on X-Plane slave systems used only for instrumentation.

2. Please reconsider your second, or perhaps third guess, my friend, if you would! 😉

Really, try this on for size and see if you think it’s a sane way to present a code example:

https:/code-sample/draw-terrain-object/

Do *you* use the SDK website for code examples and the like? 😉

Graphics designers apparently do not fully consider long term utility these days. I respect their skills, but if you honestly think that only using less than the full available width of a 16:10 screen is wise for documents that are far more likely to be used by desktop deployments, I can only agree to disagree. 🙂

If nothing else, the code window should be resizable for those of us that don’t refer to the SDK website on a smartphone. 😀 Graphics designers, just as much as we code pushers, can err. And I’m both, for what little that is worth! (So I guess I get twice as many chances to mess up. Aren’t I lucky!)

]]>
By: Tyler Young https:/2018/01/plugins-do-not-register-drawing-callbacks-that-do-not-draw/#comment-24765 Fri, 12 Jan 2018 16:49:30 +0000 http://developer.x-plane.com/?p=8189#comment-24765 In reply to Steve.Wilson.

Re: the SDK layout, there’s one case where I agree with you: cases where the table of contents sidebar would be empty. (This applies only to a few of the sample code pages.) I’ve rolled out a fix for that now.

]]>
By: Ben Supnik https:/2018/01/plugins-do-not-register-drawing-callbacks-that-do-not-draw/#comment-24764 Fri, 12 Jan 2018 16:34:54 +0000 http://developer.x-plane.com/?p=8189#comment-24764 In reply to Steve.Wilson.

Hi Steve,

1. Draw disabling is going to get deprecated. The notion that plugins can go in and sanely remove pieces of our rendering pipeline is totally crazy, and even now the support for it is deteriorating because the actual structure of the rendering engine is NOTHING like the set of enums we declared in 2001.

At this point it’s only safe to use a small subset of the draw callbacks, and disabling them is a bad idea.

In the future I expect to publish some guidance as to which callbacks to use, and that guidance will be to never disable things.

2. I think at default page size the paragraph width is acceptable – it could be slightly wider but since it was done by an actual graphic designer and not a programmer, I’m not looking to second guess it.

]]>