Author Topic: UnitSprite Studio  (Read 33608 times)

Offline bohemond

  • Sergeant
  • **
  • Posts: 44
    • View Profile
UnitSprite Studio
« on: March 10, 2021, 09:26:21 pm »
The tool eases editing of unit spritesheets.

As Finnik suggested some time ago, it takes the normal spritesheet and presents it in the way it is shown in the game. You can view how it looks and make changes.

I have made the UI look and operate like MCDEdit as it is in many ways similar and I think it fits quite nicely.

I have also added some automation tools that I needed to make some sprites.

This is still very much a work in progress, so expect crashes and bugs all over the place.

BACKUP YOUR FILES!

The basic features:
 - PNG and GIF files so far
 - Paint in palettes from both EU and TFTD
 - Copy & Paste from outside to inside and vice versa
 - Recolorize (Like in MCDEdit)
 - Highlight the part you're working on (Left arm, Legs, etc.)
 - Most of the possible frame combinations can be selected (Depends on the drawing routine)
 - Batch frame cloning including mirroring, flipping and so on
 - Animation shifter
 - Shader tool
 - Pixel operations
 - Item preview & edit

Supported Drawing routines:
0 - Soldier, Sectoid
1 - Floater
2 - XCom HWP
4 - Civilian, Ethereal
5 - Sectopod, Reaper
6 - Snakeman
7 - Chryssalid
8 - Silacoid
9 - Celatid
10 - Muton
Single frame

Frame cloning:
Can be used to create mirrored frames, it exchanges the parts that are mirrored correctly. (Left arm<->Right arm, etc.)
The exact functionality depends on the drawing routine.

Animation shifter:
You can set a fixed point in the animation and it will shift all frames to match it. It's a little hard to explain, snapshot in one of the attachements.
I used it for example to fix a wobbly walking animation, but it can also be used to offset the whole animation or just one frame.

Pixel operations:
Can be used to re-color the whole sprite. i.e. make the snakeman blue.

Item preview:
You can preview the unit holding an item. The item can be loaded from a file or from HandOb maker.

Item edit:
You can edit the item directly in the studio. Use either 0 - Soldier or 1 - Floater unit, load up an item file. If you select the proper frames and layer (Right item), you can edit the item with the normal drawing tools and then save it back to the file.

This time it's in C# and WPF, I hope that will help compatibility with linux systems.

Sources: https://github.com/bohemond-of-antioch/OpenXcom-UnitSpriteStudio
Releases: https://github.com/bohemond-of-antioch/OpenXcom-UnitSpriteStudio/releases

I'm releasing this under Creative Commons Zero.
« Last Edit: October 23, 2022, 02:34:04 pm by bohemond »

Offline efrenespartano

  • Commander
  • *****
  • Posts: 765
  • I know a lot about the law and other lawyerings.
    • View Profile
Re: UnitSprite Studio
« Reply #1 on: March 10, 2021, 10:49:31 pm »
I'll definitely try this out. This will ease A LOT of work on the spritesheets, definitely.

Also, if you have a small video/tutorial would be great to introduce us to your tool.

Offline bohemond

  • Sergeant
  • **
  • Posts: 44
    • View Profile
Re: UnitSprite Studio
« Reply #2 on: March 11, 2021, 01:10:43 pm »
Well there is nothing much to it, really. It basically works like any painting program. The only tricky part is that you have to be aware of which part/layer of the unit you're editing.

So you select which unit-states you want the composed image to be made out of. These are fully dependent on the drawing routine, the most complex are for the soldier.

Then you edit it, keeping in mind which layer you have selected. And it will affect the appropriate pixels in the original spritesheet.

Offline bohemond

  • Sergeant
  • **
  • Posts: 44
    • View Profile
Re: UnitSprite Studio
« Reply #3 on: March 12, 2021, 01:38:30 am »
Continuing with the 'tutorial', during testing I found this interesting use of the frame cloning tool:
I've noticed that the Gazer unit has the wrong arms in one of the walking animations, something that can be easily fixed with frame cloning.

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: UnitSprite Studio
« Reply #4 on: March 28, 2021, 01:09:21 am »
That is overcool, I am so glad you dive into this aspect. Unit making always was the most challenge in OXC modding and that would let us unleash creativity. Looks super promising, but can I already make a feature request? Would be cool to have support also `drawingRoutine: 10`?

Also, why supporting something not .png? AFAIK .gif is not supported right now.

Offline kevL

  • Colonel
  • ****
  • Posts: 482
  • pitchforks and torches
    • View Profile
Re: UnitSprite Studio
« Reply #5 on: March 28, 2021, 01:33:01 am »
Also, why supporting something not .png?

@bohemond .net doesn't handle 8bpp png well ... if you like, here's a loader that I adapted from stackoverflow

https://github.com/kevL/OpenXCOM.Tools/blob/master/XCom/Sprites/BitmapLoader.cs

Offline bohemond

  • Sergeant
  • **
  • Posts: 44
    • View Profile
Re: UnitSprite Studio
« Reply #6 on: April 04, 2021, 10:54:59 am »
New Version, I've managed to fix some of the crashes I've been having, but there is still a long way to go.
I've moved the releases to GitHub so I don't have to edit the initial post every time. Hopefully it works as advertised, I've never used that feature before.

@Finnik I wanted to avoid doing the routine 10, but I guess if you already have some units with that routine, it's not easy to convert them to another. I'll add it.

As for adding .gif support, that shouldn't be too hard either, especially if I just use kevL's code.

I've also added a shader tool, it's more of a gimmick, but I had some fun making it. :)


Offline Leflair

  • Colonel
  • ****
  • Posts: 255
    • View Profile
Re: UnitSprite Studio
« Reply #7 on: April 06, 2021, 03:15:45 pm »
Only played around a little with this tool but man, it helps a lot to see how it all comes together as you work on a sprite, great work!

One question interface wise, and maybe I´m just missing something obvious - but is there a way to move a selection of sprites? Drag the selection around? I can select sprites with several tools in this program, but I don´t see any handy move object type of tool - for example moving an entire arm or leg selection up or down.

I use it a lot in other programs to make bigger adjustments, or to copy-paste parts of other sprites onto a new one as I work and it can be a big time saver to not have to repaint things.

Offline gaffer

  • Captain
  • ***
  • Posts: 60
    • View Profile
Re: UnitSprite Studio
« Reply #8 on: April 07, 2021, 04:57:14 pm »
Really enjoying this tool bohemond, appreciate your work on this.  I personally can't seem to work the animation shift but only briefly fiddled with it.  As Leflair stated it would be super handy to move pixels (ie cut, paste. Drag).  Cut seems to work (Cntrl+X) but not paste (nor Cntrl/alt+click to drag) Not sure if it's set up for that or if I am just doing something wrong.  It is very nice to select an area of pixels and quickly shift the brightness/darkness within the color or shift to entirely new color set. 

Overall loving this tool and looking forward to any future updates. 

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3375
    • View Profile
Re: UnitSprite Studio
« Reply #9 on: April 07, 2021, 06:00:12 pm »
I have small request on behalf of OXCE scripts, as they could swap animation frames.
e.g. using them you can have more that 2 torso types, or different death frames (that match given torso).

Thing that this script could need is simply duplicated body parts that are layout in predicted way in file.
Exact positions are not very important as script could be adjusted to match it (only rotation need be consisting because other wise script trying use it would be mess).

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: UnitSprite Studio
« Reply #10 on: April 07, 2021, 07:46:00 pm »
New Version, I've managed to fix some of the crashes I've been having, but there is still a long way to go.
I've moved the releases to GitHub so I don't have to edit the initial post every time. Hopefully it works as advertised, I've never used that feature before.

@Finnik I wanted to avoid doing the routine 10, but I guess if you already have some units with that routine, it's not easy to convert them to another. I'll add it.

As for adding .gif support, that shouldn't be too hard either, especially if I just use kevL's code.

I've also added a shader tool, it's more of a gimmick, but I had some fun making it. :)

Nice additions, thank you very much!

Offline efrenespartano

  • Commander
  • *****
  • Posts: 765
  • I know a lot about the law and other lawyerings.
    • View Profile
Re: UnitSprite Studio
« Reply #11 on: April 08, 2021, 01:38:45 am »
I'm having a good time with your tool, comrade Behemond!

I've been able to finish a spritesheet in more or less 5 hours, almost the half of the time it usually takes me. I have a small request: could you add an option to recolor whole parts of the body at once? Like both the legs or the arms? That would further ease the work (i ask this because some of my units are basically recolor of other units haha)

I'm attaching a small screenshot of your wonderful tool in action!




Offline gaffer

  • Captain
  • ***
  • Posts: 60
    • View Profile
Re: UnitSprite Studio
« Reply #12 on: April 08, 2021, 05:22:01 am »
Not a coder by any means,  but i could see that being accomplished with a shift+click function  to select multiple 'layers' (L arm, R arm, Legs). Nice idea
« Last Edit: April 08, 2021, 04:45:26 pm by gaffer »

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: UnitSprite Studio
« Reply #13 on: April 08, 2021, 03:27:17 pm »
I'm having a good time with your tool, comrade Behemond!

I've been able to finish a spritesheet in more or less 5 hours, almost the half of the time it usually takes me. I have a small request: could you add an option to recolor whole parts of the body at once? Like both the legs or the arms? That would further ease the work (i ask this because some of my units are basically recolor of other units haha)

I'm attaching a small screenshot of your wonderful tool in action!



I would say simple recoloring is better to perform in the old way, as you can recolor not just one frame, but the whole spritesheet. So you can prepare recoloring and then use unit studio to make final additions

Offline efrenespartano

  • Commander
  • *****
  • Posts: 765
  • I know a lot about the law and other lawyerings.
    • View Profile
Re: UnitSprite Studio
« Reply #14 on: April 10, 2021, 05:15:50 am »
That's basically what I've doing since I started using it. I'm not saying it's impossible to continue to do it like that, but I'd like to spend more time working on this tool when doing sprites. xD