I submitted a plugin (bim.bon) to SU’s Extension Warehouse. The code I submitted works fine in all supported SU versions, from SU8 to SU16. The code was reviewed and accepted and, as requested, is available in scrambled format.
Here’s the problem: the scrambled version only works in SU14, SU15 and SU16. In SU8 and SU13 the plugin available in the Extension Warehouse returns the following error and doesn’t load:
Error Loading File bimbon.rb
undefined method `dlg' for SketchupExtension::Bimbon::Bimbon:Module
Have you guys/girls seen this before? Any idea what I could do to avoid this kind of error once the plugin is scrambled? Since it runs fine in unscrambled format I feel the problem is not in my code but in some change done by the scrambler.
# encoding: utf-8
@_dlg ||= begin
dlg = UI::WebDialog.new("bim.bon", true, "bimbon", 365, 710, 150, 150, true)
dlg.min_width = 365
dlg.min_height = 360
Example of how this method is called:
Yes, it is an old error in the
Sketchup::require() method when evaluating scrambled files.
You must have all your
Sketchup::require() calls outside any module at the toplevel evaluating within
TOPLEVEL_BINDING, or else call them like:
or just create a non-scrambled loader file
# etc., etc.
Sometimes I create an array of files to load and use a loop, if I’m doing it inside a module in a scrambled loader file:
scripts = ['Bimbon_core','Bimbon_lib','Bimbon_menu']
for script in scripts
But I no londger support old Ruby 1.8 SketchUp, (pre v2014) so I do not use workarounds any more.
There are also old bugs where
__LINE__ are not evaluated correctly inside scrambled rubies pre 2014.
Thanks a lot for your help, Dan. I moved the
Sketchup::require calls out of the Bimbon module and it worked.