Thursday, July 21, 2011

Turn Your Plugin Into An Extension

Posted by Scott Lininger, SketchUp Team

Around the office here we're always amazed at the awesome Ruby scripts you developers create. They make SketchUp more productive, smarter, and downright snazzy. So it's no surprise when we hear from users who have a lot of plugins installed.

Plugin management can get really difficult, though. If two scripts conflict with each other somehow, SketchUp can go haywire, and figuring out which scripts are the culprits can require a lot of detective work. If only all of the ruby programmers out there used SketchupExtensions... ahh, the world would be so much nicer.

SketchupExtensions are a handy-dandy way for you to package your plugin that is easier for users to toggle on and off. You can see the extensions you already have under Window > Preferences > Extensions. With a quick click, you can learn about who authored each of them and can even turn 'em on and off. It's dandy!

And the cool thing is that an extension is nothing but a normal Ruby plugin wrapped in a little bit of extra code. Making one of your own is easy and well worth your time. Here are several advantages:

Makes it easier for your users to turn off your script if they don't need it at the moment

Makes customer support easier for you, because you can track plugin versions

That's all there is to it. When you restart SketchUp your plugin will load as before, but now people can control it in the Preferences panel. We highly recommend that you do this with all of your plugins that extend SketchUp's UI with buttons or menu items.

... and eventually to make extensions accessible for other plugins without dirty hacks (which icons and commands does an extension provide?). So plugin authors could offer innovative ways to customize the UI, like Jim's custom toolbars, or this experiment.

SketchupExtension could definitely have great potential, and it could save us from re-inventing the wheel ;-)