OpenXcom Forum

Modding => Tools => Topic started by: bohemond on March 10, 2021, 09:26:21 pm

Title: UnitSprite Studio
Post by: bohemond 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.
Title: Re: UnitSprite Studio
Post by: efrenespartano 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.
Title: Re: UnitSprite Studio
Post by: bohemond 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.
Title: Re: UnitSprite Studio
Post by: bohemond 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.
Title: Re: UnitSprite Studio
Post by: Finnik 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.
Title: Re: UnitSprite Studio
Post by: kevL 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
Title: Re: UnitSprite Studio
Post by: bohemond 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. :)

Title: Re: UnitSprite Studio
Post by: Leflair 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.
Title: Re: UnitSprite Studio
Post by: gaffer 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. 
Title: Re: UnitSprite Studio
Post by: Yankes 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).
Title: Re: UnitSprite Studio
Post by: Finnik 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!
Title: Re: UnitSprite Studio
Post by: efrenespartano 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!

(https://cdn.discordapp.com/attachments/734607097743933521/826629922406531082/unknown.png)

Title: Re: UnitSprite Studio
Post by: gaffer 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
Title: Re: UnitSprite Studio
Post by: Finnik 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!

(https://cdn.discordapp.com/attachments/734607097743933521/826629922406531082/unknown.png)

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
Title: Re: UnitSprite Studio
Post by: efrenespartano 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
Title: Re: UnitSprite Studio
Post by: Leflair on April 12, 2021, 01:36:43 pm
I´ve figured out how to use the shift animation tool now, not entirely intuitive so here is a little tutorial:
By default ALL frames are selected, haven´t found a better way but if you just click "go" and then ctrl+Z to undo, you can now select to move only inside one frame.
By default the body part you´ve selected is what you´ll move. Haven´t found a way to move all parts of a body yet.
You set the direction you want to shift with LEFT CLICK, opposite of the GUIDE LINE
The guide line is by default up in the left corner, this prevents adjustments in half the directions so use RIGHT click to move the guideline anywhere (a red cross hair shows up to show its location).
[Suggestion: To make this tool more intuitive, having the guideline show up centred in each frame by default would help, with a check-box to hide it]

The LEFT CLICK and pixel movement is then RELATIVE to the red cross hair guideline.
Example: Right click on the SHIFT ANIMATION frame you´ve picked. This sets the red GUIDE LINE.
Now LEFT CLICK one pixel ABOVE the red cross hairs and click GO. The body part will move DOWN 1 pixel. If its the first time, ALL of the selected frames will move if you click GO! (i.e the same as if you clicked GO FOR ALL FRAMES, the second go button).  CTRL+Z to undo and now do it again to just move 1 frame at a time.
Left click diagonally UP to the RIGHT, and the body part will move diagonally DOWN-LEFT.
Basically it works like a joystick in an aircraft (inverted input). [Suggestion: An option to have it not inverted could also help.]

There´s probably more commands here that I´ve not figured out yet, but this tool is fantastic for adjusting misaligned arms and such in movement cycles or finding over-flowing pixels that stick out and show up in other frames.
Title: Re: UnitSprite Studio
Post by: Buscher on April 24, 2021, 09:15:48 pm
Would it be possible to do a debugging session? I am trying to get your studio to run in Linux. The handobmaker starts with wine-6.6 (Staging) + dotnet45 but I haven't got this to run yet.

The most important part in the log seems to be
Code: [Select]
wine: Call from 7BC2BF20 to unimplemented function MSVCR100_CLR0400.dll._initterm_e, aborting
which is printed till the stack overflows.

If you want I can open an issue on your github or perhaps we can talk in discord?
Title: Re: UnitSprite Studio
Post by: bohemond on April 25, 2021, 02:33:01 am
New version released (on github):
Drawing routine 10 - Muton
Support for GIF
Minor bugfixes

@Leflair,@gaffer:
The selections are a little clunky, but I'm pretty sure cut/copy/paste works, as well as moving the selected pixels around.
To move the selected pixels, you must hold ctrl and drag with the left mouse button.
The shortcut to deselect and drop the pixels back in is CTRL-D.

If you're having problems, it's most likely because the pixels you want to move are on a different layer.

@Yankes:
I'm not familliar with this feature, can you provide a sample spritesheet and a proposal of how to support it in the application?

@Leflair, ad Shift animation
That tool is very unintuitive, as you wrote. Even I have problems getting it right on the first try.
I've been trying to write an explanation of how it works, but I can't do it.
Simply put; It translates the pixels from coordinates marked with the white crosshair to the coordinates marked with the red crosshair.
You can shift a single frame with just right-click and then left-click in the frame you want to move, I don't think any tricks with undo are needed.

@efrenespartano:
I'm not sure I understand what you need. I've never done any unit sprite recoloring myself.
I came up with something like this:
You would select which layers and frames you want to change, then create a list of operations to do on the pixels. For example 'Change color' or 'Change brightness' and then apply the operations.
I've added a draft of how the UI could look.
Title: Re: UnitSprite Studio
Post by: scarf on April 25, 2021, 04:14:18 am
a great tool, reduced my worktime tenfolds :D
it's a but hard to use digitizer tablet with it tho. drawing lines are not easy, it gets dtuck midwhere and I have resorted to stabbing pens like as if i was drawing a pointillism painting. but anyway it's a novel work and I love it. please keep going on great work.
Title: Re: UnitSprite Studio
Post by: Yankes on April 25, 2021, 11:57:06 am
@Yankes:
I'm not familliar with this feature, can you provide a sample spritesheet and a proposal of how to support it in the application?
OXCE feature is simply you write script that get offset to "body part" in spiritsheet and restoration offset of given part.
Result of script that add more rotation to every part:
https://www.youtube.com/watch?v=q0-RwIvLUxw
Here constant animation of 2x2 unit (please ignore different script that recolor unit after hit)
https://www.youtube.com/watch?v=71n4gmk0Zbc

In both this examples there was used standard spiritsheet but script is not limited to it.

Some example of working script hooks that alter animations:
https://openxcom.org/forum/index.php/topic,5245.msg78242.html#msg78242
https://openxcom.org/forum/index.php/topic,6303.msg96798.html#msg96798

Title: Re: UnitSprite Studio
Post by: efrenespartano on April 26, 2021, 04:32:07 am

@efrenespartano:
I'm not sure I understand what you need. I've never done any unit sprite recoloring myself.
I came up with something like this:
You would select which layers and frames you want to change, then create a list of operations to do on the pixels. For example 'Change color' or 'Change brightness' and then apply the operations.
I've added a draft of how the UI could look.

Basically this is what I had in mind! Thanks a bunch, looking forward to see it implemented
Title: Re: UnitSprite Studio
Post by: Leflair on April 26, 2021, 03:15:09 pm
Thanks for the explanations!

Request: Probably already planning to add this, but I got a Snakeman based movement type unit.

I´ve bumped into one strange possible error that I need to investigate a little more, but I´ve noticed a ingame-animation gap on a movement type 0 unit (Between leg and torso in 1-2 frames), where in the UnitSprite Studio movement loop it shows no error. First thought was that the game was reading some other older version of the spritesheet, but it looks to be the correct sheet its reading. So the second idea is that the Unitsprite Studios animation position for the legs doesn´t match the ingame one.

Possibly in the left side-ways animation walking direction loop, 1 pixel too low. I´ll do some more testing.

e: Note, this would be on the older non-muton and possible bug fixes version.
Title: Re: UnitSprite Studio
Post by: bohemond on April 29, 2021, 09:36:31 pm
@greenscarf: I finally realized what you meant; It's not about the tablet, it's about sloppily programmed paint tool. It does not interpolate the line and just draws a pixel where the cursor currently is.
I'll add an interpolating pen in the next release, which I think is what you need.

@Leflair: I checked some unit sprites I have, but I can't see the error in any animation.
Title: Re: UnitSprite Studio
Post by: bohemond on May 01, 2021, 12:16:34 am
New version released (on github):
Drawing routine 6 - Snakeman
Pixel operations tool (Can be used to recolor)
Paint tool interpolates
Help shortcuts contains more shortcuts
Single frame 'Drawing routine'

Pixel operations tool:
You can use the tool to recolor the sprite.
I've tried to make it as simple as possible, but I fear that I have failed as usual.
The basic use is such: You setup the steps that will be applied to the sprite and you select which frames should be affected. Then you click RUN.
The operations run from top to bottom in sequence. You can use this to your advantage, recoloring in the correct order.

Notes:
You can use Alt-Click (with paint tool) in the main window to get the group color into the operation dialogue.
Be aware that the 'Death' frames are usually handled completely differently from the rest of the sprite. So when you are recoloring, the layers don't apply to it. You can get a nasty surprise if you're not careful, that's why I made the Death frame checkbox yellow, so that it's easier to remember that there might be some problem.
It always recolors all directions and the whole animation. I did not really see a use-case for there to be more options, but if there is a need to recolor just some direction, it can be implemented.
Double clicking the Step list will let you edit the operation.

If anyone can think of other operations on pixels they'd like to use, don't hesitate to request them.

Single frame drawing routine:
This can be used to load a normal sprite. This is highly experimental. It can be used to edit FloorObs. I made this especially to be able to use the recoloring tool on the corpse sprite. It does not work with images of other sizes. Expect crashes when using this.
Title: Re: UnitSprite Studio
Post by: efrenespartano on May 02, 2021, 06:10:38 pm
Awesomeeeeeee!

I was waiting for this, thank you so much! Your tools make my life easier. :D
Title: Re: UnitSprite Studio
Post by: Nord on October 22, 2021, 10:36:21 am
It is a great tool, must-have for any modder!
Thank you,bohemond.
Do you still working on this, or this version is final?
Title: Re: UnitSprite Studio
Post by: bohemond on October 26, 2021, 12:09:25 am
Definitely not the final version yet, but I haven't been working on it for quite a while.
I still have to add a bunch of Drawing routines, support for TFTD, custom frames, and maybe a few other things.
Title: Re: UnitSprite Studio
Post by: Nord on October 26, 2021, 02:20:16 pm
Then it will be even greater!
Good.
Indeed, this tool allows to fix multiple bugs in unit spritesheets and create new sheets with double or even triple speed.
Title: Re: UnitSprite Studio
Post by: efrenespartano on November 22, 2021, 12:30:09 am
This tool is so cool, i'm even able to use the color operations on the single frame setting to recolor craft basebit sprites!  ;D
Title: Re: UnitSprite Studio
Post by: pjlasl on January 04, 2022, 04:33:08 pm
Suggestion:

It would be nice to do a CTRL+click when you are using the single pixel selection tool. It would prevent me from having to click pixel > press arrow multiple times, if I could just CTRL+click the pixels I want around the grid.

Haven't gotten into all of the features of the tool, but what I have used so far I really like!
Title: Re: UnitSprite Studio
Post by: efrenespartano on January 05, 2022, 05:51:10 am
How difficult would be to add support for Pixel Operations on 320x200 inventory paperdolls? :D
Title: Re: UnitSprite Studio
Post by: Chuckebaby on January 05, 2022, 03:34:45 pm
wow this is a very cool tool. thanks
Title: Re: UnitSprite Studio
Post by: bohemond on January 16, 2022, 02:09:46 pm
@pjlasl: I don't understand what you mean. You can select multiple pixels by shift-clicking. If that's not what you need, could you explain what do you exactly mean by Ctrl-click?

@efrenespartano: Yes, I was already thinking of expanding the single frame editing to custom sizes. If that fails (because the whole single-frame editing is basically a hack) it may be easier to include several predefined sizes. In that case I will collect the common sizes used in mods and go with that.


Is there some preference on which Drawing routine(s) should I implement next?
Title: Re: UnitSprite Studio
Post by: Leflair on January 18, 2022, 10:06:05 am
Drawing routine 1, Floater, would be most generally useful.
Title: Re: UnitSprite Studio
Post by: efrenespartano on January 20, 2022, 04:29:38 am
Drawing routine 1, Floater, would be most generally useful.

I agree with Colonel Leflair. (._.)7


@efrenespartano: Yes, I was already thinking of expanding the single frame editing to custom sizes. If that fails (because the whole single-frame editing is basically a hack) it may be easier to include several predefined sizes. In that case I will collect the common sizes used in mods and go with that.

320x200 is the standard for all OXC images, i think it would be enough :D
Title: Release: Floater
Post by: bohemond on January 29, 2022, 01:46:02 pm
New version released (on github):
Drawing routine 1 - Floater
Support for Palettes
Single frame Drawing routine can edit any image size

Palettes:
There is a new combobox beside the palette that allows you to change the loaded sprite sheet's image.
When you switch palette you will be prompted with "Match colors to the selected palette?"
Yes - Will attempt to find the nearest color in the new palette and re-index
No - Will leave the indexes be, simply using the new palette.
Cancel - Will not change the palette

Single frame:
You can load images of any size, but don't expect great performance. The pixel operations work fine though.
Title: Re: UnitSprite Studio
Post by: Finnik on January 29, 2022, 03:24:29 pm
Nice to see you keep working on this great tool, thanks for the update!
Title: Re: UnitSprite Studio
Post by: Nord on January 30, 2022, 05:19:29 pm
It is brilliant!
Thank you, this tool is really must-have.
Title: Re: UnitSprite Studio
Post by: efrenespartano on February 01, 2022, 06:56:14 am
Wonderful! I really love the new additions. Recoloring units now is laughably easy. Thanks a ton! You are a god among us.

Time to make an Aztec sacrifice to honor you.  ;D
Title: Re: UnitSprite Studio
Post by: Alex_D on February 01, 2022, 06:51:06 pm
Dear Bohemond. Thank you very much for the tool !
It saves so much time for visualizing and animating one's work.

If I may ask a small feature. Would it be possible to add a button for a quick reload of the existing image ?

This is in case you are making editions using a different software and using this program to piece together the frames.

EDIT: Another small feature, maybe more important. Option to specify the number of death animation frames.
Title: Release: Integration with HandOb maker
Post by: bohemond on March 12, 2022, 10:36:22 am
New version released (on github):
Integration with HandOb maker
Possibility to load item from file and preview it on the unit
Support for additional rule values (standHeight, deathFrames)
Quick reload from source file

Integration with HandOb maker & Item preview:
You can now view an item as it would show up in-game on the unit. For now works only on select few drawing routines: 0 Soldier and 1 Floater.
You can either load in a file in the 8 frame format or you can load it from live HandOb maker application.
Short description is in HandOb maker wiki (https://github.com/bohemond-of-antioch/HandObMaker/wiki/Integration-with-UnitSprite-Studio)
If you click the HandObMaker button, it will start up a monitor and will refresh automatically with every update sent from HandOb maker. Likewise on the HandOb maker side, you can either send updates automatically or on demand with a button.
Beware: I did the integration via clipboard, because it was just the simplest. This means that your clipboard contents might be cleared unexpectedly when you have the integration running on full auto.

Support for additional rule values:
Here the most important is deathFrames. Most of the drawing routines support it, even though it seems to make sense only for a few of them. The UI is a little clunky, but it does its job. Don't forget to move the control focus to somewhere else once you are done entering the value. You'll see what I mean once you try using it.

Quick reload from source file:
You can reload from the source via File->Reload from disk or by pressing F5.
Title: Re: UnitSprite Studio
Post by: Finnik on March 12, 2022, 02:50:21 pm
Wow, that's just great! Lovely update!
Title: Re: UnitSprite Studio
Post by: Alex_D on March 12, 2022, 07:06:09 pm
Thank you!
Title: Re: UnitSprite Studio
Post by: Thorir on March 21, 2022, 10:32:01 am
Hello there,
 I'm very new to the XCOM modding scene, so obviously I'm full of dummy questions (but also with inspiration). I promise I'll try to learn by doing and read back on the forum, but I have something that actually made me creating an account...

Is there any way to change the handobject preview item here? I mean if I load a complete hadobject sheet (for a Sectoid for example) I only get the assault rifle. I can't figure out how to put like a plasma pistol or something to its hand.
Title: Re: UnitSprite Studio
Post by: bohemond on March 21, 2022, 04:04:34 pm
That is a good point, that's actually not supported, I completely forgot about that possibility. I'll add it to my to-do list.
At this time, if you want to preview a different item, you will have to cut it out of the complete sprite sheet and make one where the desired item is alone (or at the very top of the image).
Title: Re: UnitSprite Studio
Post by: Thorir on March 21, 2022, 05:28:36 pm
Theoreticaly can I create separated sheets for each weapon? Frankly speaking my ultimate goal here is to assemble NPC sprites with different arms for Doom... ::)
Title: Re: UnitSprite Studio
Post by: bohemond on March 22, 2022, 10:42:12 am
Yes, you can. A sprite sheet for a single item will be 256x40. You might also want to take a look at HandOb maker (https://openxcom.org/forum/index.php/topic,8160.0.html), which easies creation of these sprite sheets.

But I'm hardly qualified to help with modding and especially the graphical side of things. If you ask about creating item sprites in the Help section, I'm sure you will get much better advice than I can give.
Title: Re: UnitSprite Studio
Post by: Thorir on March 22, 2022, 12:12:57 pm
That's already more than enough for a solid start. Thank you for your help!
Title: Re: UnitSprite Studio
Post by: The Offensive Lemon on April 19, 2022, 05:20:43 am
I'm trying to load a spritesheet into the program, attached below (xcom.png), but I get this error:

Quote
An error has occured during loading of the file: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

I'm pretty sure everything checks out, from the size of the image to the exact colors used.  I don't know what I could be doing wrong.

EDIT: In case it helps, the image was saved with paint.net with 8-bit bit depth, Median Cut quantization, dithering level 0, transparency threshold 128, not interlaced.

I also created another image file (fuck.png) with UnitSprite Studio, saved it, and loaded it again without problems.  I did not touch that one with paint.net.
Title: Re: UnitSprite Studio
Post by: Alex_D on April 20, 2022, 12:56:15 am
I think the image "xcom.png" needs to be reduced to 256 colours.
Title: Re: UnitSprite Studio
Post by: The Offensive Lemon on April 20, 2022, 02:15:47 am
I think the image "xcom.png" needs to be reduced to 256 colours.

I figured setting the bit depth to 8 bits would do that... fuck.png has the same bit depth, after all.

EDIT: If I change the bit depth to something other than 8, USS tells me:
Quote
An error has occured during loading of the file: Unsupported image format!

Also, weirdly enough, if I put in the first attachment (gkjkgjkgkjgkjgkhgk.png), which also has bit depth 8, it works.
Title: Re: UnitSprite Studio
Post by: bohemond on April 21, 2022, 11:12:29 pm
I've identified the problem. The xcom.png image has a palette with only 67 colors, because it's saved with optimized palette. The function that tries to identify the palette expects there to be 255 colors, hence the index out of range error. I did not account for this feature of PNG.

I'm not sure if there is a point in fixing this, as the optimized palette sprite will not work in-game anyway. I'll fix it if I see a simple way to do it.

In the meantime, I've attached your spritesheet saved with UFO Battlescape not-optimized palette.
Title: Re: UnitSprite Studio
Post by: The Offensive Lemon on April 22, 2022, 05:17:37 pm
I've identified the problem. The xcom.png image has a palette with only 67 colors, because it's saved with optimized palette. The function that tries to identify the palette expects there to be 255 colors, hence the index out of range error. I did not account for this feature of PNG.

I'm not sure if there is a point in fixing this, as the optimized palette sprite will not work in-game anyway. I'll fix it if I see a simple way to do it.

In the meantime, I've attached your spritesheet saved with UFO Battlescape not-optimized palette.

Thanks a lot!  If I may ask, how did you un-optimize the palette?  I can't seem to do that in paint.net.
Title: Re: UnitSprite Studio
Post by: Meridian on April 22, 2022, 09:27:36 pm
Don't use paint.net, it can't do it.

There's a long list of image editors that can do it: photoshop, gimp, asesprite, irfanview, and many many more.
See https://openxcom.org/forum/index.php/topic,7781.0.html
Title: Of Tanks and Chryssalids
Post by: bohemond on October 23, 2022, 01:03:13 am
New version is released and on github.

Support for Drawing routines:
2 - XCom HWP
7 - Chryssalid
8 - Celatid
9 - Silacoid

New features:
You can edit the Item sprite directly in the studio
Pixel operations preset for fixing the common problem of left <-> right arm switch
More shortcuts for selecting layer (numbers 1 through 9)
New Single frame sprite can be created with custom size and palette

Bugfixes:
Color shift now works properly for complicated Drawing routines
Loading of non 8 byte aligned images
Item layers are handled with better performance

Notes:
The new drawing routines are not tested in game, please report if you spot any problem.
Only Soldier(0) and Floater(1) drawing routines support display of items, so you have to load up one of those to use item editing.
Title: Re: UnitSprite Studio
Post by: gaffer on October 23, 2022, 01:58:18 am
Many thanks Bohemond!
Title: Re: UnitSprite Studio
Post by: Finnik on October 23, 2022, 11:53:27 am
Thank you!
Title: Re: UnitSprite Studio
Post by: b on December 26, 2022, 10:38:08 pm
Has anybody gotten this to work on Linux? 
Title: Re: UnitSprite Studio
Post by: efrenespartano on December 28, 2022, 02:46:41 am
With Falko's tools down, there is no way to properly create 2x2 units. Cutting them without the aforementioned tool is nearly impossible. God Bohemond, could be possible to add the option to create large units on your tool?
Title: Re: UnitSprite Studio
Post by: Solarius Scorch on December 29, 2022, 12:23:36 am
With Falko's tools down, there is no way to properly create 2x2 units. Cutting them without the aforementioned tool is nearly impossible. God Bohemond, could be possible to add the option to create large units on your tool?

I wholeheartedly second that wish, if this is within the scope of your program.
Title: Re: UnitSprite Studio
Post by: bohemond on December 29, 2022, 02:34:45 am
Well it does currently support drawing routines 2 (XCom HWP) and 5 (Sectopod, Reaper), so you can edit those 2x2 units as you would have any other unit. I will add other drawing routines if you need them.
Granted, editing these units is not exactly intuitive and requires some knowledge of how they work. I will add a description on how to work with them on the wiki.

If that's not what you're after, then give me a description of what you want and let me see if I can do that.
Title: Re: UnitSprite Studio
Post by: Solarius Scorch on December 29, 2022, 03:55:22 pm
If that's not what you're after, then give me a description of what you want and let me see if I can do that.

Simple, what we need is to convert this:

(https://i.imgur.com/fFRjlXF.png)

into this:

(https://i.imgur.com/BjeZ3Ao.png)

And the same for other routines, of course.
Title: Re: UnitSprite Studio
Post by: The Martian on December 30, 2022, 12:53:58 pm
With Falko's tools down, there is no way to properly create 2x2 units. Cutting them without the aforementioned tool is nearly impossible. God Bohemond, could be possible to add the option to create large units on your tool?

Many 2x2 unit sprite sheets found on the OpenXcom forum are in the easy to edit template format that Falko's Tool (https://openxcom.org/forum/index.php/topic,2980.0.html) used, it would be most appreciated if you could make UnitSprite Studio compatible with their formats.

I happened to save all of the 2x2 unit templates used by Falko's Tool before it went down.

Hopefully these will help:


Drawing Routine 2 (Tank & Hovertank)
(https://openxcom.org/forum/index.php?action=dlattach;topic=9524.0;attach=58715)

Drawing Routine 3 (Cyberdisc)
(https://openxcom.org/forum/index.php?action=dlattach;topic=9524.0;attach=58717)

Drawing Routine 5 (Sectopod)
(https://openxcom.org/forum/index.php?action=dlattach;topic=9524.0;attach=58721)

Drawing Routine 5 (Reaper)
(https://openxcom.org/forum/index.php?action=dlattach;topic=9524.0;attach=58719)

Drawing Routine 11 (Coelacanth & Displacer)
(https://openxcom.org/forum/index.php?action=dlattach;topic=9524.0;attach=58723)

Drawing Routine 12 (Hallucinoid)
(https://openxcom.org/forum/index.php?action=dlattach;topic=9524.0;attach=58725)

Drawing Routine 20 (Triscene)
(https://openxcom.org/forum/index.php?action=dlattach;topic=9524.0;attach=58727)

Drawing Routine 21 (Xarquid)
(https://openxcom.org/forum/index.php?action=dlattach;topic=9524.0;attach=58729)
Title: Re: UnitSprite Studio
Post by: The Martian on December 30, 2022, 12:57:49 pm
And here are the ready to use split versions of each sprite sheet that Falko's Tool created from the templates.


Drawing Routine 2 (Tank and Hovertank) (Split)
(https://openxcom.org/forum/index.php?action=dlattach;topic=9524.0;attach=58731)

Drawing Routine 3 (Cyberdisc) (Split)
(https://openxcom.org/forum/index.php?action=dlattach;topic=9524.0;attach=58733)

Drawing Routine 5 (Reaper) (Split)
(https://openxcom.org/forum/index.php?action=dlattach;topic=9524.0;attach=58734)

Drawing Routine 5 (Sectopod) (Split)
(https://openxcom.org/forum/index.php?action=dlattach;topic=9524.0;attach=58736)

Drawing Routine 11 (Coelacanth and Displacer) (Split)
(https://openxcom.org/forum/index.php?action=dlattach;topic=9524.0;attach=58738)

Drawing Routine 12 (Hallucinoid) (Split)
(https://openxcom.org/forum/index.php?action=dlattach;topic=9524.0;attach=58740)

Drawing Routine 20 (Triscene) (Split)
(https://openxcom.org/forum/index.php?action=dlattach;topic=9524.0;attach=58741)

Drawing Routine 21 (Xarquid) (Split)
(https://openxcom.org/forum/index.php?action=dlattach;topic=9524.0;attach=58743)
Title: Re: UnitSprite Studio
Post by: Finnik on September 02, 2023, 12:39:26 am
The next stop! =)
Can we have this process automated?
  ;)
Title: Re: UnitSprite Studio
Post by: bohemond on September 21, 2023, 01:26:28 pm
I'm sure it can be automated somehow, I'll give it a try.