Game Development Community

Updating Textures

by mb · in Constructor · 04/29/2007 (11:34 am) · 11 replies

There needs to be an update textures button that reloads textures in the texture browser (maybe 'update album' or something like that that reloads all textures in an album).

I resized a texture and saved over the old one. Then I closed the scene and reloaded and it still didnt update the texure as the right size. I had to close constructor completely and reopen it for it to update the new texture.

#1
04/29/2007 (11:44 am)
Also being able to select multiple entities and delete all.
#2
05/05/2007 (2:21 pm)
Just bumping this thread up a bit, we really need a way to reload textures. It's becoming a major pain to have to shut constructor down every single time you change a texture.
#3
05/05/2007 (2:38 pm)
Actually. Nevermind. I found a way to do this. Open up the console, type flushTextureCache. Works fine.
#4
05/05/2007 (5:05 pm)
Thanks a lot. Great find.
#5
05/07/2007 (8:27 am)
Ah thanks Magnus, I'll have to remember this :)
edit: Maybe we could make a little plug-in for this.
#6
05/08/2007 (12:02 am)
Greetings!

In the next release you'll be able to flush all textures from the GUI. Either from the Materials menu or from a button on the Texture Browser.

- LightWave Dave
#7
05/09/2007 (7:14 am)
Nice! Thanks Dave.
#8
05/13/2007 (9:36 am)
I've created a plugin for flushing textures.
You can always type flushTextureCache(); in console. I like to have a button, and it was mostly to help me out on scripting in Torque.

I've saved it as flushtexture.cs in my Constructor > Plugins folder.
Then compiled it.


Enjoy.


package FlushTextures
{
  
   function Plugin::Activate(%this, %version, %inst, %static)
   {
      if(%version != 1)
      {
         return tool.FUNC_BADVERSION();
      }
      
      //*** This tool doesn't need to make use of the instance
      %inst.instance = 0;
      %inst.flagsInterface = tool.IFLAG_NONE(); // No special interface flags as there will be no interface
      %inst.flagsApply = tool.AFLAG_NONE();     // No special actions when tool is applied
      
      //*** Return that everything is OK
      return tool.FUNC_OK();
   }

   //************************************************************************************
   function Plugin::Done(%this, %inst, %static)
   {
      if (!FlushTextures.Visible)
      {
         %plugin = %inst.instance;
         if(%plugin)
         {         
            //*** Delete our instance
            %plugin.delete();
            %inst.instance = 0;
         }
      }
   }

   //************************************************************************************
   
   function Plugin::Execute(%this, %inst)
   {
      %plugin = %inst.instance;
      flushTextureCache();
      error("Flushin Textures"); //testing
   }
};

tool.register("FlushTextures", tool.typeGeneric(), tool.RFLAG_NONE(), "Flush Textures" );
#9
05/13/2007 (10:00 am)
Good going!
I would have probably done it myself hadn't Dave said it would be fixed (and if I didn't have so damn many other things to do at the moment).
#10
05/14/2007 (5:57 am)
The only thing that doesn't work with my plugin. Is that it doesn't update the Album.

Example, If you open up a scene on a different computer, which has an out of date texture album. An error texture appears on the brushes. I've update the album, then flushTextureCache(); and I still have error texture.
The way I fixed this was restarting Constructor.

Does anyone know how to update the album in the scene, so Constructor sees the new textures? Instead of restarting.
#11
05/25/2007 (6:13 pm)
This is a great thing to flush textures .... however when I do it throws a bunch of weird images on my objects, like the icons for buttons used in Constructor. Any fix for that? I used the flushTextureCache(); code.

Also, in a similar manner .... is there any way to update DTS shapes by flushing them? If so, would it be possible to flush/reload certain DTS shapes, say by putting the shape name inside the parenthesis? I'm an artist, not a coder, but do have some basic experience with coding (JavaScript, etc.). :-)