If you can find a file that has the first byte of the header not 0 then i will try to look into it.
My theory is it might have been a type specification could also had been global shape flags, as these are things Westwood did previously.

That said i don't have any files to show this or found the code that reads this byte at all, it's also worth noting it might not be a byte but a word.

As for the forth byte in AverageColor, its probably padding.

Oh yea also note on AverageColor generation, it's essentially just what you get when you do Average in any image editor, but there is one difference, you need to discard the 0x0 index pixels, it averages the nontransparent pixels only, while in image editors even if you make the background transparent internally it will still fill it with white or black and then average it.
Don't quote me on this that it should be like this but as far as code goes on a quick google after a few pages i found https://www.compuphase.com/graphic/scale3.htm which seems to be a sane way to go about it. Ill have to look into it tomorrow myself see if i can find anything like that in shapeset._________________Tiberian Dawn, Red Alert, Tiberian Sun ,Red Alert 2,Renegade, Command & Conquer 3,Tiberium and Tiberium Wars and Westwood related image & video archive
https://picasaweb.google.com/113361105083292812413?noredirect=1

Skype live:tomsons26
Don't forget to state who are you otherwise i'll ignore the inviteQUICK_EDIT

Is the image processing (worker threads) necessary before making SHP
if there are images in only one column? Are these processing only for
combining images or these do something before making SHP?QUICK_EDIT

they are necessary for the time consuming color conversion.
The Euclidean calculation may be fast for one color, but it still needs to find for every single pixel in the image the corresponding palette color.
And for this there is the slow
for x=0 to bitmap.width
for y=0 to bitmap.height
{
getPalettePixelColor(x,y)
}
function necessary.

Each row is an image conversion (and combining) job, and the number row-jobs are equally split among the threads.
You can see the result of the row-jobs if you enable the temp image output, as then the threads save the converted image in the palette indexed file.

The converted (and combined) images are collected (thus the big memory usage after conversion) and then saved as SHP in the main thread, which is the only time the interface freezes, as i didn't want to put this in separate thread as well._________________SHP Artist of Twisted Insurrection: Nod buildings

i need more infos than that.
-program version
-which images do you used? (size, color format etc) Best upload them so i can recreate the issue
-how many images
-at which point do you got the message (during image processing? while shp saving?)
..._________________SHP Artist of Twisted Insurrection: Nod buildings

@deathreaperz
No clue if your problem is fixed with this update. I didn't had my crystal ball at hand to see what went wrong in your case._________________SHP Artist of Twisted Insurrection: Nod buildings

The average color should be checked on by default, as we don't know
what else it is used for apart from radar color. Also its last used status is
not saved.

The optimize canvas checkbox should be unchecked by default and when
making it checked, by default the keep center should be checked. Let the
user uncheck the keep center checkbox manually.

Have you checked if the resultant SHP is not affecting position in game
relative to its selection box? It should be safe in all conditions like a
structure would be having more than a single shp like buildup, animations
to accompany the main structure, this option shouldn't result in having
SHPs rendering at different alignment.QUICK_EDIT

Have you checked if the resultant SHP is not affecting position in game
relative to its selection box? It should be safe in all conditions like a
structure would be having more than a single shp like buildup, animations
to accompany the main structure, this option shouldn't result in having
SHPs rendering at different alignment.

I think you realise the app merely adjusts according to provided art and force its dimension to smallest possible will not work with separate same building shps despite keeping center at the moment when processing singular shps. As is, canvas optimization is more for the pros at this point than average joe that may not realise the potential inconsistencies.

Buildings wise this would need possibility of inserting all building shps in and then use them together for the measurement but still split like originals were, else you'd be forced to split them yourself afterwards. Adding all in single list now seems not to apply the canvas optimization in my test when giving multiple shps despite makes common shp.

Also some minor bug, i tried dragging shps into the image lists and 3rd image list would not put at the first frame (put a lot of blank frames instead first) when dragging shp in unless you use the load function(?)QUICK_EDIT

The canvas crop feature could be dropped altogether as it won't make
much difference when using compression in SHP. Or it could be made
available in some expert mode. For now it could be kept unchecked
by default.

Drag and drop on the first empty row of the column that you desire.
It works for first row of 3rd column as well.QUICK_EDIT

D&D always checks where exactly you drop. Only if there are no rows present, it starts inserting the images from top.

This is because the tool can combine images, where you might want to combine images 64-96 with something, so you would drop your additional 32 images on the 64th cell, not the first cell.
Same is true with load images, which also checks the cell location where you right clicked and inserts the images in the that column starting from that row.

It could be that "opt. canvas" alone (keep centered unchecked) is not keeping the image at the correct place ingame.
I have to do some more tests with optimize canvas and check how ShapeSet optimized the canvas.

However, with "keep centered" checked, it works as it should and optimizes the canvas fine.

\Edit
opt. canvas with "keep centered" off works the same as ShapeSet.
however if the colored pixel where off center yet correct positioned ingame, they get misaligned due to the canvas optimization.

In ShapeSet, WW used a simple rectangle drawn on the first frame to set the canvas. The same could be done in Image Shaper if you have "keep centered" off.

Attached is a sketch showing the canvas optimization methods.
In the 3rd case the image gets misaligned, since it lost its relative position to the center as offset is set to 0,0.

Note: when the SHP is saved, each frame has it's own minimal sized canvas set. In the example the SHP would store only data for the 18x24 big image.

should work fine if you select opt. canvas and keep centered
-you should only make sure buildup and base have same dimensions
-turret and anims can have different dimensions
as long as they all are kept centered, there isn't a problem in minimizing the canvas_________________SHP Artist of Twisted Insurrection: Nod buildings

new version uploaded
next to some new functions, this one has a few optimizations in the interface to speed up the work with the tool. Mainly you don't have to right click selected files anymore to set the frame specific settings like radar color.

Version 01.01.00.08
-(bugfix) optimize canvas failed when empty frames were included
-(bugfix) when using "RLE_Zero" compression, the bitflag wasn't set in the SHP
-(update) last used average color checkbox value stored in ini
-(update) when enabling "optimize canvas", "keep centered" is enabled by default as well
-(update) option added to use a custom color as transparent background color during color conversion
-(update) option added to copy only the transparent pixel when combining this image with a base image
-(update) changes in the "Image/Frame Settings" are instantly applied to the selected images/frames

"combine transparent pixel"
this option is for those who use different render passes, where one is some kind of mask, with the mask defining the area that should be kept and all other pixel set transparent.
e.g.
you have 2 render passes, one with heavy blur anti-aliasing into the background, one without anti-aliasing and sharp borders.
-load in ImageList 1 the anti-aliased blurred images which alone would give a dark outline during conversion
-load in ImageList 2 the sharp aliased images and set on these "combine transparent pixel"

Now the transparent pixel of the mask are copied onto the blurred image.
This way you can remove the dark outline, while keeping the blurred or anti-aliased inner part._________________SHP Artist of Twisted Insurrection: Nod buildings

I wasn't trying to force your hand or anything, most people won't even be interested in the code in this community and its not like the OpenRA team or even Olaf are really likely to pursue the matter and they are the only ones who would have standing to do anything about enforcing the GPL on you. As it is, if I can't rebuild the entire tool, a bit of the source isn't exactly useful.

You should be careful about incorporating open source code in your tools if you don't intend to play by the open source rules though, the GPL requires you make the entire source available for a binary you distribute that contains some GPL code, not just the bit of GPL code you happen to use.

I personally think its just the right thing to do to open source tools for modding. I am aware that I have released tools myself without source because they were based on code I couldn't just okay the release of on my own, but if I could have I would.

I'd like to second this. It's awesome that people want to build stuff based on OpenRA, but it is only fair and is a condition of the license that you don't restrict that same right from others.
The GPL doesn't force you to post the code publically, but it does require you to give all the code that makes up the binary to anyone who asks for it.QUICK_EDIT

new version uploaded
Version 01.01.00.09
-(update) create images expanded with SHP(TS) file format, allowing each frame to be saved as SHP
-(update) create images filename can now use an asterisk *, to keep the original filename for the single frame

This basically allows to convert single images into single frame SHPs, like a batch process.

@pchote:
The source for the SHP creating routine is uploaded on the previous page.
If someone wants the complete program source code, he can write me a PM and i'll send it._________________SHP Artist of Twisted Insurrection: Nod buildings

Hm, I ran into a big issue when trying to import a construction yard I am doing into the shp builder, assume 700 frames, 320x240 each, the SHP builder was simply incapable of importing such amount of files, freezing it for more than 20 minutes, by then I just had to kill the process, on the other hand, your program takes little to no time. Thanks man, at a first glance, it seems to work great._________________
Creator of Shattered Paradise and Nomad Galaxy. WARNING, there are tons of gifs on both pages.
ORA Discord https://discordapp.com/invite/tuhp9m6 , SP Discord https://discord.gg/hk428WkQUICK_EDIT

Though 20 min for SHP Builder isn't unusual. After an hour i would have said it stopped working, but the import in SHP Builder can really take that long. It's also normal for SHP Builder that the interface freezes, but it still works in the background.
When it crashes due to too many frames/memory usage it'll usually throw an exception._________________SHP Artist of Twisted Insurrection: Nod buildings

I noticed something, when loading images, the program takes more time to display the image list on the main window than loading the rest of the images. (Think, the frame had 29 frames while the the whole list was had 682 files)

Another thing, a request, did you ever thought of adding an option to process all the frames after an x number as shadow frames (All pixels asigned to a single color)?

I noticed something, when loading images, the program takes more time to display the image list on the main window than loading the rest of the images.

I noticed that too, that when populating the onscreen list, it seems to take
a little longer as if it is refreshing the viewable list on adding every list item.
When it starts loading the offscreen list it goes fast. It started happening
only with v01.01.00.06 onwards. But the delay is negligible.QUICK_EDIT

Another thing, a request, did you ever thought of adding an option to process all the frames after an x number as shadow frames (All pixels asigned to a single color)?

The most logical option would be to render the second half of the frame list, but please dont do that, ORA allows more flexibility on where you can put the shadows.

a) yes, but deliberately not implemented any automatism, because it's just a few clicks to assign the shadow frames their own customized palette
and an automatism could work wrong in several cases (e.g. explosion anims without shadows).

I might add a way to apply the custom shadow palette a bit faster, removing some repetitive steps.

b) nah, wouldn't have done this in such a imprecise way anyway, due to issues mentioned in a)

Version 01.01.00.10
-(bugfix) RLE-Zero encoding algorithm crashed when the encoded result data was bigger than 2 times the uncompressed data (RLE encoded worst-case is 3 times the size as uncompressed)
-(bugfix) imported files ignored the "fixed Backcolor" setting
-(update) faster file import in datagridview (now refreshes only once after import is complete)

The problem was the RLE_Zero encoder.
In SHP Builder it constantly raises the byte-array size while it creates the encoded data.
Since arrays in C# need several performance heavy steps to be resized and i didn't want to use the slower List, i simply had the byte-array for the RLE-result preallocated and scaled 2 times the size as the uncompressed byte-array, thinking it would be sufficient.
Unfortunately the worst case for RLE-Zero compressed data can make it 3 times the size as the uncompressed data, in case of a single pixel._________________SHP Artist of Twisted Insurrection: Nod buildings

For weapon muzzle anim the Start/End= trick doesn't work and I have to separate the file into 32 directions which it's kind of boring and dull to do.
So can you add the following feature or equivalence:
Combine every N frames into one file. For example if I have 960 frames and set N=30, then I get 32 shps with 30 frames._________________Aircraft Factory ModCommand & Conquer: Genetic RhapsodyQUICK_EDIT

Version 01.01.00.12
-(update) if preview window is focused, ctrl+c copies the image into the clipboard
-(update) Split result added, which allows to split the frames evenly into multiple SHPs.

Note: haven't made it with a split every n-th frame, since this would be a bit more inconvenient in the interface, as it needs an additional checkbox to turn it on/off
or
the user would always have to make sure the entered number is high enough when creating single SHPs (which is quite the norm).

Right now the default is 1, and only when you want to split it up you raise the value to the number of files that you want.
In your case you use 32.

Note: leftover frames from the division without remainders are skipped.
e.g.
10 frames divided into 6 files would result into 6 files with 1 frame each and 4 frames being skipped._________________SHP Artist of Twisted Insurrection: Nod buildings

interesting, it's again the RLE encoder.
It seems even triple size of the pre-dimensioned result array is not big enough. So now it increases the array as necessary and this should make an end to these kind of encoder bugs.

they are necessary for the time consuming color conversion.
The Euclidean calculation may be fast for one color, but it still needs to find for every single pixel in the image the corresponding palette color.
And for this there is the slow
for x=0 to bitmap.width
for y=0 to bitmap.height
{
getPalettePixelColor(x,y)
}
function necessary.

You can speed it up significantly by storing the found indices in a hashmap with the bare RGB value as key. After all, a large part of these pixels will be background colour, and on sprites you generally won't have millions of unique colours anyway._________________QUICK_EDIT

That's exactly how it works already and it did indeed raise the speed significantly.
Next to the multi-threading, that was one of the first things i made to increase processing speed._________________SHP Artist of Twisted Insurrection: Nod buildings

Heh. I should really look into multithreading... right now my Engie File Converter has this typical tendency to freeze the UI for a few seconds while it's saving stuff
(in my defense, it was originally created for converting uncompressed single images from some Nintendo 64 format to normal PC formats.)

As for buffer sizes, for the TS and Dune II whitespace collapsing RLE implementations I never needed to worry about that; the .Net framework has a MemoryStream class, which is basically an automatically-expanding memory buffer handled as a stream. So yea, I never even need to look at the maximum size. I just write to it and then retrieve the final result as byte array.

I should actually implement that for my other compression algorithms too..._________________QUICK_EDIT

All good points and worth being added. Not sure when i have time to implement them though.

kenosis wrote:

And if I put in frames it will place last frame on first, I don't know why, but have to manually remove it and add it to the end.

Do you use a special file browser?
I tested with Total Commander and Windows Explorer (Win7) adding a list of files. Regardless if selecting the files from top to bottom, or bottom to top, or multiple one by one via ctrl, the files are added in the same order as highlighted in the file browser.

kenosis wrote:

Would it be possible to adjust orders by drag/drop?

gonna have to see how to add this. All the special cases aren't that easy to implement like
-multiple files d&d to a place where there are already files in the list (what happens to the files in the 2nd and 3rd column? should they move with the files from the 1st column, since they usually belong together?)
-1 file d&d on another, should it replace the existing one? should they switch places? should the d&d file get inserted into the list above the dropped cell?_________________SHP Artist of Twisted Insurrection: Nod buildings

If can really drag&drop to edit order, consider the columns, maybe a check box can be used to select single column or all columns. Or if not the check box, default single column can be better, because multi column can be achieved by multiple times d&d, but you cant move single column with the move all columns default.

I think people using image shaper would probably import all images from the beginning, and adjust them later, so if you d&d, it means deleting existing frames and adding after the target - drag frames 1-25 onto frame 27 would mean delete 1-25, and old frame 1 becomes frame 28. Or not drag drop, but cut/paste (onto selected frame), a note on paste effect (will add above/under target frame) for users can be enough already.

Since sometimes you can add frames to the end, so paste onto certain frame means under will be the right choice._________________Bureau de Planification de WLGC
Présente fièrement
QUICK_EDIT

Version 01.01.00.15
-(update) internal Drag & Drop added to the datagrid cells. If a cell is empty, the d&d value is set, otherwise a new row inserted. Existing values are not replaced!
-(update) [File] menu added to menustrip, which offers functions to save and load a project. A project includes the data from the datagrid and the complete palette setup.

Note: due to a quirk of the DataGridView, when d&d multiple cells, you have to keep shift/ctrl pressed and have to start dragging from the last selected cell. Otherwise the selection is lost/changed.
Note2: this tool is using the old kernel32 (Write/Get)PrivateProfileString functions. It needs to be tested if these work well enough when saving/loading huge projects with thousands of frames._________________SHP Artist of Twisted Insurrection: Nod buildings

If you are visually impaired or cannot otherwise answer the challenges below please contact the Administrator for help.

Write only one of the following words: Brotherhood, unity, peace!

You can post new topics in this forumYou can reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum