• Login
sketchucation logo sketchucation
  • Login
πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

[Plugin] CleverClay

Scheduled Pinned Locked Moved Plugins
19 Posts 9 Posters 17.5k 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.
  • P Offline
    Pixero
    last edited by Pixero 5 Jul 2009, 06:09

    CleverClay creates a gray "ClayMat" material and a transparent gray "TranspMat" and assigns it to everything.
    Typical use would be to simulate a clay render with transparent windows.
    Back up before use.
    Thanks to Thomthom for help with grouped geometry.


    Version 1.02

    1 Reply Last reply Reply Quote 0
    • T Offline
      thomthom
      last edited by 5 Jul 2009, 10:00

      I'd just like to note that it's recommended that you encapsulate plugins into a module or class. That way you safeguard against any potential conflicts with other scripts.

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

      1 Reply Last reply Reply Quote 0
      • P Offline
        Pixero
        last edited by 5 Jul 2009, 13:08

        I'm a noob when it comes to ruby, I know. 😳
        Since I used your script Blackout as the base for this script I had the module part there but got some errors I couldn't get rid of any other way than by removing that module part of the script. 😳
        I think I could use a simple tutorial on the difference between class and module and when to use what, don't you think. πŸ˜‰

        1 Reply Last reply Reply Quote 0
        • T Offline
          thomthom
          last edited by 5 Jul 2009, 13:53

          Modules works as simple wrappers. You can't make an instance of them. They are like name spaces. I always use a module to wrap up my plugins.

          Classes you can make instances of - as in, if in you code you need to refer to data that represent car data, the you probably want to make a Car class.

          Every time you need to store some data related to a car you'd then write for instance:

          
          my_car = Car;;new('Ford')
          my_car.color = 'red'
          my_car.year = 1977
          
          puts my_car.to_s # Prints "Red 1977 model Ford"
          
          

          (That was a quick and dirty explanation.)
          I think that Chris might have mentioned something about modules and classes in his ruby tutorials. I'm trying to track them down.

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

          1 Reply Last reply Reply Quote 0
          • C Offline
            Chris Fullmer
            last edited by 5 Jul 2009, 16:13

            I think I just mentioned that scripts should be in a module and then pointed to RockW's post A word of warning to developers or something like that, its a sticky. I don't think it explaines modules very well either. I always use something like this:

            ` module Clf_module

            def Clf_module.all_methods

            code here

            end # all_methods

            end # Clf_module

            UI.menu("Plugins").add_item("Loose Geometry to Groups") { Clf_module.all_methods }`

            Something like that. Its important to note, like Thom showed, that you always have to reference the module.method or module::method to access your methods. Even when you are defining a method inside the module, you still have to define it with the module prefix like I did with def Clf_module.all_methods (which I think its weird it has to have the module name in front of it even though its inside the module). And then also when you call your method fo put it in the menu (my last line), you have to use the module.method or module::method syntax again.

            Hope that helps. Please someone correct me if I have something wrong. That is what I figured out after much trial and error. I feel like my Ruby skills are not very technical.

            Chris

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

            1 Reply Last reply Reply Quote 0
            • T Offline
              tomasz
              last edited by 5 Jul 2009, 16:18

              @chris fullmer said:

              Even when you are defining a method inside the module, you still have to define it with the module prefix like I did with def Clf_module.all_methods (which I think its weird it has to have the module name in front of it even though its inside the module).

              I also think it is weird, but I realized that I had to do it this way when I started to get strange errors (don't remember what it was exactly) when I was calling SU2KT methods from a different class.

              Tomasz

              Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

              1 Reply Last reply Reply Quote 0
              • T Offline
                thomthom
                last edited by 5 Jul 2009, 16:22

                You can do def self.all_methods preventing potential typos.

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

                1 Reply Last reply Reply Quote 0
                • M Offline
                  MrWip
                  last edited by 5 Jul 2009, 19:37

                  OOooh finally someone decided to create my plugin!!
                  I was in despear to see these day coming, but thanks Pixero, that's really great !

                  It works really fine on a small model, but I failed to make it works on a quite complexe one... it does create the two materials, but then, nothing else is changed... can this be linked to a complex nested geometry ?

                  http://www.wip-archi.com

                  1 Reply Last reply Reply Quote 0
                  • B Offline
                    BTM
                    last edited by 5 Jul 2009, 19:53

                    If a group has no colour, but is coloured with a transparent colour on the outside, it will end up as the clay material, and non-transparent, due to the script not doing anything with the assigned colours of groups/ components. I think that if there is a group, the script should see if it has a material assigned to it, if so, don't change the 'default' colours inside, but change all non-default colours inside, and the exterior material to the clay one/ transparent clay one. If the group has no material assigned to it, treat it normally. That way, groups with transparent materials assigned to them will work properly. Personally, I don't usually paint groups themselves, but it's still a thought.

                    1 Reply Last reply Reply Quote 0
                    • M Offline
                      MrWip
                      last edited by 5 Jul 2009, 20:00

                      Pixero, playing a bit around, I've discover some little problems, so I dare point them out...

                      The plugin does not threat the object if the texture has been paint on the group (and not directly on the face... a classical Sketchup trouble finally), and it does not modify backfaces, as far as I can see...

                      Also, the translucent material appear originally with a 0 translucency, which is a bit 'violent'... Actually, the best, for a renderer like Vray, will be to make it automatically full black with something like 20 of opacity.

                      Besides, it's a great tool for architects, really...it just need some little improvement !

                      Thanks again...

                      http://www.wip-archi.com

                      1 Reply Last reply Reply Quote 0
                      • T Offline
                        thomthom
                        last edited by 5 Jul 2009, 20:11

                        @mrwip said:

                        Pixero, playing a bit around, I've discover some little problems, so I dare point them out...

                        The plugin does not threat the object if the texture has been paint on the group (and not directly on the face... a classical Sketchup trouble finally), and it does not modify backfaces, as far as I can see...

                        Also, the translucent material appear originally with a 0 translucency, which is a bit 'violent'... Actually, the best, for a renderer like Vray, will be to make it automatically full black with something like 20 of opacity.

                        Besides, it's a great tool for architects, really...it just need some little improvement !

                        Thanks again...

                        If you're using V-Ray you should not apply materials to groups/components as that really really slows down the parsing time.

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

                        1 Reply Last reply Reply Quote 0
                        • M Offline
                          MrWip
                          last edited by 5 Jul 2009, 21:00

                          @unknownuser said:

                          If you're using V-Ray you should not apply materials to groups/components as that really really slows down the parsing time.

                          Well, of course, it's best not to do it, but when you have a complex model, sometimes you're making little mistakes without noticing, and applying texture on a group is one of them...

                          Besides, many people don't know that it's better to apply texture directly on the geometry itself, so, for them, improving that part could be a good thing.

                          http://www.wip-archi.com

                          1 Reply Last reply Reply Quote 0
                          • P Offline
                            Pixero
                            last edited by 6 Jul 2009, 10:48

                            Minor update now with module added.

                            Mr Wip if you want a higher opacity setting just open the script in a texteditor (simple text will do fine) and go to line 35. Change: g.alpha = 0 to something higher.

                            EDIT: I just did it myself. πŸ˜‰

                            As to the other comments.
                            If you have ways to make the script better feel free. Just let me know so I can post the updated version.

                            1 Reply Last reply Reply Quote 0
                            • G Offline
                              Gaieus
                              last edited by 6 Jul 2009, 18:38

                              Jim has his (now improved) GreyScale Plugin , too, which works similarly - or better to say "may work differently" but has similar results (among others).

                              Gai...

                              1 Reply Last reply Reply Quote 0
                              • M Offline
                                MrWip
                                last edited by 6 Jul 2009, 20:30

                                Gaieus, Greyscale is a great plugin, but it does not create the clay effect that we're looking for here... all the texture are still visible, and the point is not to see them, as in a real clay model...

                                http://www.wip-archi.com

                                1 Reply Last reply Reply Quote 0
                                • P Offline
                                  Pixero
                                  last edited by 7 Jul 2009, 05:59

                                  The major thing with this script is that it doesnt make transparent materials opaque.

                                  1 Reply Last reply Reply Quote 0
                                  • C Offline
                                    CadFather
                                    last edited by 7 Jul 2009, 07:47

                                    Thank you Jan, very interesting.. πŸ˜„

                                    1 Reply Last reply Reply Quote 0
                                    • T Offline
                                      TIG Moderator
                                      last edited by 7 Jul 2009, 07:48

                                      @pixero said:

                                      The major thing with this script is that it doesn't make transparent materials opaque.

                                      And of course if you don't want transparency then you can always switch it 'off' anyway...

                                      TIG

                                      1 Reply Last reply Reply Quote 0
                                      • P Offline
                                        Pixero
                                        last edited by 7 Jul 2009, 08:07

                                        I'm using Vray and it has an option that overrides all materials and make them the same.
                                        However transparent materials also gets opaque so thats why I wrote this plugin.

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

                                        Advertisement