sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    [Plugin] Autoloader

    Scheduled Pinned Locked Moved Plugins
    13 Posts 8 Posters 11.5k Views 8 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D Offline
      Diggsey
      last edited by

      This is mainly useful for when writing plugins. After making a change to a plugin, just click the update scripts button and it will automatically reload any scripts which have been modified since they were last reloaded. It should handle .rb and .rbs files, and will look for scripts in all the paths in the $: global variable.

      http://i59.photobucket.com/albums/g314/diggsey/autoloader.png

      The plugin will list the files which have been reloaded and the files for which reloading failed in the status bar.
      Extract the attached file to your plugins folder to try it out.


      autoloader.zip

      1 Reply Last reply Reply Quote 0
      • D Offline
        dedmin
        last edited by

        Cool! This is very handy when updating scripts and want to use the new version without restarting SketchUP!

        1 Reply Last reply Reply Quote 0
        • Bob JamesB Offline
          Bob James
          last edited by

          If I have SU open and add a new plugin, will this tool now "see" the new plugin without re-starting SU?
          I'm talking new plugin, not revising script on an already loaded plugin.

          i7-4930K 3.4Ghz, 2x GTX780 6GB, 32GB DDR3-1600 ECC, OCZ Vertex 4 500GB, WD Black 3TB, 32TB NAS, 4x 27" Monitors, SpaceMouse Pro, X-keys XK-60

          1 Reply Last reply Reply Quote 0
          • D Offline
            Diggsey
            last edited by

            Yes it will see new files as well as existing modified ones;)

            1 Reply Last reply Reply Quote 0
            • A Offline
              AndriyG81
              last edited by

              works like a dream.
              πŸ˜›
              Thank you

              http://andriyg.com

              1 Reply Last reply Reply Quote 0
              • Bob JamesB Offline
                Bob James
                last edited by

                @diggsey said:

                Yes it will see new files as well as existing modified ones;)

                Now thisis a timesaver πŸ‘

                i7-4930K 3.4Ghz, 2x GTX780 6GB, 32GB DDR3-1600 ECC, OCZ Vertex 4 500GB, WD Black 3TB, 32TB NAS, 4x 27" Monitors, SpaceMouse Pro, X-keys XK-60

                1 Reply Last reply Reply Quote 0
                • Didier BurD Offline
                  Didier Bur
                  last edited by

                  Hi,

                  @unknownuser said:

                  works like a dream

                  @AndriyG81: does it reload modified files that are in sub-folders of the Plugins folder ? It doesn't do that for me... 😒

                  DB

                  1 Reply Last reply Reply Quote 0
                  • D Offline
                    Diggsey
                    last edited by

                    Currently it only reloads files in the plugins folder.

                    1 Reply Last reply Reply Quote 0
                    • Bob JamesB Offline
                      Bob James
                      last edited by

                      @diggsey said:

                      Currently it only reloads files in the plugins folder.

                      But does it "see" newsub-folders?

                      More precisely, if I've put a new plugin into the plugins folder while SU is open and that new plugin contains a folder, will Autoloader "see" the new sub-folder and allow the new plugin to work?

                      i7-4930K 3.4Ghz, 2x GTX780 6GB, 32GB DDR3-1600 ECC, OCZ Vertex 4 500GB, WD Black 3TB, 32TB NAS, 4x 27" Monitors, SpaceMouse Pro, X-keys XK-60

                      1 Reply Last reply Reply Quote 0
                      • TIGT Offline
                        TIG Moderator
                        last edited by

                        When you get a list of entries in a Directory it will include files and folders.
                        It loads scripts it finds by files by their extname [.rb etc], but you can also find directories by their filetype.
                        So it's also possible to get a list of any subfolders and then reiterate through those to get their .rb files etc etc...

                        TIG

                        1 Reply Last reply Reply Quote 0
                        • D Offline
                          Diggsey
                          last edited by

                          Yes, of course. It doesn't affect the way the plugin is loaded, it just loads it.

                          1 Reply Last reply Reply Quote 0
                          • J Offline
                            Jim
                            last edited by

                            Hi Diggsey,

                            Nice idea, thank you. However...

                            Sketchup::load (if I remember) is an alias for Sketchup::require, and doesn't reload scripts that are already listed in the $LOADED_FEATURES array. In short, I don't think anything is actually getting reloaded.

                            Also, it would be helpful to wrap the load in begin..rescue..end to catch LoadError's and SyntaxErrors and report them as coming from the file being loaded instead of from autoloader.

                            Related Topic

                            Hi

                            1 Reply Last reply Reply Quote 0
                            • A Offline
                              archipod88
                              last edited by

                              cool...i tried it thanks a lot..!!! πŸ‘

                              1 Reply Last reply Reply Quote 0
                              • 1 / 1
                              • First post
                                Last post
                              Buy SketchPlus
                              Buy SUbD
                              Buy WrapR
                              Buy eBook
                              Buy Modelur
                              Buy Vertex Tools
                              Buy SketchCuisine
                              Buy FormFonts

                              Advertisement