mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-27 06:02:11 +00:00
Fixed internal sprites that were not appearing in the sprite preview box on the Edit Thing dialog.
Fixed internal sprites that were not appearing in any sprite preview box after using Visual Mode.
This commit is contained in:
parent
e8dadd0f42
commit
442905929a
3 changed files with 22 additions and 6 deletions
|
@ -566,7 +566,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
}
|
||||
|
||||
// Unload this image?
|
||||
if(!image.IsReferenced && (image.ImageState != ImageLoadState.None))
|
||||
if(!image.IsReferenced && image.AllowUnload && (image.ImageState != ImageLoadState.None))
|
||||
{
|
||||
// Still unreferenced?
|
||||
image.UnloadImage();
|
||||
|
@ -639,7 +639,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
}
|
||||
|
||||
// Unload this image?
|
||||
if((img.ImageState == ImageLoadState.Ready) && !img.IsReferenced)
|
||||
if((img.ImageState == ImageLoadState.Ready) && !img.IsReferenced && img.AllowUnload)
|
||||
{
|
||||
// Add for unloading
|
||||
img.ImageState = ImageLoadState.Unloading;
|
||||
|
@ -1087,6 +1087,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
{
|
||||
ImageData img = new FileImage(Path.GetFileNameWithoutExtension(spritefile).ToLowerInvariant(), spritefile, false);
|
||||
img.LoadImage();
|
||||
img.AllowUnload = false;
|
||||
internalsprites.Add(img.Name, img);
|
||||
}
|
||||
|
||||
|
@ -1095,6 +1096,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
{
|
||||
ImageData img = new ResourceImage("CodeImp.DoomBuilder.Resources.Nothing.png");
|
||||
img.LoadImage();
|
||||
img.AllowUnload = false;
|
||||
internalsprites.Add("nothing", img);
|
||||
}
|
||||
|
||||
|
@ -1102,6 +1104,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
{
|
||||
ImageData img = new ResourceImage("CodeImp.DoomBuilder.Resources.UnknownThing.png");
|
||||
img.LoadImage();
|
||||
img.AllowUnload = false;
|
||||
internalsprites.Add("unknownthing", img);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
private volatile ImageLoadState imagestate;
|
||||
private volatile int previewindex;
|
||||
protected volatile bool loadfailed;
|
||||
private volatile bool allowunload;
|
||||
|
||||
// References
|
||||
private volatile bool usedinmap;
|
||||
|
@ -86,6 +87,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
public bool IsImageLoaded { get { return (imagestate == ImageLoadState.Ready); } }
|
||||
public bool LoadFailed { get { return loadfailed; } }
|
||||
public bool IsDisposed { get { return isdisposed; } }
|
||||
public bool AllowUnload { get { return allowunload; } set { allowunload = value; } }
|
||||
public ImageLoadState ImageState { get { return imagestate; } internal set { imagestate = value; } }
|
||||
public ImageLoadState PreviewState { get { return previewstate; } internal set { previewstate = value; } }
|
||||
public bool IsReferenced { get { return (references > 0) || usedinmap; } }
|
||||
|
@ -108,6 +110,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
{
|
||||
// Defaults
|
||||
usecolorcorrection = true;
|
||||
allowunload = true;
|
||||
}
|
||||
|
||||
// Destructor
|
||||
|
|
|
@ -185,12 +185,22 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// Selected type changes
|
||||
private void thingtype_OnTypeChanged(ThingTypeInfo value)
|
||||
{
|
||||
// Update preview image
|
||||
thinginfo = value;
|
||||
if(value != null)
|
||||
General.DisplayZoomedImage(spritetex, General.Map.Data.GetSpriteImage(value.Sprite).GetPreview());
|
||||
|
||||
// Update preview image
|
||||
if(thinginfo.Sprite.ToLowerInvariant().StartsWith(DataManager.INTERNAL_PREFIX) &&
|
||||
(thinginfo.Sprite.Length > DataManager.INTERNAL_PREFIX.Length))
|
||||
{
|
||||
General.DisplayZoomedImage(spritetex, General.Map.Data.GetSpriteImage(thinginfo.Sprite).GetBitmap());
|
||||
}
|
||||
else if((thinginfo.Sprite.Length <= 8) && (thinginfo.Sprite.Length > 0))
|
||||
{
|
||||
General.DisplayZoomedImage(spritetex, General.Map.Data.GetSpriteImage(thinginfo.Sprite).GetPreview());
|
||||
}
|
||||
else
|
||||
General.DisplayZoomedImage(spritetex, null);
|
||||
{
|
||||
spritetex.BackgroundImage = null;
|
||||
}
|
||||
|
||||
// Update arguments
|
||||
action_ValueChanges(this, EventArgs.Empty);
|
||||
|
|
Loading…
Reference in a new issue