Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Marion on Mon 03/03/2025 19:57:14

Title: Problem importing sprites
Post by: Marion on Mon 03/03/2025 19:57:14
Hello. I have a big problem with my current game. I can't import a new sprite without it crashing and cutting without saving. I know I have a lot of them (I'm up to more than 20,000) but I need them for this project... Here are the error messages I get when importing new sprites:


Error: Région bitmap déjà verrouillée.
Version: AGS 4.00.00.13

System.InvalidOperationException: Région bitmap déjà verrouillée.
   à System.Drawing.Bitmap.LockBits(Rectangle rect, ImageLockMode flags, PixelFormat format, BitmapData bitmapData)
   à System.Drawing.Bitmap.LockBits(Rectangle rect, ImageLockMode flags, PixelFormat format)
   à CreateBlockFromBitmap(Bitmap bmp, RGB* imgpal, Int32* srcPalLen, Boolean fixColourDepth, Int32 destColorDepth, Boolean keepTransparency, Int32* originalColDepth)
   à CreateNativeBitmap(Bitmap bmp, Int32 destColorDepth, Int32 spriteImportMethod, Boolean remapColours, Boolean useRoomBackgroundColours, Boolean alphaChannel, Int32* out_flags)
   à AGS.Native.NativeMethods.SetSpriteFromBitmap(Int32 spriteSlot, Bitmap bmp, Int32 destColorDepth, Int32 spriteImportMethod, Boolean remapColours, Boolean useRoomBackgroundColours, Boolean alphaChannel)
   à AGS.Editor.NativeProxy.CreateSpriteFromBitmap(Bitmap bmp, SpriteImportColorDepth dstColorDepth, SpriteImportTransparency transparency, Boolean remapColours, Boolean useRoomBackgroundColours, Boolean alphaChannel)
   à AGS.Editor.Utils.SpriteTools.ImportNewSprite(SpriteFolder folder, Bitmap bmp, SpriteImportOptions options)
   à AGS.Editor.Utils.SpriteTools.ImportNewSprites(SpriteFolder folder, Bitmap bmp, SpriteImportOptions options, SpriteSheet spritesheet)
   à AGS.Editor.SpriteImportWindow.DoImport()
   à AGS.Editor.SpriteImportWindow.btnImportAll_Click(Object sender, EventArgs e)
   à System.Windows.Forms.Control.OnClick(EventArgs e)
   à System.Windows.Forms.Button.OnClick(EventArgs e)
   à System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   à System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   à System.Windows.Forms.Control.WndProc(Message& m)
   à System.Windows.Forms.ButtonBase.WndProc(Message& m)
   à System.Windows.Forms.Button.WndProc(Message& m)
   à System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   à System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   à System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

(https://cdn.discordapp.com/attachments/877174995573424208/1346209287445151815/Sans_titre_1.jpg?ex=67c75a99&is=67c60919&hm=ed8e8b17a9f0ec9c851bd36925caf72e5fc97f6f6bab6c5016f5b3186b89d60e&)
Title: Re: Problem importing sprites
Post by: Crimson Wizard on Tue 04/03/2025 09:53:00
AGS supports up to 90k imported sprites. There's a known issue that Editor may run out of memory if you imported a big number of sprites during same session without saving (this is resolved by saving periodically).

The error sounds like some internal problem in the editor. I don't know in which situations it may appear though.
Does this happen to any image file or particular ones?
Does this happen when you just started to work with the editor, or being working with it for a while?

Title: Re: Problem importing sprites
Post by: Marion on Tue 04/03/2025 10:58:41
It happens when I import too many sprites at one time, I think. It seems to be ok when I import less sprites and then save.
Thank you for your answer :)