sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Reset color to average texture color

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 3 Posters 242 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.
    • Al HartA Offline
      Al Hart
      last edited by

      Sometimes we create a new material from a texture and want to set the material color to the average texture color.

      We use to do this by setting the material color to nil.

      
      new_matl.color = nil	# use average texture color
      
      

      But this stopped working.

      However, we found a fix where if you set to color to itself after setting it to nil, it works ok again:

      
      new_matl.color = nil	# use average texture color
      new_matl.color = new_matl.color # this causes new color to be used properly
      

      Go figure???

      Al Hart

      http://wiki.renderplus.com/images/e/ef/Render_plus_colored30x30%29.PNG
      IRender nXt from Render Plus

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

        Why didn't you use

        new_matl.color = new_matl.texture.average_color if new_matl.texture
        

        in the first instance ?
        😕

        TIG

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

          @al hart said:

          But this stopped working.

          When?

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

          1 Reply Last reply Reply Quote 0
          • Al HartA Offline
            Al Hart
            last edited by

            Thanks,

            Just the kind of advice I need. I'll go try it out.

            ... Seems to work great!

            Al Hart

            http://wiki.renderplus.com/images/e/ef/Render_plus_colored30x30%29.PNG
            IRender nXt from Render Plus

            1 Reply Last reply Reply Quote 0
            • Al HartA Offline
              Al Hart
              last edited by

              @thomthom said:

              @al hart said:

              But this stopped working.

              When?

              I don't know when it stopped working - sometime after I discovered that setting the color to nil did work (several years ago), and this past month when people started reporting bugs. (So of course, I suspected SU 8. But I just tried SU 7 and it fails there as well. So who knows...)

              The bug was interesting, because the color looked OK in the SketchUp model until you saved and reloaded the model. However, the material editor showed that the material color was not set. When you click reset color it sets the color properly.


              nil_color2.jpg

              Al Hart

              http://wiki.renderplus.com/images/e/ef/Render_plus_colored30x30%29.PNG
              IRender nXt from Render Plus

              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