How about this --
Code: Select allrequire "sketchup"
require "extensions"
require "maxwell"
if !file_loaded?("maxwell.loader.rb")
module MX
module Loader
@ext = nil
def Loader.ext
if !@ext
@ext = SketchupExtension.new("Maxwell for SketchUp", "maxwell/init.rb")
@ext.version = MX::CURRENT_VERSION
@ext.creator = "Next Limit Technologies"
@ext.copyright = "#{MX::CURRENT_YEAR}, Next Limit Technologies"
@ext.description = "#{MX::CURRENT_MAXWELL} plugin for SketchUp."
Sketchup.register_extension(@ext, true)
end
@ext
end
::UI.menu("Plugins").add_item(::UI::Command.new("Enable Maxwell") { Loader.ext.check })
::UI.menu("Plugins").add_item(::UI::Command.new("Disable Maxwell") { Loader.ext.uncheck })
end
end
file_loaded("maxwell.loader.rb")
end
If you save this as maxwell.loader.rb and put it in your Plugins folder, it will add two items to your Plugins menu:
Enable Maxwell and
Disable Maxwell. Basically, they just check & uncheck the box for the plugin in
Preferences > Extensions. As you may know, you cannot unload an already-loaded plugin from a session, so using the disable item just means that the plugin won't be loaded automatically in the next SketchUp session.
Lastly, you should be aware that this is not capable of controlling what happens with the c++ MXS exporter; if you use File > Export > 3D Model, and choose MXS format, the plugin is going to attempt to obtain a license, and there's not really much way around that.