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

    [Plugin] TextureTools

    Scheduled Pinned Locked Moved Plugins
    106 Posts 34 Posters 99.7k Views 34 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.
    • M Offline
      Matt666
      last edited by

      Hi TIG, and thank you for this great script!
      Just one thing, I've mentioned here an plugin idea, that could rotate a texture along the longest dimension of a surface. Do you think it's possible?

      Frenglish at its best !
      My scripts

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

        Matt

        Here's a one-liner that gives you the angles of a selected face's longest edge relative to the X_AXIS/Y_AXIS/Z_AXIS - the result in degrees [e.g. 90.0, 66.666, 0.0] you can then copy+pasted the sensible one into the TextureTool's Rotate dialog and the texture will realign with the long edge...

        f=Sketchup.active_model.selection[0];es=f.edges;ed=es[0];d=0;es.each{|e|(d=e.length;ed=e)if e.length>d};x=ed.line[1].angle_between(X_AXIS).radians;y=ed.line[1].angle_between(Y_AXIS).radians-90;z=ed.line[1].angle_between(Z_AXIS).radians;(x=x-90;y=y-90;z=z-90)if f.normal.z.abs==1;p x,y,z
        

        That assumes that the current texture has never been rotated...
        It's not perfect but it's a start... πŸ˜•

        TIG

        1 Reply Last reply Reply Quote 0
        • M Offline
          Matt666
          last edited by

          Thank you for your answer TIG, I'll take a look!
          I was thinking more of a tool that would orient textures in current selection (groupe, component, or faces), or even the entire model... 😳

          Frenglish at its best !
          My scripts

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

            The three TextureTools Rotate/Scale/Shunt are written to allow passing of arguments, so they can be run from other tools without a dialog.
            So, if you pass an angle in degrees to the 'rotate' tool then there's no dialog...
            So you can envisage a new tool that iterates all of the faces in a selection and finds the long side of each, calculates the rotation needed, and then uses the 'rotate' tool with the required angle passed to it so that the faces are processed en mass...
            It only works on one selected face at a time... so the new tool's code needs to use
            ` ss=model.selection
            ssa=ss.to_a
            ss.clear

            iterate face in faces

            ss.add(face)then later ### find angle_in_degrees etc...
            TextureTools::Rotate.new(angle_in_degrees)
            ss.clear

            loop`

            on close it could then use
            ss.clear ss.add(ssa)
            to restore the selection as it was...

            TIG

            1 Reply Last reply Reply Quote 0
            • M Offline
              Matt666
              last edited by

              Ok that's great! Thank you TIG!

              Frenglish at its best !
              My scripts

              1 Reply Last reply Reply Quote 0
              • McGyverM Offline
                McGyver
                last edited by

                I must have missed this one before, but thanks again for another immensely useful and generous plugin!

                [Visit My ShareCG Freebie Gallery](http://www.ShareCG.com/pf/full_uploads.php?pf_user_name)

                1 Reply Last reply Reply Quote 0
                • PixeroP Offline
                  Pixero
                  last edited by

                  TIG, I have a request.

                  Would it be possible to add a "rotate, scale and match UVs" tool?
                  It would work this way:

                  First, you select all the faces you want to edit the texture on.
                  Second, you click on the tool and select one face you want to use as a reference.
                  Third, the script matches scale and rotation, AND if possible, offset of UVs from the reference faces UVs compared to the vertices of the faces in the initial selection. (Does this make sense?)

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

                    @pixero said:

                    TIG, I have a request.

                    Would it be possible to add a "rotate, scale and match UVs" tool?
                    It would work this way:

                    First, you select all the faces you want to edit the texture on.
                    Second, you click on the tool and select one face you want to use as a reference.
                    Third, the script matches scale and rotation, AND if possible, offset of UVs from the reference faces UVs compared to the vertices of the faces in the initial selection. (Does this make sense?)

                    It's possible to 'batch process' textures on faces by passing arguments as explained elsewhere in the thread... The complication is gleaning the scale/rotation of the selected face's texture... I'll sleep on it [for a day or two...] πŸ˜‰

                    TIG

                    1 Reply Last reply Reply Quote 0
                    • PixeroP Offline
                      Pixero
                      last edited by

                      I'm not sure I understand the word "gleaning"?
                      Would it be possible to compare the vertices position/distance from the "reference" face and the others and get the UVs from that? Just a thought...

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

                        Sorry, my slightly 'old' English slipped in there... by 'gleaning' I mean gathering up small bits from a larger amount... 'to glean' the wheat from the chaff when threshing corn, is to collect the small grains of wheat and leave the rest of the straw etc behind... SO by metaphor - we need to collect the important small bits of data from the larger amount that is available - by some yet unspecified process...

                        We would need to take the UV-mapping of one face and apply it to others - that's straightforward... however, using relative rotations etc gets more complex... πŸ˜•
                        I'm thinking about it...

                        TIG

                        1 Reply Last reply Reply Quote 0
                        • Rich O BrienR Offline
                          Rich O Brien Moderator
                          last edited by

                          Missed this πŸ˜•

                          Any chance you could add a scale feature?

                          Download the free D'oh Book for SketchUp πŸ“–

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

                            πŸ‘Ώ

                            TIG

                            1 Reply Last reply Reply Quote 0
                            • I Offline
                              IronCastles
                              last edited by

                              I have been happily using Texture Tools for a few weeks, but seem to have borked them with the addition of other plugins. I have been backtracking to disable / remove some of the unexplored/less useful items, but wonder...are there any known plugin conflicts to avoid with TT V. 1.5? I reeeeely like it.

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

                                There shouldn't be any clashes with other tools - they are self-contained in there own Module and there are no added/changed built-in methods ??
                                Can you post any messages from the Ruby Console [which needs to be open before you run anything] when you test its tools... or other tools that seem to 'clash'.
                                Script 'clashes' are very rare and usually arise from rewritten shared methods or observer glitches - but I'd be surprised if it were the case here πŸ˜•

                                TIG

                                1 Reply Last reply Reply Quote 0
                                • G Offline
                                  golduck
                                  last edited by

                                  good

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

                                    Thanks Bro for creating such wonderful plugin...

                                    1 Reply Last reply Reply Quote 0
                                    • T Offline
                                      the.pjt
                                      last edited by

                                      hi dear TIG ...

                                      this plugin is grate .. it installs with no problem .. and it runs well when I install this codes in a blank plugin folder with SU's default rubies ... but ... when I try to run it whit my own plugins folder with many rubies installed , it doesn't run in the way ... no start up problems .. but when I click to a Icon in your toolbar anything happens ...
                                      help me ... I thing your plugin intersects with another plugins .. because when I turn them off the plugin works well again ...

                                      i'm not a developer but I sometimes read the developers section .. I have seen a topic that say developer should use unique classes and unique names ...

                                      so please change your code names .. if it's need ... I don't know about it .. you are a SU ruby genius .. and you know it better than me ...

                                      but .. there is a bug that happens when I load my outher plugins ( include VRAY , and lots of other rubies ) .. loading theme disables plugin's function

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

                                        I am surprised that it clashes with any other scripts.
                                        It is written within its own class/module/methods etc.
                                        There are a few 'rogue scripts' that mess with base class method - often to do with groups - or have ill-configure observers; although these tools have little that I can think of that might clash with anything, let alone a 'rogue script' πŸ˜•
                                        Can you open the Ruy Console before trying my tools and pass on any error messages that might appear...
                                        It's currently a mystery πŸ˜’

                                        TIG

                                        1 Reply Last reply Reply Quote 0
                                        • T Offline
                                          the.pjt
                                          last edited by

                                          here is the screen shots ... πŸ˜„

                                          ... I have run commands from the "menu" section of plugins code ( cmd1=UI::Command.new("TextureRotate"){TextureTools::Rotate.new()} ) ...
                                          I have copied and pasted commands ...

                                          TIG texturetools.jpg

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

                                            Why are you pasting commands ?
                                            These are not complete??
                                            TextureTools::Rotate.new() is all you need... BUT why ?

                                            Have you edited the script at all?
                                            Using a program to 'read' the file [+ a 'save'] other than a plain-text editor [like Notepad.exe] will corrupt the contents.
                                            Or have you downloaded it is a strange way?
                                            The file appears to be corrupted and the commands are not correctly formed.
                                            try downloaded a pristine copy again...
                                            This screenshot shows what the lines should look like.Capture.PNGWhat happens when you use the toolbar buttons ???

                                            TIG

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

                                            Advertisement