.rbs files not loading at all.
-
Hi all,
I'm currently trying to encrypt my sketchup plugin using the scrambler program, which I got through Google. I can encrypt files in the plugins folder with no problems and the resulting .rbs file work. The problem is, though, that most of the ruby code for my plugin is within a subfolder in the plugins directoy e.g "plugins/classes" and I have a main ruby file in the plugins folder that calls (requires) the files in the subfolder. When I encrypt the code in the subfolder the plugin will not work. I do not even get messages saying that files cannot be found, it just doesn't work. If I only encrypt the main ruby file in the plugins directory and leave the rest then it works fine....
I was just wondering if I'm missing something in using Scrambler.exe and if someone could put me on the right track. I've spent most of the afternoon looking on the net for a solution, but documentation for this seems to be kind of scarce. I've tried this in both the Pro and free versions of Sketchup and get the same results in both.
Any help would be appreciated,
Thanks. -
Try this:
Sketchup.load("myscript.rbs")
Then do the require.Todd
-
I guessed wrong. There is a Sketchup.require. Use it.
Todd
-
I've finally got it working.
I was using the normal Ruby require and including the .rb file extension but, what is actually required is the Sketchup require and not including any file extension e.g:Sketchup::require 'directory/filename'
instead of:
require 'directory/filename.rb'With the correct require the scrambled version of the plugin works perfectly with both free and Pro Sketchup. I spent ages trying to figure out why the Scrambler wasn't working. Hopefully this post will save some time for anyone else using it. Google really should release some better docs though....
-
Don't know, whether the "old" standard Ruby "require" is really needed for all scripts. If you do not need it at all, WHAT is Sketchup.require doing? Does it use the "old" "require"? If not you can think about replacing it dynamically:
module Kernel def require *args Sketchup.require *args end end
(not tested, maybe the asterisks are on wrong place)
After that you can use the "old" require and get the behaviour of the Sketchup "require"azuby
Advertisement