Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some missing definition for tags. #5

Open
therahedwig opened this issue Aug 31, 2019 · 7 comments
Open

Some missing definition for tags. #5

therahedwig opened this issue Aug 31, 2019 · 7 comments

Comments

@therahedwig
Copy link
Contributor

Ok, playing a bit now...

masks: these have plid instead of pfid (parent layers instead of folders). Functioning is the same though.
texn: Name of the texture overlay on a layer, the simplest setting gave me 'Watercolor A'. I guess sai is pointing at the resources it has here.
peff: when a layer has a watercolor fringe enabled(the only layer effect), and you interpret the data as ints, this outputs 1, 100, 1, when a layer doesn't have it enabled, it outputs 0, 100, 1. No idea yet what the latter two values are...

wsrc in the canvas entry is the layer marked as selection source.
layid seems to be the selected layer just like layr. weird duplication.

@Wunkolo
Copy link
Owner

Wunkolo commented Aug 31, 2019

Updated the readme with these!

Gonna dive in IDA Pro and get more info on some of these unknowns and behaviors, such as peff

@Wunkolo
Copy link
Owner

Wunkolo commented Aug 31, 2019

Got a good map of the layer writing procedures and some dependent-tags.
Will update the readme with some of this info
image

@therahedwig
Copy link
Contributor Author

Ok, made some testfiles here...

so, texp is Texture Scale and Texture Intensity/Opacity. These are the options for the texture overlay.

Texture Scale is the scaling of the texture going from 50% to 500%(the files will write down the integer, no conversion needed), Texture Intensity/Opacity is how strong the effect is going from 0 to 100. They're both integers. The texture name itself is in texn as noted before.

peff, and you wrote this down incorrectly, is where the watercolor fringe effect is enabled. This is somewhat like a photoshop inner dropshadow or satin layer styles(I can't figure out which until I've got raster stuff working :D, my money is on it being the satin layer style)

  • The first uint8 is a boolean, may have been intended to be an integer, given the related ui control is a dropdown box. I took a peek at Sai2 because I was curious/worried whether this was expanded, and indeed there's also a binary/threshold filter in this same dropdown, but that fileformat is marked as sai2, so no worries right now.
  • The second uint8 is the opacity of the layer fringe. this goes from 0 to 100.
  • The third uint8 is an integer representing the width. This goes from 1 to 15.

I am attaching a zip of my beautiful sexy testfiles.
libsai_testfiles.zip

@therahedwig
Copy link
Contributor Author

I am about 99% sure that the lmfl has to do with the two toggles between the layer and the mask.

The topmost toggle is whether the mask is active.
The bottommost toggle is whether, if you transform/move the layer, it should also transform/move the mask. The status tip of this toggle is 'link to layer transformation deformation'.

When I print it's std::uint32_t as an int I get the following:

  • When a mask has both active, it outputs 3
  • When a mask only has link to layer transformation deformation disabled, it outputs as 2
  • When a mask only has the mask disabled, it outputs as 1.

My test file for this is right now a bit too heavy to upload(as I was also trying to figure out whether large file size is indeed the cause of my last bit of pixelreading woes... it is) I'll try to make some new ones tomorrow. :)

@Wunkolo
Copy link
Owner

Wunkolo commented Sep 3, 2019

lmfl is a 32-bit bitmask it looks like. It only actually uses the 2 least-significant bits, and only exists if the layer file is a mask.

Bit 0 is set: if the runtime blending mode index is not zero.

Bit 1 is set: If the opacity is not zero.

image

@therahedwig
Copy link
Contributor Author

Ok, the lorg tag is a bit of a boring one: it's related to the layer bounds, in specific it seems to be related to how much of the layer is visible. So a layer of [-12, -31, 832, 608] the lorg will be [276, 33] .

Which means if you do 832-276-12, you get 544, 608-33-31, also 544, And in the case of this particular canvas, the size of a fully filled layer without translation is 544x544. To put it simply, it's the coordinate of the bottomright of the layer bounds relative to the bottomright of the canvas.

@therahedwig
Copy link
Contributor Author

Ok, the crashing file of yesterday was actually my mask options testing file, and it confirms that lmfl actually controls the mask visibility and whether it's linked to the layertransforms.

case sai::Tag("lmfl"):
            {
                std::uint32_t Options;
                LayerFile.Read(Options);
                std::printf("\t\tMask Bitmask: %x, Visible: %d, Linked To Layer Transform: %d\n"
                            , Options
                            , (Options & 1) != 0
                            , (Options & 2) != 0);
                break;
            }

At the least, that is how Sai stores these toggles inside the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants