SketchupExtension in a single file
-
@dan rathbun said:
Add to that the Sketchup.register_extension method code was changed on the C side for 8.0M2 ...
What was that?
-
@thomthom said:
@dan rathbun said:
Add to that the Sketchup.register_extension method code was changed on the C side for 8.0M2 ...
What was that?
To much to explain.. you'll need to read the comments in the code. Scott marks what were the private callbacks from the C side.
But basically calling the method more than once in previous version has no benefit, screwed up the extension list in the dialog.
Now 8.0M2+, the method was changed to expect to be called more than once, and to do things, based upon the change in arg 2. -
One reason I am a bit adverse to this idea is, that I was hoping for a day when plugins resided within their author's filespaces, and the plugins directory had nothing but extension registration scripts. All code for actual functionality, would be in subfolders.
I like the idea, of being able, to switch off whole groups of plugins, by author is one way.
-
The
@extension_registered
variable is always false when SketchUp starts, so the menus will never be created after the first time the extension is enabled. -
@jim said:
The
@extension_registered
variable is always false when SketchUp starts, so the menus will never be created after the first time the extension is enabled.Thought I'd fixed that...
-
Oh, I was just reading your blog and copy/pasted the code, but I never got the menu to appear. But then later I thought the code should work because SketchUp should go ahead and reload the file as an extension after initially registering. So not sure what's going on.
-
Re-read my earlier post: http://forums.sketchucation.com/viewtopic.php?f=180&t=43200&#p384925
Your setting up a vicious circle.
-
What about using a
begin
...rescue
...end
block to "fool" SketchUp.Meaning set the path to a file that does NOT exist, which will raise a
LoadError
Exception.
(EDIT: ..and I think you can just use an empty string for path, in this case.)begin # set up here plugin = SketchupExtension.new('Nifty Plugin','dummy') # set other attributes Sketchup.register_extension(plugin,true) # if it attempts to load, the rescue block fires rescue LoadError # # A little code for a "quickie" Plugin here. # end
-
NO (the above,) will not work because
Sketchup::require()
andSketchup::load()
do not raiseLoadError
. They just returnfalse
on failure, and0
on success.
(I do have a API bug report filed on this.) -
@dan rathbun said:
NO (the above,) will not work because
Sketchup::require()
andSketchup::load()
do not raiseLoadError
. They just returnfalse
on failure, and0
on success.
(I do have a API bug report filed on this.)They don't raise
LoadError
...? That's interesting.My mistake was that I tested the whole thing by loading manually from an external location instead of placing the file in the Plugins folder and having it load at startup. My "simulation" was incorrect.
Advertisement