#ifndef shaveIcon_h #define shaveIcon_h // Shave and a Haircut // (c) 2019 Epic Games // US Patent 6720962 #include #include #include class shaveIcon { public: static void cleanup(); // // Whenever Maya loads a new icon, it caches the image and never looks // at the file again. This can be annoying when you are using icons as // swatches which can be updated during the course of a session. // // Maya does provide a 'reloadImage' MEL command to reload an icon from // its file, into a specific UI control. However, there is no way to // determine whether the icon *needs* to be reloaded. So you're stuck // with always doing the reload, which results in doubled load time the // first time the icon is used, and an extra load even when it hasn't // changed. // // This method gets around that by allowing you to register an icon // whenever you use it. It compares timestamps and returns true if the // icon needs to be reloaded. // static bool needsReload(MString iconFile); protected: static MStringArray mIcons; static MIntArray mTimestamps; }; #endif