Removing default image of an element

Here’s a proposition to do what the titles suggests.

As it is, the setColorMap(…) method doesn’t play nice if you give it a null. The following fixes it.

[java]

This patch file was generated by NetBeans IDE

It uses platform neutral UTF-8 encoding and \n newlines.

— Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -1940,6 +1940,13 @@
}

public void setColorMap(String colorMap) {
  •        if (colorMap == null) {
    
  •            // Assume we want to completely remove the background image.
    
  •            mat.clearParam("ColorMap");
    
  •            // Do the same we do in constructor.
    
  •            mat.setColor("Color", defaultColor);
    
  •            return;
    
  •        }
      Texture color = null;
      if (screen.getUseTextureAtlas()) {
      	if (this.getElementTexture() != null)	color = getElementTexture();
    

[/java]

1 Like

Thanks for this. I need to double check how this plays with atlasing, but will add for sure.