• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

[Plugin] TT_Lib²

Scheduled Pinned Locked Moved Plugins
310 Posts 66 Posters 394.0k Views
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.
  • T Offline
    TIG Moderator
    last edited by 15 Dec 2013, 15:12

    Now the bad news...

    After further testing... I confirm that my fix for a superscript 2 in the Extension's name doesn't work with TT_Lib² after all... It was a spurious result...

    It must be something to do with the way the file calls itself - almost unique amongst Extensions !
    Then I noticed that Fredo's Lib uses a fake Extenson...

    #Compatibility with EWH begin ; SketchupExtension.new "toto", "toto.rb" ; rescue ; end

    That is all, and that gets past the EWH check and does NOT register an Extension ?
    Although through other means there is an entry fro LibFredo6 ?? ...

    So the fix seems to be in TT's hands.

    Simply remove the current 'extension making code' and add in a 'fake file' like as shown above, and it works... there's no 'fake extension' confusing users in the Preferences OR the SCF Extensions Manager...

    TIG

    1 Reply Last reply Reply Quote 0
    • T Offline
      tt_su
      last edited by 15 Dec 2013, 20:27

      That's odd. How is PluginStore determining if a plugin is enabled/disabled?

      By the way, are you doing string manipulations? Passing a Ruby multibyte string, encoded in UTF-8, should work fine as long as the HTML is marked up in UTF-8 as well. JS handles UTF-8 by default I think as well. So simply passing strings back and forth should not be a problem.

      1 Reply Last reply Reply Quote 0
      • T Offline
        TIG Moderator
        last edited by 15 Dec 2013, 20:39

        HTML is UTF-8 - there is no issue the superscript 2 was a dead end...

        The Extensions Manager uses the obvious :

        ` Sketchup.extensions.each{|ex|
        next unless ex.respond_to?(:registered?) && ex.registered?
        ...
        if ex.loaded?
        ...
        else ### unloaded
        ...
        end

        }`

        etc

        Fredo's Lib uses the spurious file ans has no issues.
        Calling itself seems to break it.
        I substituted the equivalent of Fredo's one liner in your 'loader, it doesn't register an extension BUT it does still let the Lib be used...

        TIG

        1 Reply Last reply Reply Quote 0
        • T Offline
          thomthom
          last edited by 18 Dec 2013, 21:18

          Updated TT_Lib 2.9.5 will fix the issue.
          Download from PluginStore or BitBucket:
          http://sketchucation.com/resources/pluginstore?pln=TT_Lib
          https://bitbucket.org/thomthom/tt-library-2/downloads

          Submitted to moderation on Extension Warehouse.

          This should address 3D Text Editor's issue with IE11 and hopefully appear correct to PluginStore.

          Thomas Thomassen — SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • O Offline
            Oxer
            last edited by 19 Dec 2013, 03:00

            Thanks Thom for fix the problem!! 👍

            "The result is the end what is important is the process" by Oxer
            [http://www.oxervision.blogspot.com/(http://www.oxervision.blogspot.com/)]

            1 Reply Last reply Reply Quote 0
            • T Offline
              TIG Moderator
              last edited by 20 Dec 2013, 11:12

              The update does fix the 3d text font list problem...

              BUT...

              On PC and MAC I now get this issue whenever SketchUp starts
              @unknownuser said:

              Error Loading File C:/Program Files/SketchUp/SketchUp 2013/Plugins/TT_Lib2/core.rb
              uninitialized constant TT::System
              Error Loading File TT_Lib2.rb
              uninitialized constant TT::System
              One step forward one back.

              Also you have not fixed the issue of a 'mock Extension' like your Lib calling its own file, which breaks the listing in the SketchUcation 'Extensions Manager' dialog, where it always appears disabled, even though it is enabled.
              As I explained before... Fredo gets around it by loading a non-existent 'toto.rb' file in a begin...rescue, and NOT registering it at all, which means an spurious Extension is not listed - so it should not appear in the Extensions list ?
              You have now stopped it calling itself, BUT now load [and register] 'core.rb', which exists in the Lib's folder, but that now creates errors too... why not put it in a 'begin...rescue' block and refer it to a file you DON'T have in your TT_Lib2 folder - like 'foobar.rb' - and do NOT register it, then no Extension is made and no one is confused at all...
              This edited code works for me

              ### EXTENSION ### ------------------------------------------------------------
                
                unless file_loaded?( __FILE__ )
                  # This library is still loaded by plugins because they require
                  # 'TT_Lib2/core.rb' directly. 
              	# Disabling the library via the extension manager 
              	# will have no effect on the dependant extensions.
                  #
                  # The purpose of this file is solely to make it compatible with the
                  # Extension Warehouse policies.
                  file_loaded( __FILE__ )
              	begin
              		ex = SketchupExtension.new( PLUGIN_NAME, 'TT_Lib2/foobar.rb' )
              		#ex.description = 'Library of shared functions used by other extensions.'
              		#ex.version     = PLUGIN_VERSION
              		#ex.copyright   = 'Thomas Thomassen © 2010-2013'
              		#ex.creator     = 'Thomas Thomassen (thomas@thomthom.net)'
              		#Sketchup.register_extension( ex, true )
              	rescue
              	end
                end
              

              the Lib is loaded by other tools, it is NOT made into an Extension, so there is NO confusion at all... 😕

              TIG

              1 Reply Last reply Reply Quote 0
              • T Offline
                tt_su
                last edited by 20 Dec 2013, 11:14

                @tig said:

                Also you have not fixed the issue of a 'mock Extension' like your Lib calling its own file, which breaks the listing in the SketchUcation 'Extensions Manager' dialog, where it always appears disabled, even though it is enabled.

                Huh? I changed to to load core.rb ...

                I didn't want to use a dummy file as I wouldn't trust that to not display an error.

                1 Reply Last reply Reply Quote 0
                • T Offline
                  thomthom
                  last edited by 20 Dec 2013, 11:22

                  @tig said:

                  You have now stopped it calling itself, BUT now load [and register] 'core.rb', which exists in the Lib's folder, but that now creates errors too... why not put it in a 'begin...rescue' block and refer it to a file you DON'T have in your TT_Lib2 folder - like 'foobar.rb' - and do NOT register it, then no Extension is made and no one is confused at all...

                  The real fix here is to figure out where the error is coming from. I don't want to patch the symptom, I want to fix the cause.

                  Thomas Thomassen — SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • T Offline
                    thomthom
                    last edited by 20 Dec 2013, 11:25

                    I'm not able to reproduce the TT::System loading error...

                    Thomas Thomassen — SketchUp Monkey & Coding addict
                    List of my plugins and link to the CookieWare fund

                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      TIG Moderator
                      last edited by 20 Dec 2013, 16:47

                      I get it on PC & MAC v2013...
                      😕
                      Unless I re-jig you code to use the nonexistent foobar.rb and NOT register the extension anyway...
                      Then it's all OK.
                      😒

                      TIG

                      1 Reply Last reply Reply Quote 0
                      • T Offline
                        tt_su
                        last edited by 20 Dec 2013, 19:35

                        Does it happen with a clean Plugins folder?

                        1 Reply Last reply Reply Quote 0
                        • T Offline
                          TIG Moderator
                          last edited by 20 Dec 2013, 20:57

                          @unknownuser said:

                          Error Loading File C:/Program Files/Google/Google SketchUp 8/Plugins/TT_Lib2/core.rb
                          uninitialized constant TT::SystemError Loading File TT_Lib2.rb
                          uninitialized constant TT::System
                          With nothing except "TT_Lib2" loading from Plugins [and only the 3 'required' rb's in Tools - sketchup. langhandler and extensions] - error happens in both basic v8 [PC] & v2013 [PC & MAC]...
                          But oddly 'another version' doesn't display the issue at all ? 😉

                          Incidentally, this one simple change to your script stops these error message...
                          **#**Sketchup.register_extension( ex, true )
                          There is no need to register the mock-Extension as it is doing nothing, and other tools will load what they need from it anyway... 😕

                          TIG

                          1 Reply Last reply Reply Quote 0
                          • T Offline
                            tt_su
                            last edited by 20 Dec 2013, 22:24

                            Thanks for the reports TIG. I'll dig into it. I need to make some emergency patches for that other version anyway as well.

                            1 Reply Last reply Reply Quote 0
                            • T Offline
                              TIG Moderator
                              last edited by 21 Dec 2013, 13:17

                              One odd thing I noticed is a circular 'require' in two of your rb's ?

                              In core.rb [which 'loads' first from the extension code load]...
                              require 'TT_Lib2/system.rb'

                              In system.rb which has been called by core.rb...
                              require 'TT_Lib2/core.rb'

                              So maybe the TT::System isn't initiated properly and the error occurs [with Ruby 1.8] ?
                              The require of the core.rb should skip if the code is already loaded, BUT maybe the extension load doesn't register in the list in the same way, and a second attempt occur with an error message...

                              TIG

                              1 Reply Last reply Reply Quote 0
                              • T Offline
                                tt_su
                                last edited by 21 Dec 2013, 18:00

                                Maybe... I thought Ruby was able to deal with circular require, but I've had cases where it seem to cause problems. This might be one of them - I introduced the system.rb require to core.rb recently.

                                1 Reply Last reply Reply Quote 0
                                • T Offline
                                  TIG Moderator
                                  last edited by 21 Dec 2013, 18:38

                                  There isn't a circular require as such...
                                  If the core.rb is loaded/required, then it in turn requires the system.rb...
                                  That in turn requires the core.rb BUT it is skipped because the core.rb has already been loaded.

                                  BUT your TT_Lib2.rb code doesn't actually 'load or require' the core.rb - but rather it specifies it in an Extension.new(), and then it runs register_extension() that extension [which is where it breaks it]...
                                  I suspect that [in versions up to v2013 at least] the extension's rb register_extension() does NOT get listed in the 'loaded' list [I forget its proper name!], although it does 'load' the code in some way, so... then core.rb's code requires system.rb which requires core.rb in the normal way, but at that point it tries to load core.rb thinking it's for the first time when it's the second !
                                  So core.rb now skips system.rb's require because it thinks it's been done ???

                                  Whatever is happening... just stopping the extension code without doing a register_extension() avoids this issue because it doesn't need loading at all any way...

                                  TIG

                                  1 Reply Last reply Reply Quote 0
                                  • T Offline
                                    tt_su
                                    last edited by 23 Dec 2013, 10:55

                                    @tig said:

                                    On PC and MAC I now get this issue whenever SketchUp starts
                                    @unknownuser said:

                                    Error Loading File C:/Program Files/SketchUp/SketchUp 2013/Plugins/TT_Lib2/core.rb
                                    uninitialized constant TT::System
                                    Error Loading File TT_Lib2.rb
                                    uninitialized constant TT::System
                                    One step forward one back.

                                    I tried with a fresh install of TT_Lib2 on SU8 and SU2013 - under SU8 I never saw the error. Under SU2013 I saw the error when I had the console open when I installed. However, when I restarted SU there was no errors and everything was working fine... :s

                                    1 Reply Last reply Reply Quote 0
                                    • T Offline
                                      TIG Moderator
                                      last edited by 23 Dec 2013, 11:41

                                      To double check... I removed all of your tools and the TT_Lib2 files from my v2013 Plugins folder.
                                      I then reinstalled the latest TT_Lib2 version - v2.9.5 [?].

                                      After that, whenever I restarted SketchUp it gives the same error-message as previously reported.
                                      As before adding a # in front of the line that registers your spurious extension [and thereby tries to load the core.rb] stops the error as SketchUp starts, but it does not affect the Lib at all, since other tt installed tools 'properly' load any code as needed from the Lib, which does NOT need to be an extension at all...
                                      😒

                                      TIG

                                      1 Reply Last reply Reply Quote 0
                                      • T Offline
                                        tt_su
                                        last edited by 23 Dec 2013, 12:03

                                        What Windows version are you using?

                                        (I want to get to the actual cause of this, fixing the actual problem instead of patching the symptom - which is why I need to reproduce this.)

                                        1 Reply Last reply Reply Quote 0
                                        • T Offline
                                          tt_su
                                          last edited by 23 Dec 2013, 12:32

                                          Ah! Now I reproduce it. If TT_Lib is loading all by itself.

                                          I had AutoSmooth installed which loaded the core.rb file - then there was no errors.

                                          1 Reply Last reply Reply Quote 0
                                          • 1
                                          • 2
                                          • 11
                                          • 12
                                          • 13
                                          • 14
                                          • 15
                                          • 16
                                          • 13 / 16
                                          13 / 16
                                          • First post
                                            255/310
                                            Last post
                                          Buy SketchPlus
                                          Buy SUbD
                                          Buy WrapR
                                          Buy eBook
                                          Buy Modelur
                                          Buy Vertex Tools
                                          Buy SketchCuisine
                                          Buy FormFonts

                                          Advertisement