Quellcode durchsuchen

gui types using image_asset

marauder2k7 vor 1 Jahr
Ursprung
Commit
f519cff6ff
25 geänderte Dateien mit 195 neuen und 277 gelöschten Zeilen
  1. 100 111
      Engine/source/gui/controls/guiBitmapCtrl.cpp
  2. 41 45
      Engine/source/gui/controls/guiBitmapCtrl.h
  3. 6 21
      Engine/source/gui/controls/guiGameSettingsCtrl.cpp
  4. 3 10
      Engine/source/gui/controls/guiGameSettingsCtrl.h
  5. 6 9
      Engine/source/gui/core/guiTypes.cpp
  6. 1 4
      Engine/source/gui/core/guiTypes.h
  7. 3 15
      Engine/source/gui/game/guiChunkedBitmapCtrl.cpp
  8. 1 4
      Engine/source/gui/game/guiChunkedBitmapCtrl.h
  9. 1 2
      Engine/source/gui/game/guiProgressBitmapCtrl.cpp
  10. 1 10
      Engine/source/gui/game/guiProgressBitmapCtrl.h
  11. 4 6
      Engine/source/gui/worldEditor/guiMissionArea.cpp
  12. 1 4
      Engine/source/gui/worldEditor/guiMissionArea.h
  13. 9 9
      Engine/source/gui/worldEditor/worldEditor.cpp
  14. 3 10
      Engine/source/gui/worldEditor/worldEditor.h
  15. 1 1
      Templates/BaseGame/game/data/gameUI/GUIs/playGui.gui
  16. 3 3
      Templates/BaseGame/game/tools/assetBrowser/guis/assetPreviewButtonsTemplate.gui
  17. 1 1
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript
  18. 2 2
      Templates/BaseGame/game/tools/gui/materialSelector.ed.gui
  19. 1 1
      Templates/BaseGame/game/tools/guiEditor/gui/EditorChooseGUI.ed.gui
  20. 1 3
      Templates/BaseGame/game/tools/materialEditor/gui/Profiles.ed.tscript
  21. 1 1
      Templates/BaseGame/game/tools/materialEditor/gui/guiMaterialPropertiesWindow.ed.gui
  22. 1 1
      Templates/BaseGame/game/tools/materialEditor/gui/guiMaterialPropertiesWindow.ed.gui.orig
  23. 1 1
      Templates/BaseGame/game/tools/navEditor/NavEditorToolbar.gui
  24. 1 1
      Templates/BaseGame/game/tools/worldEditor/gui/EditorChooseLevelGui.ed.gui
  25. 2 2
      Templates/BaseGame/game/tools/worldEditor/gui/EditorGui.ed.gui

+ 100 - 111
Engine/source/gui/controls/guiBitmapCtrl.cpp

@@ -34,15 +34,15 @@
 
 
 IMPLEMENT_CONOBJECT(GuiBitmapCtrl);
 IMPLEMENT_CONOBJECT(GuiBitmapCtrl);
 
 
-ConsoleDocClass( GuiBitmapCtrl,
+ConsoleDocClass(GuiBitmapCtrl,
    "@brief A gui control that is used to display an image.\n\n"
    "@brief A gui control that is used to display an image.\n\n"
-   
+
    "The image is stretched to the constraints of the control by default. However, the control can also\n"
    "The image is stretched to the constraints of the control by default. However, the control can also\n"
    "tile the image as well.\n\n"
    "tile the image as well.\n\n"
 
 
    "The image itself is stored inside the GuiBitmapCtrl::bitmap field. The boolean value that decides\n"
    "The image itself is stored inside the GuiBitmapCtrl::bitmap field. The boolean value that decides\n"
    "whether the image is stretched or tiled is stored inside the GuiBitmapCtrl::wrap field.\n"
    "whether the image is stretched or tiled is stored inside the GuiBitmapCtrl::wrap field.\n"
-   
+
    "@tsexample\n"
    "@tsexample\n"
    "// Create a tiling GuiBitmapCtrl that displays \"myImage.png\"\n"
    "// Create a tiling GuiBitmapCtrl that displays \"myImage.png\"\n"
    "%bitmapCtrl = new GuiBitmapCtrl()\n"
    "%bitmapCtrl = new GuiBitmapCtrl()\n"
@@ -51,101 +51,87 @@ ConsoleDocClass( GuiBitmapCtrl,
    "   wrap = \"true\";\n"
    "   wrap = \"true\";\n"
    "};\n"
    "};\n"
    "@endtsexample\n\n"
    "@endtsexample\n\n"
-   
+
    "@ingroup GuiControls"
    "@ingroup GuiControls"
 );
 );
 
 
 GuiBitmapCtrl::GuiBitmapCtrl(void)
 GuiBitmapCtrl::GuiBitmapCtrl(void)
- : mStartPoint( 0, 0 ),
+   : mStartPoint(0, 0),
    mColor(ColorI::WHITE),
    mColor(ColorI::WHITE),
    mAngle(0),
    mAngle(0),
-   mWrap( false )
-{
-   INIT_ASSET(Bitmap);
-}
-
-bool GuiBitmapCtrl::setBitmapName( void *object, const char *index, const char *data )
+   mWrap(false),
+   mBitmap(NULL),
+   mBitmapName(StringTable->EmptyString())
 {
 {
-   // Prior to this, you couldn't do bitmap.bitmap = "foo.jpg" and have it work.
-   // With protected console types you can now call the setBitmap function and
-   // make it load the image.
-   static_cast<GuiBitmapCtrl *>( object )->setBitmap( data );
-
-   // Return false because the setBitmap method will assign 'mBitmapName' to the
-   // argument we are specifying in the call.
-   return false;
 }
 }
 
 
 void GuiBitmapCtrl::initPersistFields()
 void GuiBitmapCtrl::initPersistFields()
 {
 {
    docsURL;
    docsURL;
-   addGroup( "Bitmap" );
+   addGroup("Bitmap");
 
 
-      addField("Bitmap", TypeImageFilename, Offset(mBitmapName, GuiBitmapCtrl), assetDoc(Bitmap, docs), AbstractClassRep::FIELD_HideInInspectors);
-      addField("BitmapAsset", TypeImageAssetId, Offset(mBitmapAssetId, GuiBitmapCtrl), assetDoc(Bitmap, asset docs.));
+   INITPERSISTFIELD_IMAGEASSET_REFACTOR(Bitmap, GuiBitmapCtrl, "The bitmap to render in this BitmapCtrl.")
 
 
-      addField("color", TypeColorI, Offset(mColor, GuiBitmapCtrl),"color mul");
-      addField( "wrap",   TypeBool,     Offset( mWrap, GuiBitmapCtrl ),
-         "If true, the bitmap is tiled inside the control rather than stretched to fit." );
+   addField("color", TypeColorI, Offset(mColor, GuiBitmapCtrl), "color mul");
+   addField("wrap", TypeBool, Offset(mWrap, GuiBitmapCtrl),
+      "If true, the bitmap is tiled inside the control rather than stretched to fit.");
 
 
-      addField("angle", TypeF32, Offset(mAngle, GuiBitmapCtrl), "rotation");
-      
-   endGroup( "Bitmap" );
+   addField("angle", TypeF32, Offset(mAngle, GuiBitmapCtrl), "rotation");
+
+   endGroup("Bitmap");
 
 
    Parent::initPersistFields();
    Parent::initPersistFields();
 }
 }
 
 
 bool GuiBitmapCtrl::onWake()
 bool GuiBitmapCtrl::onWake()
 {
 {
-   if (! Parent::onWake())
+   if (!Parent::onWake())
       return false;
       return false;
    setActive(true);
    setActive(true);
 
 
-   if (mBitmapName != StringTable->insert("texhandle"))
-      setBitmap(getBitmap());
    return true;
    return true;
 }
 }
 
 
 void GuiBitmapCtrl::onSleep()
 void GuiBitmapCtrl::onSleep()
 {
 {
-   if ( mBitmapName != StringTable->insert("texhandle") )
-      mBitmap = NULL;
-
    Parent::onSleep();
    Parent::onSleep();
 }
 }
 
 
 //-------------------------------------
 //-------------------------------------
 void GuiBitmapCtrl::inspectPostApply()
 void GuiBitmapCtrl::inspectPostApply()
 {
 {
-   //This is a little bit of a 'special case' handling for this class
-   //Because we don't do the normal protectedField setup for the bitmapName/bitmapAsset fields
-   //which would automatically update the internal values and bound content, we'll do it here manually
-   //to ensure it's updated before we force a refresh, which would thrash the new values
-   if (mBitmapName != StringTable->insert("texhandle"))
-   {
-      _setBitmap(mBitmapAssetId);
-   }
-   else
-   {
-      setBitmap(getBitmap());
-   }
-
    // if the extent is set to (0,0) in the gui editor and appy hit, this control will
    // if the extent is set to (0,0) in the gui editor and appy hit, this control will
    // set it's extent to be exactly the size of the bitmap (if present)
    // set it's extent to be exactly the size of the bitmap (if present)
    Parent::inspectPostApply();
    Parent::inspectPostApply();
 
 
-   if (!mWrap && (getExtent().x == 0) && (getExtent().y == 0) && mBitmap)
+   if (!mWrap && (getExtent().x == 0) && (getExtent().y == 0) && mBitmapAsset.notNull())
    {
    {
-      setExtent( mBitmap->getWidth(), mBitmap->getHeight());
+      setExtent(mBitmap->getWidth(), mBitmap->getHeight());
    }
    }
 }
 }
 
 
-void GuiBitmapCtrl::setBitmap( const char *name, bool resize )
+void GuiBitmapCtrl::setBitmap(const char* name, bool resize)
 {
 {
-   _setBitmap(StringTable->insert(name));
+   // coming in here we are probably getting a filename.
+   if (AssetDatabase.isDeclaredAsset(name))
+   {
+      _setBitmap(StringTable->insert(name));
+   }
+   else
+   {
+      StringTableEntry assetId = ImageAsset::getAssetIdByFilename(StringTable->insert(name));
+
+      if (assetId != StringTable->EmptyString())
+         _setBitmap(assetId);
+      else
+         return;
+   }
 
 
-   if (mBitmap && resize)
+   mBitmap = mBitmapAsset->getTexture(&GFXDefaultGUIProfile);
+
+   if (mBitmapAsset.notNull() && resize)
    {
    {
+     
       setExtent(mBitmap->getWidth(), mBitmap->getHeight());
       setExtent(mBitmap->getWidth(), mBitmap->getHeight());
       updateSizing();
       updateSizing();
    }
    }
@@ -153,15 +139,6 @@ void GuiBitmapCtrl::setBitmap( const char *name, bool resize )
    setUpdate();
    setUpdate();
 }
 }
 
 
-void GuiBitmapCtrl::updateSizing()
-{
-   if(!getParent())
-      return;
-   // updates our bounds according to our horizSizing and verSizing rules
-   RectI fakeBounds( getPosition(), getParent()->getExtent());
-   parentResized( fakeBounds, fakeBounds);
-}
-
 void GuiBitmapCtrl::setBitmapHandle(GFXTexHandle handle, bool resize)
 void GuiBitmapCtrl::setBitmapHandle(GFXTexHandle handle, bool resize)
 {
 {
    mBitmap = handle;
    mBitmap = handle;
@@ -169,46 +146,58 @@ void GuiBitmapCtrl::setBitmapHandle(GFXTexHandle handle, bool resize)
    mBitmapName = StringTable->insert("texhandle");
    mBitmapName = StringTable->insert("texhandle");
 
 
    // Resize the control to fit the bitmap
    // Resize the control to fit the bitmap
-   if (resize) 
+   if (resize)
    {
    {
       setExtent(mBitmap->getWidth(), mBitmap->getHeight());
       setExtent(mBitmap->getWidth(), mBitmap->getHeight());
       updateSizing();
       updateSizing();
    }
    }
 }
 }
 
 
-void GuiBitmapCtrl::onRender(Point2I offset, const RectI &updateRect)
+void GuiBitmapCtrl::updateSizing()
 {
 {
+   if (!getParent())
+      return;
+   // updates our bounds according to our horizSizing and verSizing rules
+   RectI fakeBounds(getPosition(), getParent()->getExtent());
+   parentResized(fakeBounds, fakeBounds);
+}
+
+void GuiBitmapCtrl::onRender(Point2I offset, const RectI& updateRect)
+{
+   if (mBitmap.isNull() && mBitmapAsset.notNull())
+      mBitmap = getBitmap();
+
    if (mBitmap)
    if (mBitmap)
    {
    {
       GFX->getDrawUtil()->clearBitmapModulation();
       GFX->getDrawUtil()->clearBitmapModulation();
       GFX->getDrawUtil()->setBitmapModulation(mColor);
       GFX->getDrawUtil()->setBitmapModulation(mColor);
-		if(mWrap)
-		{
+      if (mWrap)
+      {
          // We manually draw each repeat because non power of two textures will 
          // We manually draw each repeat because non power of two textures will 
          // not tile correctly when rendered with GFX->drawBitmapTile(). The non POT
          // not tile correctly when rendered with GFX->drawBitmapTile(). The non POT
          // bitmap will be padded by the hardware, and we'll see lots of slack
          // bitmap will be padded by the hardware, and we'll see lots of slack
          // in the texture. So... lets do what we must: draw each repeat by itself:
          // in the texture. So... lets do what we must: draw each repeat by itself:
- 			GFXTextureObject* texture = mBitmap;
-			RectI srcRegion;
-			RectI dstRegion;
-			F32 xdone = ((F32)getExtent().x/(F32)texture->mBitmapSize.x)+1;
-			F32 ydone = ((F32)getExtent().y/(F32)texture->mBitmapSize.y)+1;
-
-			S32 xshift = mStartPoint.x%texture->mBitmapSize.x;
-			S32 yshift = mStartPoint.y%texture->mBitmapSize.y;
-			for(S32 y = 0; y < ydone; ++y)
-				for(S32 x = 0; x < xdone; ++x)
-				{
-		 			srcRegion.set(0,0,texture->mBitmapSize.x,texture->mBitmapSize.y);
-  					dstRegion.set( ((texture->mBitmapSize.x*x)+offset.x)-xshift,
-								      ((texture->mBitmapSize.y*y)+offset.y)-yshift,
-								      texture->mBitmapSize.x,
-								      texture->mBitmapSize.y);
+         GFXTextureObject* texture = mBitmap;
+         RectI srcRegion;
+         RectI dstRegion;
+         F32 xdone = ((F32)getExtent().x / (F32)texture->mBitmapSize.x) + 1;
+         F32 ydone = ((F32)getExtent().y / (F32)texture->mBitmapSize.y) + 1;
+
+         S32 xshift = mStartPoint.x % texture->mBitmapSize.x;
+         S32 yshift = mStartPoint.y % texture->mBitmapSize.y;
+         for (S32 y = 0; y < ydone; ++y)
+            for (S32 x = 0; x < xdone; ++x)
+            {
+               srcRegion.set(0, 0, texture->mBitmapSize.x, texture->mBitmapSize.y);
+               dstRegion.set(((texture->mBitmapSize.x * x) + offset.x) - xshift,
+                  ((texture->mBitmapSize.y * y) + offset.y) - yshift,
+                  texture->mBitmapSize.x,
+                  texture->mBitmapSize.y);
                GFX->getDrawUtil()->drawBitmapStretchSR(texture, dstRegion, srcRegion, GFXBitmapFlip_None, GFXTextureFilterLinear, mAngle);
                GFX->getDrawUtil()->drawBitmapStretchSR(texture, dstRegion, srcRegion, GFXBitmapFlip_None, GFXTextureFilterLinear, mAngle);
-				}
+            }
 
 
-		}
-		else
+      }
+      else
       {
       {
          RectI rect(offset, getExtent());
          RectI rect(offset, getExtent());
          GFX->getDrawUtil()->drawBitmapStretch(mBitmap, rect, GFXBitmapFlip_None, GFXTextureFilterLinear, false, mAngle);
          GFX->getDrawUtil()->drawBitmapStretch(mBitmap, rect, GFXBitmapFlip_None, GFXTextureFilterLinear, false, mAngle);
@@ -226,21 +215,21 @@ void GuiBitmapCtrl::onRender(Point2I offset, const RectI &updateRect)
 
 
 void GuiBitmapCtrl::setValue(S32 x, S32 y)
 void GuiBitmapCtrl::setValue(S32 x, S32 y)
 {
 {
-   if (mBitmap)
+   if (mBitmapAsset.notNull())
    {
    {
-		x += mBitmap->getWidth() / 2;
-		y += mBitmap->getHeight() / 2;
-  	}
-  	while (x < 0)
-  		x += 256;
-  	mStartPoint.x = x % 256;
-
-  	while (y < 0)
-  		y += 256;
-  	mStartPoint.y = y % 256;
+      x += mBitmapAsset->getTextureBitmapWidth() / 2;
+      y += mBitmapAsset->getTextureBitmapHeight() / 2;
+   }
+   while (x < 0)
+      x += 256;
+   mStartPoint.x = x % 256;
+
+   while (y < 0)
+      y += 256;
+   mStartPoint.y = y % 256;
 }
 }
 
 
-DefineEngineMethod( GuiBitmapCtrl, setValue, void, ( S32 x, S32 y ),,
+DefineEngineMethod(GuiBitmapCtrl, setValue, void, (S32 x, S32 y), ,
    "Set the offset of the bitmap within the control.\n"
    "Set the offset of the bitmap within the control.\n"
    "@param x The x-axis offset of the image.\n"
    "@param x The x-axis offset of the image.\n"
    "@param y The y-axis offset of the image.\n")
    "@param y The y-axis offset of the image.\n")
@@ -257,7 +246,7 @@ static ConsoleDocFragment _sGuiBitmapCtrlSetBitmap1(
    "@param filename The filename of the image.\n"
    "@param filename The filename of the image.\n"
    "@param resize Optional parameter. If true, the GUI will resize to fit the image.",
    "@param resize Optional parameter. If true, the GUI will resize to fit the image.",
    "GuiBitmapCtrl", // The class to place the method in; use NULL for functions.
    "GuiBitmapCtrl", // The class to place the method in; use NULL for functions.
-   "void setBitmap( String filename, bool resize );" ); // The definition string.
+   "void setBitmap( String filename, bool resize );"); // The definition string.
 
 
 static ConsoleDocFragment _sGuiBitmapCtrlSetBitmap2(
 static ConsoleDocFragment _sGuiBitmapCtrlSetBitmap2(
    "@brief Assign an image to the control.\n\n"
    "@brief Assign an image to the control.\n\n"
@@ -265,42 +254,42 @@ static ConsoleDocFragment _sGuiBitmapCtrlSetBitmap2(
    "@param filename The filename of the image.\n"
    "@param filename The filename of the image.\n"
    "@param resize A boolean value that decides whether the ctrl refreshes or not.",
    "@param resize A boolean value that decides whether the ctrl refreshes or not.",
    "GuiBitmapCtrl", // The class to place the method in; use NULL for functions.
    "GuiBitmapCtrl", // The class to place the method in; use NULL for functions.
-   "void setBitmap( String filename );" ); // The definition string.
+   "void setBitmap( String filename );"); // The definition string.
 
 
 
 
 //"Set the bitmap displayed in the control. Note that it is limited in size, to 256x256."
 //"Set the bitmap displayed in the control. Note that it is limited in size, to 256x256."
-DefineEngineMethod( GuiBitmapCtrl, setBitmap, void, ( const char * fileRoot, bool resize), ( false),
+DefineEngineMethod(GuiBitmapCtrl, setBitmap, void, (const char* fileRoot, bool resize), (false),
    "( String filename | String filename, bool resize ) Assign an image to the control.\n\n"
    "( String filename | String filename, bool resize ) Assign an image to the control.\n\n"
-   "@hide" )
+   "@hide")
 {
 {
    char filename[1024];
    char filename[1024];
    Con::expandScriptFilename(filename, sizeof(filename), fileRoot);
    Con::expandScriptFilename(filename, sizeof(filename), fileRoot);
-   object->setBitmap(filename, resize );
+   object->setBitmap(filename, resize);
 }
 }
 
 
-DefineEngineMethod(GuiBitmapCtrl, getBitmap, const char*, (),,
+DefineEngineMethod(GuiBitmapCtrl, getBitmap, const char*, (), ,
    "Gets the current bitmap set for this control.\n\n"
    "Gets the current bitmap set for this control.\n\n"
    "@hide")
    "@hide")
 {
 {
-   return object->getBitmap();
+   return object->_getBitmap();
 }
 }
 
 
-DefineEngineMethod( GuiBitmapCtrl, setNamedTexture, bool, (String namedtexture),,
+DefineEngineMethod(GuiBitmapCtrl, setNamedTexture, bool, (String namedtexture), ,
    "@brief Set a texture as the image.\n\n"
    "@brief Set a texture as the image.\n\n"
    "@param namedtexture The name of the texture (NamedTexTarget).\n"
    "@param namedtexture The name of the texture (NamedTexTarget).\n"
-   "@return true if the texture exists." )
+   "@return true if the texture exists.")
 {
 {
    GFXTexHandle theTex;
    GFXTexHandle theTex;
-   NamedTexTarget *namedTarget = NULL;
+   NamedTexTarget* namedTarget = NULL;
    namedTarget = NamedTexTarget::find(namedtexture.c_str());
    namedTarget = NamedTexTarget::find(namedtexture.c_str());
-   if ( namedTarget )
+   if (namedTarget)
    {
    {
-      theTex = namedTarget->getTexture( 0 );
+      theTex = namedTarget->getTexture(0);
    }
    }
-   
-   if ( theTex.isValid() )
+
+   if (theTex.isValid())
    {
    {
-      object->setBitmapHandle( theTex , false );
+      object->setBitmapHandle(theTex, false);
       return true; //a new texture was set correctly
       return true; //a new texture was set correctly
    }
    }
    return false; //we couldn't change the texture
    return false; //we couldn't change the texture

+ 41 - 45
Engine/source/gui/controls/guiBitmapCtrl.h

@@ -31,51 +31,47 @@
 /// Renders a bitmap.
 /// Renders a bitmap.
 class GuiBitmapCtrl : public GuiControl
 class GuiBitmapCtrl : public GuiControl
 {
 {
-   public:
-   
-      typedef GuiControl Parent;
-
-   protected:
-   
-      /// Name of the bitmap file.  If this is 'texhandle' the bitmap is not loaded
-      /// from a file but rather set explicitly on the control.
-      DECLARE_IMAGEASSET(GuiBitmapCtrl, Bitmap, onImageChanged, GFXDefaultGUIProfile);
-      DECLARE_ASSET_SETGET(GuiBitmapCtrl, Bitmap);
-            
-      Point2I mStartPoint;
-      ColorI   mColor;
-      F32     mAngle;
-
-      /// If true, bitmap tiles inside control.  Otherwise stretches.
-      bool mWrap;
-
-      static bool setBitmapName( void *object, const char *index, const char *data );
-      static const char *getBitmapName( void *obj, const char *data );
-
-      void onImageChanged() {}
-
-   public:
-      
-      GuiBitmapCtrl();
-      static void initPersistFields();
-
-      void setBitmap(const char *name,bool resize = false);
-      void setBitmapHandle(GFXTexHandle handle, bool resize = false);
-
-      // GuiControl.
-      bool onWake() override;
-      void onSleep() override;
-      void inspectPostApply() override;
-
-      void updateSizing();
-
-      void onRender(Point2I offset, const RectI &updateRect) override;
-      void setValue(S32 x, S32 y);
-
-      DECLARE_CONOBJECT( GuiBitmapCtrl );
-      DECLARE_CATEGORY( "Gui Images" );
-      DECLARE_DESCRIPTION( "A control that displays a single, static image from a file.n"
-                           "The bitmap can either be tiled or stretched inside the control." );
+public:
+
+   typedef GuiControl Parent;
+
+protected:
+
+   /// Name of the bitmap file.  If this is 'texhandle' the bitmap is not loaded
+   /// from a file but rather set explicitly on the control.
+   DECLARE_IMAGEASSET_REFACTOR(GuiBitmapCtrl, Bitmap, GFXDefaultGUIProfile)
+
+   Point2I mStartPoint;
+   ColorI   mColor;
+   F32     mAngle;
+
+   /// If true, bitmap tiles inside control.  Otherwise stretches.
+   bool mWrap;
+
+public:
+   GFXTexHandle mBitmap;
+   StringTableEntry mBitmapName;
+
+   GuiBitmapCtrl();
+   static void initPersistFields();
+
+   // GuiControl.
+   bool onWake() override;
+   void onSleep() override;
+   void inspectPostApply() override;
+
+   void setBitmap(const char* name, bool resize = true);
+   void setBitmapHandle(GFXTexHandle handle, bool resize = false);
+
+   void updateSizing();
+
+   void onRender(Point2I offset, const RectI& updateRect) override;
+   void setValue(S32 x, S32 y);
+
+   DECLARE_CONOBJECT(GuiBitmapCtrl);
+   DECLARE_CATEGORY("Gui Images");
+   DECLARE_DESCRIPTION("A control that displays a single, static image from a file.n"
+      "The bitmap can either be tiled or stretched inside the control.");
 };
 };
 
 
 #endif
 #endif

+ 6 - 21
Engine/source/gui/controls/guiGameSettingsCtrl.cpp

@@ -59,10 +59,6 @@ GuiGameSettingsCtrl::GuiGameSettingsCtrl() :
    mCallbackOnB = mCallbackOnA;
    mCallbackOnB = mCallbackOnA;
    mCallbackOnX = mCallbackOnA;
    mCallbackOnX = mCallbackOnA;
    mCallbackOnY = mCallbackOnA;
    mCallbackOnY = mCallbackOnA;
-
-   INIT_ASSET(KeybindBitmap);
-   INIT_ASSET(PreviousBitmap);
-   INIT_ASSET(NextBitmap);
 }
 }
 
 
 GuiGameSettingsCtrl::~GuiGameSettingsCtrl()
 GuiGameSettingsCtrl::~GuiGameSettingsCtrl()
@@ -193,7 +189,7 @@ void GuiGameSettingsCtrl::onRenderListOption(Point2I currentOffset)
             arrowOffset.y = currentOffset.y + arrowOffsetY;
             arrowOffset.y = currentOffset.y + arrowOffsetY;
 
 
             drawer->clearBitmapModulation();
             drawer->clearBitmapModulation();
-            drawer->drawBitmapStretch(mPreviousBitmap, RectI(arrowOffset, Point2I(mArrowSize, mArrowSize)), GFXBitmapFlip_None, GFXTextureFilterLinear, false);
+            drawer->drawBitmapStretch(getPreviousBitmap(), RectI(arrowOffset, Point2I(mArrowSize, mArrowSize)), GFXBitmapFlip_None, GFXTextureFilterLinear, false);
          }
          }
          else
          else
          {
          {
@@ -214,7 +210,7 @@ void GuiGameSettingsCtrl::onRenderListOption(Point2I currentOffset)
             arrowOffset.y = currentOffset.y + arrowOffsetY;
             arrowOffset.y = currentOffset.y + arrowOffsetY;
 
 
             drawer->clearBitmapModulation();
             drawer->clearBitmapModulation();
-            drawer->drawBitmapStretch(mNextBitmap, RectI(arrowOffset, Point2I(mArrowSize, mArrowSize)), GFXBitmapFlip_None, GFXTextureFilterLinear, false);
+            drawer->drawBitmapStretch(getNextBitmap(), RectI(arrowOffset, Point2I(mArrowSize, mArrowSize)), GFXBitmapFlip_None, GFXTextureFilterLinear, false);
          }
          }
          else
          else
          {
          {
@@ -376,7 +372,7 @@ void GuiGameSettingsCtrl::onRenderKeybindOption(Point2I currentOffset)
    {
    {
       RectI rect(button, buttonSize);
       RectI rect(button, buttonSize);
       drawer->clearBitmapModulation();
       drawer->clearBitmapModulation();
-      drawer->drawBitmapStretch(mKeybindBitmap, rect, GFXBitmapFlip_None, GFXTextureFilterLinear, false);
+      drawer->drawBitmapStretch(getKeybindBitmap(), rect, GFXBitmapFlip_None, GFXTextureFilterLinear, false);
    }
    }
 
 
    //drawer->drawRectFill(button, ColorI::BLUE);
    //drawer->drawRectFill(button, ColorI::BLUE);
@@ -454,22 +450,11 @@ bool GuiGameSettingsCtrl::onWake()
    if( !Parent::onWake() )
    if( !Parent::onWake() )
       return false;
       return false;
 
 
-   _setNextBitmap(getNextBitmap());
-   _setPreviousBitmap(getPreviousBitmap());
-   _setKeybindBitmap(getKeybindBitmap());
-
    return true;
    return true;
 }
 }
 
 
 void GuiGameSettingsCtrl::onSleep()
 void GuiGameSettingsCtrl::onSleep()
 {
 {
-   if (mNextBitmapAsset.notNull())
-      mNextBitmap = NULL;
-   if (mPreviousBitmapAsset.notNull())
-      mPreviousBitmap = NULL;
-   if (mKeybindBitmapAsset.notNull())
-      mKeybindBitmap = NULL;
-
    Parent::onSleep();
    Parent::onSleep();
 }
 }
 
 
@@ -840,9 +825,9 @@ IMPLEMENT_CALLBACK(GuiGameSettingsCtrl, onAxisEvent, void, (const char* device,
 void GuiGameSettingsCtrl::initPersistFields()
 void GuiGameSettingsCtrl::initPersistFields()
 {
 {
    docsURL;
    docsURL;
-   INITPERSISTFIELD_IMAGEASSET(KeybindBitmap, GuiGameSettingsCtrl, "Bitmap used to display the bound key for this keybind option.");
-   INITPERSISTFIELD_IMAGEASSET(PreviousBitmap, GuiGameSettingsCtrl, "Bitmap used for the previous button when in list mode.");
-   INITPERSISTFIELD_IMAGEASSET(NextBitmap, GuiGameSettingsCtrl, "Bitmap used for the next button when in list mode.");
+   INITPERSISTFIELD_IMAGEASSET_REFACTOR(KeybindBitmap, GuiGameSettingsCtrl, "Bitmap used to display the bound key for this keybind option.");
+   INITPERSISTFIELD_IMAGEASSET_REFACTOR(PreviousBitmap, GuiGameSettingsCtrl, "Bitmap used for the previous button when in list mode.");
+   INITPERSISTFIELD_IMAGEASSET_REFACTOR(NextBitmap, GuiGameSettingsCtrl, "Bitmap used for the next button when in list mode.");
 
 
    addField("arrowSize", TypeS32, Offset(mArrowSize, GuiGameSettingsCtrl),
    addField("arrowSize", TypeS32, Offset(mArrowSize, GuiGameSettingsCtrl),
       "Size of the arrow buttons' extents");
       "Size of the arrow buttons' extents");

+ 3 - 10
Engine/source/gui/controls/guiGameSettingsCtrl.h

@@ -72,14 +72,9 @@ protected:
    Point2F                    mRange;           ///< When working as a slider, this sets our min/max range
    Point2F                    mRange;           ///< When working as a slider, this sets our min/max range
 
 
    //Keybind option
    //Keybind option
-   DECLARE_IMAGEASSET(GuiGameSettingsCtrl, KeybindBitmap, changeBitmap, GFXDefaultGUIProfile);
-   DECLARE_ASSET_SETGET(GuiGameSettingsCtrl, KeybindBitmap);
-
-   DECLARE_IMAGEASSET(GuiGameSettingsCtrl, PreviousBitmap, changeBitmap, GFXDefaultGUIProfile);
-   DECLARE_ASSET_SETGET(GuiGameSettingsCtrl, PreviousBitmap);
-
-   DECLARE_IMAGEASSET(GuiGameSettingsCtrl, NextBitmap, changeBitmap, GFXDefaultGUIProfile);
-   DECLARE_ASSET_SETGET(GuiGameSettingsCtrl, NextBitmap);
+   DECLARE_IMAGEASSET_REFACTOR(GuiGameSettingsCtrl, KeybindBitmap, GFXDefaultGUIProfile)
+   DECLARE_IMAGEASSET_REFACTOR(GuiGameSettingsCtrl, PreviousBitmap, GFXDefaultGUIProfile)
+   DECLARE_IMAGEASSET_REFACTOR(GuiGameSettingsCtrl, NextBitmap, GFXDefaultGUIProfile)
 
 
    S32 mArrowSize;
    S32 mArrowSize;
    S32 mColumnSplit; //Padding between the leftmost edge of the control, and the left side of the 'option'.
    S32 mColumnSplit; //Padding between the leftmost edge of the control, and the left side of the 'option'.
@@ -89,8 +84,6 @@ protected:
    bool mSelected;
    bool mSelected;
 
 
 public:
 public:
-   void changeBitmap() {}
-
    /// Sets the control as selected . Only controls that are enabled can be selected. 
    /// Sets the control as selected . Only controls that are enabled can be selected. 
    virtual void setSelected();
    virtual void setSelected();
 
 

+ 6 - 9
Engine/source/gui/core/guiTypes.cpp

@@ -78,8 +78,6 @@ GuiCursor::GuiCursor()
    mHotSpot.set(0,0);
    mHotSpot.set(0,0);
    mRenderOffset.set(0.0f,0.0f);
    mRenderOffset.set(0.0f,0.0f);
    mExtent.set(1,1);
    mExtent.set(1,1);
-
-   INIT_ASSET(Bitmap);
 }
 }
 
 
 GuiCursor::~GuiCursor()
 GuiCursor::~GuiCursor()
@@ -92,8 +90,7 @@ void GuiCursor::initPersistFields()
    addField("hotSpot",     TypePoint2I,   Offset(mHotSpot, GuiCursor), "The location of the cursor's hot spot (which pixel carries the click).");
    addField("hotSpot",     TypePoint2I,   Offset(mHotSpot, GuiCursor), "The location of the cursor's hot spot (which pixel carries the click).");
    addField("renderOffset",TypePoint2F,   Offset(mRenderOffset, GuiCursor), "Offset of the bitmap, where 0 signifies left edge of the bitmap, 1, the right. Similarly for the Y-component.");
    addField("renderOffset",TypePoint2F,   Offset(mRenderOffset, GuiCursor), "Offset of the bitmap, where 0 signifies left edge of the bitmap, 1, the right. Similarly for the Y-component.");
 
 
-   addProtectedField("bitmapName",  TypeImageFilename,  Offset(mBitmapName, GuiCursor), _setBitmapData, &defaultProtectedGetFn, "File name of the bitmap for the cursor.");
-   INITPERSISTFIELD_IMAGEASSET(Bitmap, GuiCursor, "name of the bitmap for the cursor.");
+   INITPERSISTFIELD_IMAGEASSET_REFACTOR(Bitmap, GuiCursor, "name of the bitmap for the cursor.");
    Parent::initPersistFields();
    Parent::initPersistFields();
 }
 }
 
 
@@ -114,21 +111,21 @@ void GuiCursor::onRemove()
 
 
 void GuiCursor::render(const Point2I &pos)
 void GuiCursor::render(const Point2I &pos)
 {
 {
-   if (mBitmap)
+   if (mBitmapAsset.notNull())
    {
    {
-      mExtent.set(mBitmap->getWidth(), mBitmap->getHeight());
+      mExtent.set(getBitmap()->getWidth(), getBitmap()->getHeight());
    }
    }
 
 
    // Render the cursor centered according to dimensions of texture
    // Render the cursor centered according to dimensions of texture
-   S32 texWidth = mBitmap.getWidth();
-   S32 texHeight = mBitmap.getHeight();
+   S32 texWidth = getBitmap()->getWidth();
+   S32 texHeight = getBitmap()->getHeight();
 
 
    Point2I renderPos = pos;
    Point2I renderPos = pos;
    renderPos.x -= (S32)( texWidth  * mRenderOffset.x );
    renderPos.x -= (S32)( texWidth  * mRenderOffset.x );
    renderPos.y -= (S32)( texHeight * mRenderOffset.y );
    renderPos.y -= (S32)( texHeight * mRenderOffset.y );
 
 
    GFX->getDrawUtil()->clearBitmapModulation();
    GFX->getDrawUtil()->clearBitmapModulation();
-   GFX->getDrawUtil()->drawBitmap(mBitmap, renderPos);
+   GFX->getDrawUtil()->drawBitmap(getBitmap(), renderPos);
 }
 }
 
 
 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------

+ 1 - 4
Engine/source/gui/core/guiTypes.h

@@ -348,8 +348,7 @@ class GuiCursor : public SimObject
 private:
 private:
    typedef SimObject Parent;
    typedef SimObject Parent;
 
 
-   DECLARE_IMAGEASSET(GuiCursor, Bitmap, onImageChanged, GFXGuiCursorProfile);
-   DECLARE_ASSET_SETGET(GuiCursor, Bitmap);
+   DECLARE_IMAGEASSET_REFACTOR(GuiCursor, Bitmap, GFXGuiCursorProfile)
 
 
    Point2I mHotSpot;
    Point2I mHotSpot;
    Point2F mRenderOffset;
    Point2F mRenderOffset;
@@ -367,8 +366,6 @@ public:
    bool onAdd(void) override;
    bool onAdd(void) override;
    void onRemove() override;
    void onRemove() override;
    void render(const Point2I &pos);
    void render(const Point2I &pos);
-
-   void onImageChanged() {}
 };
 };
 
 
 /// A GuiControlProfile is used by every GuiObject and is akin to a
 /// A GuiControlProfile is used by every GuiObject and is akin to a

+ 3 - 15
Engine/source/gui/game/guiChunkedBitmapCtrl.cpp

@@ -67,7 +67,7 @@ void GuiChunkedBitmapCtrl::initPersistFields()
 {
 {
    docsURL;
    docsURL;
    addGroup("GuiChunkedBitmapCtrl");
    addGroup("GuiChunkedBitmapCtrl");
-      INITPERSISTFIELD_IMAGEASSET(Bitmap, GuiChunkedBitmapCtrl, "This is the bitmap to render to the control.");
+      INITPERSISTFIELD_IMAGEASSET_REFACTOR(Bitmap, GuiChunkedBitmapCtrl, "This is the bitmap to render to the control.");
 
 
       addField( "useVariable",   TypeBool,      Offset( mUseVariable, GuiChunkedBitmapCtrl ), "This decides whether to use the \"bitmap\" file "
       addField( "useVariable",   TypeBool,      Offset( mUseVariable, GuiChunkedBitmapCtrl ), "This decides whether to use the \"bitmap\" file "
                                                                                             "or a bitmap stored in \"variable\"");
                                                                                             "or a bitmap stored in \"variable\"");
@@ -88,8 +88,6 @@ DefineEngineMethod( GuiChunkedBitmapCtrl, setBitmap, void, (const char* filename
 
 
 GuiChunkedBitmapCtrl::GuiChunkedBitmapCtrl()
 GuiChunkedBitmapCtrl::GuiChunkedBitmapCtrl()
 {
 {
-   INIT_ASSET(Bitmap);
-
    mUseVariable = false;
    mUseVariable = false;
    mTile = false;
    mTile = false;
 }
 }
@@ -112,16 +110,6 @@ bool GuiChunkedBitmapCtrl::onWake()
    if(!Parent::onWake())
    if(!Parent::onWake())
       return false;
       return false;
 
 
-   if( !mBitmap
-       && ( ( mBitmapName && mBitmapName[ 0 ] )
-            || ( mUseVariable && mConsoleVariable && mConsoleVariable[ 0 ] ) ) )
-   {
-      if ( mUseVariable )
-         mBitmap.set( Con::getVariable( mConsoleVariable ), &GFXDefaultGUIProfile, avar("%s() - mTexHandle (line %d)", __FUNCTION__, __LINE__) );
-      else
-         mBitmap.set( mBitmapName, &GFXDefaultGUIProfile, avar("%s() - mTexHandle (line %d)", __FUNCTION__, __LINE__) );
-   }
-
    return true;
    return true;
 }
 }
 
 
@@ -167,10 +155,10 @@ void GuiChunkedBitmapCtrl::renderRegion(const Point2I &offset, const Point2I &ex
 void GuiChunkedBitmapCtrl::onRender(Point2I offset, const RectI &updateRect)
 void GuiChunkedBitmapCtrl::onRender(Point2I offset, const RectI &updateRect)
 {
 {
 
 
-   if( mBitmap )
+   if( mBitmapAsset.notNull() )
    {
    {
       RectI boundsRect( offset, getExtent());
       RectI boundsRect( offset, getExtent());
-      GFX->getDrawUtil()->drawBitmapStretch(mBitmap, boundsRect, GFXBitmapFlip_None, GFXTextureFilterLinear );
+      GFX->getDrawUtil()->drawBitmapStretch(getBitmap(), boundsRect, GFXBitmapFlip_None, GFXTextureFilterLinear);
    }
    }
 
 
    renderChildControls(offset, updateRect);
    renderChildControls(offset, updateRect);

+ 1 - 4
Engine/source/gui/game/guiChunkedBitmapCtrl.h

@@ -17,8 +17,7 @@ private:
 
 
 protected:
 protected:
 
 
-   DECLARE_IMAGEASSET(GuiChunkedBitmapCtrl, Bitmap, onImageChanged, GFXDefaultGUIProfile);
-   DECLARE_ASSET_SETGET(GuiChunkedBitmapCtrl, Bitmap);
+   DECLARE_IMAGEASSET_REFACTOR(GuiChunkedBitmapCtrl, Bitmap, GFXDefaultGUIProfile)
 
 
    bool  mUseVariable;
    bool  mUseVariable;
    bool  mTile;
    bool  mTile;
@@ -38,6 +37,4 @@ public:
    void setBitmap(const char *name);
    void setBitmap(const char *name);
 
 
    void onRender(Point2I offset, const RectI &updateRect) override;
    void onRender(Point2I offset, const RectI &updateRect) override;
-
-   void onImageChanged() {}
 };
 };

+ 1 - 2
Engine/source/gui/game/guiProgressBitmapCtrl.cpp

@@ -124,7 +124,6 @@ GuiProgressBitmapCtrl::GuiProgressBitmapCtrl()
      mNumberOfBitmaps(0),
      mNumberOfBitmaps(0),
      mDim(0)
      mDim(0)
 {
 {
-   INIT_ASSET(Bitmap);
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
@@ -132,7 +131,7 @@ GuiProgressBitmapCtrl::GuiProgressBitmapCtrl()
 void GuiProgressBitmapCtrl::initPersistFields()
 void GuiProgressBitmapCtrl::initPersistFields()
 {
 {
    docsURL;
    docsURL;
-   INITPERSISTFIELD_IMAGEASSET(Bitmap, GuiProgressBitmapCtrl, "Bitmap file to use for rendering the progress bar.\n\n"
+   INITPERSISTFIELD_IMAGEASSET_REFACTOR(Bitmap, GuiProgressBitmapCtrl, "Bitmap file to use for rendering the progress bar.\n\n"
       "If the profile assigned to the control already has a bitmap assigned, this property need not be "
       "If the profile assigned to the control already has a bitmap assigned, this property need not be "
       "set in which case the bitmap from the profile is used.");
       "set in which case the bitmap from the profile is used.");
    
    

+ 1 - 10
Engine/source/gui/game/guiProgressBitmapCtrl.h

@@ -47,21 +47,12 @@ class GuiProgressBitmapCtrl : public GuiTextCtrl
 
 
       F32 mProgress;
       F32 mProgress;
 
 
-      DECLARE_IMAGEASSET(GuiProgressBitmapCtrl, Bitmap, onImageChanged, GFXDefaultGUIProfile);
-      DECLARE_ASSET_SETGET(GuiProgressBitmapCtrl, Bitmap);
+      DECLARE_IMAGEASSET_REFACTOR(GuiProgressBitmapCtrl, Bitmap, GFXDefaultGUIProfile)
 
 
       bool mUseVariable;
       bool mUseVariable;
       bool mTile;
       bool mTile;
       S32 mNumberOfBitmaps;
       S32 mNumberOfBitmaps;
       S32 mDim;
       S32 mDim;
-      
-      static bool _setBitmap( void* object, const char* index, const char* data )
-      {
-         static_cast< GuiProgressBitmapCtrl* >( object )->setBitmap( data );
-         return false;
-      }
-
-      void onImageChanged() {}
 
 
    public:
    public:
          
          

+ 4 - 6
Engine/source/gui/worldEditor/guiMissionArea.cpp

@@ -59,8 +59,6 @@ ConsoleDocClass( GuiMissionAreaCtrl,
 
 
 GuiMissionAreaCtrl::GuiMissionAreaCtrl()
 GuiMissionAreaCtrl::GuiMissionAreaCtrl()
 {
 {
-   INIT_ASSET(HandleBitmap);
-
    mHandleTextureSize = Point2I::Zero;
    mHandleTextureSize = Point2I::Zero;
    mHandleTextureHalfSize = Point2F::Zero;
    mHandleTextureHalfSize = Point2F::Zero;
 
 
@@ -90,7 +88,7 @@ void GuiMissionAreaCtrl::initPersistFields()
    docsURL;
    docsURL;
    addField( "squareBitmap",        TypeBool,      Offset(mSquareBitmap, GuiMissionAreaCtrl));
    addField( "squareBitmap",        TypeBool,      Offset(mSquareBitmap, GuiMissionAreaCtrl));
 
 
-   INITPERSISTFIELD_IMAGEASSET(HandleBitmap, GuiMissionAreaCtrl, "Bitmap for the mission area handles.\n");
+   INITPERSISTFIELD_IMAGEASSET_REFACTOR(HandleBitmap, GuiMissionAreaCtrl, "Bitmap for the mission area handles.\n");
 
 
    addField( "missionBoundsColor",  TypeColorI,    Offset(mMissionBoundsColor, GuiMissionAreaCtrl));
    addField( "missionBoundsColor",  TypeColorI,    Offset(mMissionBoundsColor, GuiMissionAreaCtrl));
    addField( "cameraColor",         TypeColorI,    Offset(mCameraColor, GuiMissionAreaCtrl));
    addField( "cameraColor",         TypeColorI,    Offset(mCameraColor, GuiMissionAreaCtrl));
@@ -114,9 +112,9 @@ bool GuiMissionAreaCtrl::onAdd()
    desc.setBlend(true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha);
    desc.setBlend(true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha);
    mBlendStateBlock = GFX->createStateBlock( desc );
    mBlendStateBlock = GFX->createStateBlock( desc );
 
 
-   if (!mHandleBitmap.isNull())
+   if (!mHandleBitmapAsset.isNull())
    {
    {
-      mHandleTextureSize = Point2I(mHandleBitmap->getWidth(), mHandleBitmap->getHeight() );
+      mHandleTextureSize = Point2I(getHandleBitmap()->getWidth(), getHandleBitmap()->getHeight());
       mHandleTextureHalfSize = Point2F(mHandleTextureSize.x, mHandleTextureSize.y) * 0.5f;
       mHandleTextureHalfSize = Point2F(mHandleTextureSize.x, mHandleTextureSize.y) * 0.5f;
    }
    }
    else
    else
@@ -418,7 +416,7 @@ void GuiMissionAreaCtrl::setArea(const RectI & area)
 void GuiMissionAreaCtrl::drawHandle(const Point2F & pos)
 void GuiMissionAreaCtrl::drawHandle(const Point2F & pos)
 {
 {
    Point2F pnt(pos.x-mHandleTextureHalfSize.x, pos.y-mHandleTextureHalfSize.y);
    Point2F pnt(pos.x-mHandleTextureHalfSize.x, pos.y-mHandleTextureHalfSize.y);
-   GFX->getDrawUtil()->drawBitmap(mHandleBitmap, pnt);
+   GFX->getDrawUtil()->drawBitmap(getHandleBitmap(), pnt);
 }
 }
 
 
 void GuiMissionAreaCtrl::drawHandles(RectI & box)
 void GuiMissionAreaCtrl::drawHandles(RectI & box)

+ 1 - 4
Engine/source/gui/worldEditor/guiMissionArea.h

@@ -63,8 +63,7 @@ protected:
    GFXStateBlockRef  mBlendStateBlock;
    GFXStateBlockRef  mBlendStateBlock;
    GFXStateBlockRef  mSolidStateBlock;
    GFXStateBlockRef  mSolidStateBlock;
 
 
-   DECLARE_IMAGEASSET(GuiMissionAreaCtrl, HandleBitmap, onHandleBitmapChanged, GFXDefaultGUIProfile);
-   DECLARE_ASSET_SETGET(GuiMissionAreaCtrl, HandleBitmap);
+   DECLARE_IMAGEASSET_REFACTOR(GuiMissionAreaCtrl, HandleBitmap, GFXDefaultGUIProfile)
 
 
    Point2I           mHandleTextureSize;
    Point2I           mHandleTextureSize;
    Point2F           mHandleTextureHalfSize;
    Point2F           mHandleTextureHalfSize;
@@ -110,8 +109,6 @@ protected:
    bool testWithinHandle(const Point2I & testPoint, S32 handleX, S32 handleY);
    bool testWithinHandle(const Point2I & testPoint, S32 handleX, S32 handleY);
    S32 getHitHandles(const Point2I & mousePnt, const RectI & box);
    S32 getHitHandles(const Point2I & mousePnt, const RectI & box);
 
 
-   void onHandleBitmapChanged() {}
-
 public:
 public:
    GuiMissionAreaCtrl();
    GuiMissionAreaCtrl();
    virtual ~GuiMissionAreaCtrl();
    virtual ~GuiMissionAreaCtrl();

+ 9 - 9
Engine/source/gui/worldEditor/worldEditor.cpp

@@ -1817,9 +1817,9 @@ WorldEditor::WorldEditor()
    mPopupBackgroundColor.set(100,100,100);
    mPopupBackgroundColor.set(100,100,100);
    mPopupTextColor.set(255,255,0);
    mPopupTextColor.set(255,255,0);
 
 
-   mSelectHandleAssetId = StringTable->insert("ToolsModule:SelectHandle");
-   mDefaultHandleAssetId = StringTable->insert("ToolsModule:DefaultHandle");
-   mLockedHandleAssetId = StringTable->insert("ToolsModule:LockedHandle");
+   mSelectHandleAsset = StringTable->insert("ToolsModule:SelectHandle_image");
+   mDefaultHandleAsset = StringTable->insert("ToolsModule:DefaultHandle_image");
+   mLockedHandleAsset = StringTable->insert("ToolsModule:LockedHandle_image");
 
 
    mObjectTextColor.set(255,255,255);
    mObjectTextColor.set(255,255,255);
    mObjectsUseBoxCenter = true;
    mObjectsUseBoxCenter = true;
@@ -1905,9 +1905,9 @@ bool WorldEditor::onAdd()
    // create the default class entry
    // create the default class entry
    mDefaultClassEntry.mName = 0;
    mDefaultClassEntry.mName = 0;
    mDefaultClassEntry.mIgnoreCollision = false;
    mDefaultClassEntry.mIgnoreCollision = false;
-   mDefaultClassEntry.mDefaultHandle = mDefaultHandle;
-   mDefaultClassEntry.mSelectHandle = mSelectHandle;
-   mDefaultClassEntry.mLockedHandle = mLockedHandle;
+   mDefaultClassEntry.mDefaultHandle = getDefaultHandle();
+   mDefaultClassEntry.mSelectHandle = getSelectHandle();
+   mDefaultClassEntry.mLockedHandle = getLockedHandle();
 
 
    if(!(mDefaultClassEntry.mDefaultHandle && mDefaultClassEntry.mSelectHandle && mDefaultClassEntry.mLockedHandle))
    if(!(mDefaultClassEntry.mDefaultHandle && mDefaultClassEntry.mSelectHandle && mDefaultClassEntry.mLockedHandle))
       return false;
       return false;
@@ -2839,9 +2839,9 @@ void WorldEditor::initPersistFields()
       addField( "renderObjHandle",        TypeBool,   Offset(mRenderObjHandle, WorldEditor) );
       addField( "renderObjHandle",        TypeBool,   Offset(mRenderObjHandle, WorldEditor) );
       addField( "renderSelectionBox",     TypeBool,   Offset(mRenderSelectionBox, WorldEditor) );
       addField( "renderSelectionBox",     TypeBool,   Offset(mRenderSelectionBox, WorldEditor) );
 
 
-      INITPERSISTFIELD_IMAGEASSET(SelectHandle, WorldEditor, "");
-      INITPERSISTFIELD_IMAGEASSET(DefaultHandle, WorldEditor, "");
-      INITPERSISTFIELD_IMAGEASSET(LockedHandle, WorldEditor, "");
+      INITPERSISTFIELD_IMAGEASSET_REFACTOR(SelectHandle, WorldEditor, "");
+      INITPERSISTFIELD_IMAGEASSET_REFACTOR(DefaultHandle, WorldEditor, "");
+      INITPERSISTFIELD_IMAGEASSET_REFACTOR(LockedHandle, WorldEditor, "");
    
    
    endGroup( "Rendering" );
    endGroup( "Rendering" );
    
    

+ 3 - 10
Engine/source/gui/worldEditor/worldEditor.h

@@ -328,12 +328,9 @@ class WorldEditor : public EditTSCtrl
       ColorI            mPopupBackgroundColor;
       ColorI            mPopupBackgroundColor;
       ColorI            mPopupTextColor;
       ColorI            mPopupTextColor;
 
 
-      DECLARE_IMAGEASSET(WorldEditor, SelectHandle, onSelectHandleChanged, GFXStaticTextureSRGBProfile);
-      DECLARE_ASSET_SETGET(WorldEditor, SelectHandle);
-      DECLARE_IMAGEASSET(WorldEditor, DefaultHandle, onDefaultHandleChanged, GFXStaticTextureSRGBProfile);
-      DECLARE_ASSET_SETGET(WorldEditor, DefaultHandle);
-      DECLARE_IMAGEASSET(WorldEditor, LockedHandle, onLockedHandleChanged, GFXStaticTextureSRGBProfile);
-      DECLARE_ASSET_SETGET(WorldEditor, LockedHandle);
+      DECLARE_IMAGEASSET_REFACTOR(WorldEditor, SelectHandle, GFXStaticTextureSRGBProfile)
+      DECLARE_IMAGEASSET_REFACTOR(WorldEditor, DefaultHandle, GFXStaticTextureSRGBProfile)
+      DECLARE_IMAGEASSET_REFACTOR(WorldEditor, LockedHandle, GFXStaticTextureSRGBProfile)
 
 
       ColorI            mObjectTextColor;
       ColorI            mObjectTextColor;
       bool              mObjectsUseBoxCenter;
       bool              mObjectsUseBoxCenter;
@@ -425,10 +422,6 @@ class WorldEditor : public EditTSCtrl
 
 
       void setEditorTool(EditorTool*);
       void setEditorTool(EditorTool*);
       EditorTool* getActiveEditorTool() { return mActiveEditorTool; }
       EditorTool* getActiveEditorTool() { return mActiveEditorTool; }
-
-      void onSelectHandleChanged() {}
-      void onDefaultHandleChanged() {}
-      void onLockedHandleChanged() {}
 };
 };
 
 
 typedef WorldEditor::DropType WorldEditorDropType;
 typedef WorldEditor::DropType WorldEditorDropType;

+ 1 - 1
Templates/BaseGame/game/data/gameUI/GUIs/playGui.gui

@@ -28,7 +28,7 @@ $guiContent = new GameTSCtrl(PlayGui) {
          noCursor = "1";
          noCursor = "1";
 
 
    new GuiBitmapCtrl(LagIcon) {
    new GuiBitmapCtrl(LagIcon) {
-      bitmap = "data/ui/art/lagIcon.png";
+      bitmapAsset = "UI:lagIcon_image";
       color = "255 255 255 255";
       color = "255 255 255 255";
       wrap = "0";
       wrap = "0";
       position = "572 3";
       position = "572 3";

+ 3 - 3
Templates/BaseGame/game/tools/assetBrowser/guis/assetPreviewButtonsTemplate.gui

@@ -68,7 +68,7 @@ $guiContent = new GuiControl(AssetPreviewButtonsTemplate) {
          canSaveDynamicFields = "0";
          canSaveDynamicFields = "0";
 
 
          new GuiBitmapButtonCtrl() {
          new GuiBitmapButtonCtrl() {
-            bitmap = "tools/materialEditor/gui/cubemapBtnBorder";
+            bitmapAsset = "ToolsModule:cubemapBtnBorder_n_image";
             bitmapMode = "Stretched";
             bitmapMode = "Stretched";
             autoFitExtents = "0";
             autoFitExtents = "0";
             useModifiers = "0";
             useModifiers = "0";
@@ -163,7 +163,7 @@ $guiContent = new GuiControl(AssetPreviewButtonsTemplate) {
       canSaveDynamicFields = "0";
       canSaveDynamicFields = "0";
 
 
       new GuiBitmapButtonCtrl() {
       new GuiBitmapButtonCtrl() {
-         bitmap = "Data/Blockout_Basics/Walls/WallGrid2x2_Albedo.png";
+         bitmapAsset = "Data/Blockout_Basics/Walls/WallGrid2x2_Albedo.png";
          bitmapMode = "Stretched";
          bitmapMode = "Stretched";
          autoFitExtents = "0";
          autoFitExtents = "0";
          useModifiers = "0";
          useModifiers = "0";
@@ -188,7 +188,7 @@ $guiContent = new GuiControl(AssetPreviewButtonsTemplate) {
          canSaveDynamicFields = "0";
          canSaveDynamicFields = "0";
 
 
          new GuiBitmapButtonCtrl() {
          new GuiBitmapButtonCtrl() {
-            bitmap = "tools/materialEditor/gui/cubemapBtnBorder";
+            bitmapAsset = "ToolsModule:cubemapBtnBorder_n_image";
             bitmapMode = "Stretched";
             bitmapMode = "Stretched";
             autoFitExtents = "0";
             autoFitExtents = "0";
             useModifiers = "0";
             useModifiers = "0";

+ 1 - 1
Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript

@@ -2565,7 +2565,7 @@ function GuiEditor::onControlDropped(%this, %payload, %position)
         {
         {
             %cmd = "return new guiBitmapCtrl();";
             %cmd = "return new guiBitmapCtrl();";
             %ctrl = eval( %cmd ); 
             %ctrl = eval( %cmd ); 
-            %ctrl.bitmap = %assetId;
+            %ctrl.bitmapAsset = %assetId;
         }
         }
       }
       }
    }
    }

+ 2 - 2
Templates/BaseGame/game/tools/gui/materialSelector.ed.gui

@@ -136,7 +136,7 @@ new GuiControl(MaterialSelectorOverlay, EditorGuiGroup) {
          Command = "MaterialSelector.createNewMaterial();";
          Command = "MaterialSelector.createNewMaterial();";
          hovertime = "1000";
          hovertime = "1000";
          tooltip = "Create New Unmapped Material";
          tooltip = "Create New Unmapped Material";
-         bitmap = "tools/gui/images/new";
+         bitmapAsset = "ToolsModule:new_n_image";
          groupNum = "-1";
          groupNum = "-1";
          buttonType = "PushButton";
          buttonType = "PushButton";
          useMouseEvents = "0";
          useMouseEvents = "0";
@@ -1649,7 +1649,7 @@ function MaterialSelector::createNewMaterial( %this )
          position = "7 4";
          position = "7 4";
          extent = "64 64";
          extent = "64 64";
          buttonType = "PushButton";
          buttonType = "PushButton";
-         bitmap = "core/images/warnmat";
+         bitmapAsset = "CoreModule:warnMat_image";
          Command = "";
          Command = "";
          text = "Loading...";
          text = "Loading...";
          useStates = false;
          useStates = false;

+ 1 - 1
Templates/BaseGame/game/tools/guiEditor/gui/EditorChooseGUI.ed.gui

@@ -13,7 +13,7 @@ $guiContent = new GuiChunkedBitmapCtrl(EditorChooseGUI, EditorGuiGroup) {
    Visible = "1";
    Visible = "1";
    tooltipprofile = "ToolsGuiToolTipProfile";
    tooltipprofile = "ToolsGuiToolTipProfile";
    hovertime = "1000";
    hovertime = "1000";
-   bitmap = "data/ui/images/background.png";
+   bitmapAsset = "UI:background_image";
    useVariable = "0";
    useVariable = "0";
    tile = "0";
    tile = "0";
 
 

+ 1 - 3
Templates/BaseGame/game/tools/materialEditor/gui/Profiles.ed.tscript

@@ -24,7 +24,7 @@
 
 
 singleton GuiControlProfile (GuiMatEdSliderProfile)
 singleton GuiControlProfile (GuiMatEdSliderProfile)
 {
 {
-   bitmap = "./matEdSlider";
+   bitmapAsset = "ToolsModule:slider_image";
    category = "Editor";
    category = "Editor";
 };
 };
 
 
@@ -47,9 +47,7 @@ singleton GuiControlProfile(GuiMatEdPopUpMenuProfile)
    mouseOverSelected = true;
    mouseOverSelected = true;
    textOffset = "3 3";
    textOffset = "3 3";
    border = 1;
    border = 1;
-   /*borderThickness = 1;*/
    fixedExtent = true;
    fixedExtent = true;
-   //bitmap = "./images/scrollbar";
    bitmapAsset = "ToolsModule:scroll_image";
    bitmapAsset = "ToolsModule:scroll_image";
    hasBitmapArray = true;
    hasBitmapArray = true;
    profileForChildren = GuiControlListPopupProfile;
    profileForChildren = GuiControlListPopupProfile;

+ 1 - 1
Templates/BaseGame/game/tools/materialEditor/gui/guiMaterialPropertiesWindow.ed.gui

@@ -4821,7 +4821,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
             tooltipprofile = "ToolsGuiToolTipProfile";
             tooltipprofile = "ToolsGuiToolTipProfile";
             buttonType = "PushButton";
             buttonType = "PushButton";
             useMouseEvents = "0";
             useMouseEvents = "0";
-            bitmap = "ToolsModule:new_n_image";
+            bitmapAsset = "ToolsModule:new_n_image";
          };
          };
          // Save Button
          // Save Button
          new GuiBitmapButtonCtrl() {
          new GuiBitmapButtonCtrl() {

+ 1 - 1
Templates/BaseGame/game/tools/materialEditor/gui/guiMaterialPropertiesWindow.ed.gui.orig

@@ -4846,7 +4846,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
             tooltipprofile = "ToolsGuiToolTipProfile";
             tooltipprofile = "ToolsGuiToolTipProfile";
             buttonType = "PushButton";
             buttonType = "PushButton";
             useMouseEvents = "0";
             useMouseEvents = "0";
-            bitmap = "ToolsModule:new_n_image";
+            bitmapAsset = "ToolsModule:new_n_image";
          };
          };
          // Save Button
          // Save Button
          new GuiBitmapButtonCtrl() {
          new GuiBitmapButtonCtrl() {

+ 1 - 1
Templates/BaseGame/game/tools/navEditor/NavEditorToolbar.gui

@@ -40,7 +40,7 @@ $guiContent = new GuiControl(NavEditorToolbar,EditorGuiGroup) {
       canSaveDynamicFields = "0";
       canSaveDynamicFields = "0";
    };
    };
    new GuiBitmapCtrl() {
    new GuiBitmapCtrl() {
-      bitmap = "core/gui/images/separator-h.png";
+      bitmapAsset = "ToolsModule:separator_h_image";
       wrap = "0";
       wrap = "0";
       position = "90 3";
       position = "90 3";
       extent = "2 26";
       extent = "2 26";

+ 1 - 1
Templates/BaseGame/game/tools/worldEditor/gui/EditorChooseLevelGui.ed.gui

@@ -28,7 +28,7 @@ $guiContent = new GuiContainer(EditorChooseLevelGui, EditorGuiGroup) {
       Visible = "1";
       Visible = "1";
       tooltipprofile = "ToolsGuiToolTipProfile";
       tooltipprofile = "ToolsGuiToolTipProfile";
       hovertime = "1000";
       hovertime = "1000";
-      bitmap = "data/ui/images/background.png";
+      bitmapAsset = "UI:background_image";
       useVariable = "0";
       useVariable = "0";
       tile = "0";
       tile = "0";
    };
    };

+ 2 - 2
Templates/BaseGame/game/tools/worldEditor/gui/EditorGui.ed.gui

@@ -115,8 +115,8 @@ $guiContent = new GuiContainer(EditorGui,EditorGuiGroup) {
                selectionBoxColor = "255 255 0 255";
                selectionBoxColor = "255 255 0 255";
                selectionLocked = "0";
                selectionLocked = "0";
                toggleIgnoreList = "0";
                toggleIgnoreList = "0";
-               selectHandle = "ToolsModule:SelectHandle_image";
-               defaultHandle = "ToolsModule:DefaultHandle_image";
+               selectHandleAsset = "ToolsModule:SelectHandle_image";
+               defaultHandleAsset = "ToolsModule:DefaultHandle_image";
                lockedHandleAsset = "ToolsModule:LockedHandle_image";
                lockedHandleAsset = "ToolsModule:LockedHandle_image";
             };
             };
             new TerrainEditor(ETerrainEditor) {
             new TerrainEditor(ETerrainEditor) {