1. Hey :)

    I'm having some trouble with finding out how to create and assign a greyscale texture to my checkbuttons. Here's what I'd expect to work:

     for i,value in ipairs(Professions) do
            local desaturated
    
            CreateFrame("CheckButton","ProfessionButton"..value,SpellBookProfessionFrame,"ProfessionButtonTemplate")
    
            _G["ProfessionButton"..value]:SetNormalTexture("Interface\\Icons\\"..Icons[value])
            _G["ProfessionButton"..value]:SetPoint("TOPLEFT",77+((i-1)*28),-35)
    
            desaturated = _G["ProfessionButton"..value]:GetNormalTexture()
            desaturated:SetDesaturated(True)
            _G["ProfessionButton"..value]:SetDisabledTexture(desaturated)
        end
    

    Am I doing something wrong here?

    Thanks, Chris.

    Well, you're setting the same texture to be the normal and the disabled one.. not two where one is grayscale and one isn't. If you want different normal and disabled states, you need two textures.

    Hey James, thanks for the reply.

    desaturated = _G["ProfessionButton"..value]:GetNormalTexture()

    Does this not get me a new instance of the normal texture that I can then mess with and reassign? Maybe I'm too used to other languages to understand how that function works.

    So there's no way to grab the normal texture into a temporary variable (desaturated) then desaturate it and assign it to DisabledTexture?

    Hey James, thanks for the reply.

    desaturated = _G["ProfessionReimburserButton"..value]:GetNormalTexture()

    Does this not get me a new instance of the normal texture that I can then mess with and reassign? Maybe I'm too used to other languages to understand how that function works.

    No, it just returns a reference to the texture object.

    So there's no way to grab the normal texture into a temporary variable (desaturated) then desaturate it and assign it to DisabledTexture?

    No, because the texture is a mutable object.. there is only ever one instance of it. If you want another texture, you need to construct one.

    Thanks for the gentle nudge in the right direction :)

    Here's the finished code in case anyone else comes across this problem:

       for i,value in ipairs(Professions) do
          CreateFrame("CheckButton","ProfessionButton"..value,SpellBookProfessionFrame,"ProfessionButtonTemplate")
          _G["ProfessionButton"..value]:SetNormalTexture("Interface\\Icons\\"..Icons[value])
          _G["ProfessionButton"..value]:SetPoint("TOPLEFT",77+((i-1)*28),-35)
     
          _G["ProfessionButton"..value]:CreateTexture("ProfessionButton"..value.."DisabledTexture")
     
          _G["ProfessionButton"..value.."DisabledTexture"]:SetTexture("Interface\\Icons\\"..Icons[value])
          _G["ProfessionButton"..value.."DisabledTexture"]:SetDesaturated("True")
          _G["ProfessionButton"..value.."DisabledTexture"]:SetAllPoints(_G["ProfessionButton"..value])
          _G["ProfessionButton"..value]:SetDisabledTexture(_G["ProfessionButton"..value.."DisabledTexture"])
      end
    

    Enjoy the weekend.