Dynamic creation of the atlas in the script

I’m not using that, I’m setting the buffer directly.

Here is current code

https://github.com/subsoap/imagebatch/blob/master/example/avatar_controller.script

I disabled string.reverse() because I don’t think it’s the right solution.

Here’s what current version looks like

It does look like a vertical flip of the pixels is all that’s needed.

1 Like

I’m not sure how to flip the raw data properly. I guess you could flip the gui node too by setting its y scale to -1 but that’s not the most ideal solution…

Should image.load() have a flip flag?

Got image flipping working. I realized it could be done very easily… but it’s using strings so probably would be faster if it was done in an extension, or image.load() had a flip flag.

local function flip_image(image)

	local width = image.width
	local height = image.height

	local temp_buffer = ""
	local width_chunk = width * 3

	for i=1, height do
		local start = (i - 1) * width_chunk + 1
		local stop = start + width_chunk - 1
		temp_buffer = string.sub(image.buffer, start, stop) .. temp_buffer
	end

	return temp_buffer
end

Here I was off by 1 at the end until I did -1. And a few abominations from editing width_chunk to custom values…

2018-07-13%2009_34_31-ImageBatch2018-07-13%2009_34_22-ImageBatch2018-07-13%2009_29_48-ImageBatch2018-07-13%2009_27_43-ImageBatch

Now it’s time for the real cleanup and putting everything into a neat package.

5 Likes

Move out Test Driven Development, PDD is here - Pkeod Driven Development. :smiley:

5 Likes

The script currently is unavailable. Is there a newer version?

It’s all here https://github.com/subsoap/imagebatch/tree/master/imagebatch

5 Likes