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

    [code] On Screen GUI RGB Colorpicker

    Scheduled Pinned Locked Moved Developers' Forum
    14 Posts 6 Posters 2.9k Views 6 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.
    • Chris FullmerC Offline
      Chris Fullmer
      last edited by

      Cool, thanks for the screenshot John. I got a video made and uploaded to YouTube now so you can see it in action and see a few sort of hidden features I built into it.

      Lately you've been tan, suspicious for the winter.
      All my Plugins I've written

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

        That's great!
        (I also have a color html chooser in an unreleased plugin.) In HTML, one can easily create the gradient with a png image (black/white/transparent) on a colored box. We should maybe discuss on BaseCamp whether the SketchUp devs can create a (native) View.draw_image(point, width, height) method?

        I did some performance tests for the draw method (on a rather slow computer):
        without DrawCache:
        %(#000000)[min 0.094, max 0.384, average 0.163]
        with Thomthom's DrawCache:
        %(#000000)[min 0.032, max 0.070, average 0.037]
        With highest resolution it's average 50s vs 10s.
        The draw cache can only reduce overhead for calculating colors/shapes etc, but drawing the gradient stays a very expensive operation.

        I'm still working on big changes in the onscreen toolkit before writing new controls, but then it will be very easy to implement this color picker!

        1 Reply Last reply Reply Quote 0
        • thomthomT Offline
          thomthom
          last edited by

          @aerilius said:

          The draw cache can only reduce overhead for calculating colors/shapes etc, but drawing the gradient stays a very expensive operation.

          Only way to speed up actual drawing is to draw in bulk. But for this is difficult due to different colours.
          Same thing with my code that draws BMP images - the best optimisation I can do is grouping same colour pixels into one draw operation. So the more colours - the slower it gets.

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

          1 Reply Last reply Reply Quote 0
          • Chris FullmerC Offline
            Chris Fullmer
            last edited by

            Yeah, which is why I made different level of pixelization possible in the large gradient. It works great for this. I haven't tested it on a large model though. If a large model is already making the system lag, this color picker might be the death of it.

            Lately you've been tan, suspicious for the winter.
            All my Plugins I've written

            1 Reply Last reply Reply Quote 0
            • thomthomT Offline
              thomthom
              last edited by

              While at basecamp, this is one of the things I'd like to talk to the SketchUp devs about. Being able to load and draw bitmaps on the viewport would be a big thing. (Even creating bitmaps on the fly.)

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

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

                been awhile since last post on this thread, but does anyone know how to retrieve the value of a slider?

                I can get the screen position but need to return the value at position...

                from my own tool that uses require...

                class NextTool
                 require "/Users/johns_iMac/Library/Application Support/SketchUp 2015/SketchUp/Plugins/OnScreenGUI/ae_OnScreenGUI.rb"
                  include AE;;GUI;;OnScreen
                
                  def initialize
                
                    window.layout=({;margin=>5, ;orientation=>;horizontal, ;align=>;center, ;valign=>;top})
                
                    slider = Slider.new("Radius", [0,100]){|value|
                      @@radius = value
                      p value # this is screen position...
                    }
                
                    window.add(slider)
                
                  end
                
                end
                
                Sketchup.active_model.select_tool(NextTool.new)
                

                john

                learn from the mistakes of others, you may not live long enough to make them all yourself...

                1 Reply Last reply Reply Quote 0
                • S Offline
                  slbaumgartner
                  last edited by

                  @driven said:

                  been awhile since last post on this thread, but does anyone know how to retrieve the value of a slider?

                  I can get the screen position but need to return the value at position...

                  from my own tool that uses require...

                  class NextTool
                  >  require "/Users/johns_iMac/Library/Application Support/SketchUp 2015/SketchUp/Plugins/OnScreenGUI/ae_OnScreenGUI.rb"
                  >   include AE;;GUI;;OnScreen
                  > 
                  >   def initialize
                  > 
                  >     window.layout=({;margin=>5, ;orientation=>;horizontal, ;align=>;center, ;valign=>;top})
                  > 
                  >     slider = Slider.new("Radius", [0,100]){|value|
                  >       @@radius = value
                  >       p value # this is screen position...
                  >     }
                  > 
                  >     window.add(slider)
                  > 
                  >   end
                  > 
                  > end
                  > 
                  > Sketchup.active_model.select_tool(NextTool.new)
                  

                  john

                  Based on the source, it should be

                  slider.value
                  

                  Does that not work?

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

                    @steve...

                    yes, I must have tried every other possible way, but not the obvious...

                    john

                    learn from the mistakes of others, you may not live long enough to make them all yourself...

                    1 Reply Last reply Reply Quote 0
                    • H Offline
                      Herdsman1971
                      last edited by

                      Hi Im on a Mac and really don't understand computers, is there a simple detailed explanation of how you install RGB Color picker ?

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

                        This is really just an experiment for developers, i.e. not a really useful for day to day modelling...

                        Still want to know?

                        john

                        learn from the mistakes of others, you may not live long enough to make them all yourself...

                        1 Reply Last reply Reply Quote 0
                        • H Offline
                          Herdsman1971
                          last edited by

                          If it is not to complicated please. I would like to know

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

                            download the ruby file...
                            open SU menu >> 'Window' >> 'Ruby Console'
                            copy/paste/return the first line

                             load "~/Downloads/rgb_picker.rb"
                            

                            should return true in 'RC' if that's of your path...
                            copy/paste/return the second line...

                             Sketchup.active_model.select_tool(Col_pick.new)
                            

                            should work...
                            hit spacebar to close the color picker...

                            john

                            learn from the mistakes of others, you may not live long enough to make them all yourself...

                            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