5 posts • Page 1 of 1
Several months ago I asked about plugin formating and Dan made a namespace template/example for me and now I have finally got a working plugin written using the template. I thought before I offered it to fellow woodworkers I would post it here for comments to see if I am using acceptable format so as not to cause problems with other plugins.
Thanks for your help
Please, register (free) to access all the attachments on the forums.
Last edited by ktkoh on Fri Aug 10, 2012 9:49 pm, edited 1 time in total.
You're .rb file attached doesn't tell us anything about your namespacing. It refers to other files we cannot see.
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
I edited my post with the correct file. You can either install as extension or change it to a zip file and unzip to see the files in question.
in file: "K2WS_Comp2LayerScene_ext.rb", lines 7 & 8 should not be at this place, in this file.
(Because it will force a load of the "K2WS/k2ws_module.rb" file even when the user has turned OFF the plugin, via the Preferences dialog (Extensions panel.)
Move those two lines, into the "K2WS/Comp2LayerScene/Comp2LayerScene.rb" file, just after (current) line 22, which is:
This way.. it will only load, when the plugin is turned ON. (Many users are also developers, and they need to have the option of a "clean" and fast loading Ruby environment when testing/debugging.)
The only other thing, is that if you need to get a reference "handle" on your plugin's SketchupExtension instance object, you cannot do it under SU7.x, unless you save it as a module var. This means wrapping the definition in file: "K2WS_Comp2LayerScene_ext.rb" within your plugin namespace. (Note that in SU 8.0M2 or higher, you can query the ExtensionsManager collection to find a certain SketchupExtension instance, if need be, but since you are creating it, you might as well retain a reference to it.)
Note that future versions of Ruby will require that all method calls have parameter lists delimted by ( and ), so try to get in the habit of using them now. Especially if you do not want to have to go back through your old projects, and add them in later, when SketchUp begins using one of these newer Ruby versions.
Thanks Dan for the review and changes. I have adjusted my files to include your suggestions and when I have a how to vidio completed I will post in the plugin section.
Also I expect to be back for help on putting my Joint Tools under the namespace umbrella as I have just started that process.
5 posts • Page 1 of 1