PDA

View Full Version : Image.addLayerPaintStamp not respecting w and h grid unit scaling.



SilentRuin
July 7th, 2023, 06:17
The addLayerPaintStamp does not respect the w=5, h=1 dimentions as it does when manually doing the layer paint stamp of the asset through the right hand map controls. I can see no reason why this function is not respecting this scaling - it should be the exact same functionality.



Image.addLayerPaintStamp(sPath, nLayerID, { asset=sAttackAsset, w=5, h=1, x=x, y=y});


this was 25ft long 5ft wide asset layer and is about that dimension in raw assets - places fine from map layer controls but not in lua call of this function.

[POST EDIT]
Actually it does seem to work - just not all the time. Seems wierd but maybe I should hold off on this. Sometimes it does not respect them - other times it does - different numbers? Not sure but I supposed I retract it not working. Its "sort of" working.

superteddy57
July 7th, 2023, 06:38
Moon is currently away on vacation, but I will pass it along to him to review when he gets back.

SilentRuin
July 7th, 2023, 18:02
Verified flaky on when it actually applies the scaling. It "seems" to work most times but for sure fails to at others. Looks like a timing issue. I doubt I can duplicate it reliably you will have to look at the code and see if something appears obvious.

SilentRuin
July 7th, 2023, 19:11
I thought making that call an OOB (as pointless as that sounds) would maybe get rid of the flakyness, but that just made it fail 100% of the time to do scaling. Maybe that can help them debug it as kicking it off as OOB makes it never respect scaling.

SilentRuin
July 7th, 2023, 21:43
Further testing with OOB shows it is basically just as random flaky on scaling as calling directly. I'll stick with OOB as players need to trigger this. Gist is something timing is wrong. Sometimes it works constantly but more often than not after immediately coming up it randomly fails to scale.

SilentRuin
July 8th, 2023, 04:39
Even more testing and I find that Cloud (which I never use) can have players literally not only lose scaling but lose the layer updates completely. I stick to LAN and only have player get scaling loss issues about 50-80% of the time.

SilentRuin
July 8th, 2023, 14:07
This is interesting. A .PNG asset always works - scale is always correct. Only the webm (VP8) have the random scaling failures or general failure to appear. That should narrow it down for you. As to duplicate I'd have to give you an extension that calls the layer with all the magic.

SilentRuin
July 8th, 2023, 17:38
This video at the time linked in shows how .png assets always get scaled correctly and webm (VP8) is hit or miss. No pattern I've recognized.


https://youtu.be/LoN6PGeeVhg?t=147

SilentRuin
July 9th, 2023, 00:42
Inteface.getAssets is undocumented.

pindercarl
July 10th, 2023, 02:57
This video at the time linked in shows how .png assets always get scaled correctly and webm (VP8) is hit or miss. No pattern I've recognized.


https://youtu.be/LoN6PGeeVhg?t=147

I'll chat with John when he gets back from vacation. The dimensions of a Webm file aren't known until the first frame is loaded. All of the image functions have a callback to set the scale after the image is loaded. The API functions looks to be setting the scale first.

SilentRuin
July 10th, 2023, 03:00
I'll chat with John when he gets back from vacation. The dimensions of a Webm file aren't known until the first frame is loaded. All of the image functions have a callback to set the scale after the image is loaded. The API functions looks to be setting the scale first.

Awesome that sounds fixable! Tomorrow I'll have me and my players fully animated in a backhanded "good enough" way - and even though I can live with the scale failures - it would be very nice to have .webm (VP8) files work as well as .png ones do in lua placed scaled assets in map layers.

SilentRuin
July 11th, 2023, 19:01
I'll chat with John when he gets back from vacation. The dimensions of a Webm file aren't known until the first frame is loaded. All of the image functions have a callback to set the scale after the image is loaded. The API functions looks to be setting the scale first.

Is this something planning to be fixed soon?

superteddy57
July 11th, 2023, 19:54
Moon Wizard is not back from vacation yet, and as Carl pointed out, it would require a discussion with him before moving forward.

SilentRuin
July 12th, 2023, 05:13
I have a question on use of addLayerPaintStamp asset's w and h (in grid units) parameters. I place something over a token I give it the spacing*2 scale of that token - like 2x2 on those parameters. Some Assets that are put into map UI layers stamp window will have w= h in the UI and these place just right with addLayerPaintStamp's 2(w)x2(h) values.

unmodified perfect
58167

But other Assets when droopped into map UI layers stamp window show up squashed and have different values for w and h. And when addLayerPaintStamp applies its w=h parameters (duplicated by simply forcing the w=h in the map UI layers stamping window) it will always appeared squished.

unmodifed squished
58168

modified squished
58169

I thought simply scaling video size to have equal pixel sizes would fix it but it did not. What am I missing? I assume there is no FGU Image code to get the asset height and width so it can be scaled properly? And what is causing this?

SilentRuin
July 12th, 2023, 05:40
Solved it though it will make using assets with this function pretty painful with no way to know what the intial size of the asset is. Basically I had to make sure my resolutions and aspect ratios were all the same (I chose 512) and then resized the image to expand out to the borders. Ugh - I'll have to check every one of these assets and insure they have the same resolutions and aspect ratios unless there is some way to tell the "base" values which show up in the map UI layer stamping window (likely gotten by code I have no access to).

[PostEdit]: wonderful found another undocumented function - this will solve my scaling issue I think.

local tImageSize = {};
tImageSize.w, tImageSize.h = Interface.getAssetSize(sAsset);

SilentRuin
July 12th, 2023, 18:49
I'm not sure why but I can tell when an asset is going to fail to scale when I call Interface.getAssetSize(sAsset) as it will have both returned values 0. If it returns values the layer placement always works. Very weird. This is BEFORE anything is placed or the addLayerPaintStamp is even called.

SilentRuin
July 13th, 2023, 19:57
Is the Interface.getAssets function able to react to a refresh of assets after the asset files have been updated? I admit a test I last did was not showing it updated from the time the app started and I tried to refresh this data (calling function again) after the refresh assets button was pressed.

Moon Wizard
July 14th, 2023, 18:46
Interface.getAssets returns the list of all assets currently in the asset index, which is what is the same data that is used to feed the Assets window.

Regards,
JPG

SilentRuin
July 14th, 2023, 19:29
Interface.getAssets returns the list of all assets currently in the asset index, which is what is the same data that is used to feed the Assets window.

Regards,
JPG

I must have been in some bad inbetween state in my .ext developement because it indeed works as you say now.

Any word on the fix to the addLayerPaintStamp scales not alway applying for .webm (always works for .png) or the Interface.getAssetSize returning 0,0 for the asset sizes when this is about to fail?

Moon Wizard
July 14th, 2023, 19:35
As @pindercarl mentioned, it's not a simple fix. Also, I just got back from vacation. I'm not sure on what it would take to resolve, nor how that fits in with other priorities until I get more information next week.

Regards,
JPG

SilentRuin
July 15th, 2023, 17:55
"Maybe" a workaround to this bug of the scaling is to bring up the webm in the Asset window that you are going to place as it actually displays those assets in the Asset window (and I suppose manges to get into the file and get the missing data?). If you bring up every asset you plan to use in the asset window at least once before you start placing assets in lua code then it "appears" to work. Though i've not done enough through testing to state this unequivocally.

I tried a number of dummy placements in the code which never works - apparently the webm has to be actually displayed and running someplace at least once for this to start working. IF it keeps working - as I said only just discovered this and it may not be a gauruntee to keep them working. Time will tell.

Though coming up in app and bringing up every asset I plan to use in asset manager so it plays at least once will be annoying.

Yep running through every webm asset you plan to use through the Asset window so it displays seems to insure any future use will work. Annoying but I can do that before I use stuff with webm placements I suppose.

Also, if you refresh the asset folder you have to go play them all again as the webm data is lost by the refresh.

SilentRuin
July 27th, 2023, 19:54
So was this put on the schedule to be fixed soon or deep sixed?

Moon Wizard
July 27th, 2023, 20:17
It's on our list, but @pindercarl is in the midst of a big integration project and the fix is non-trivial.

Regards,
JPG

SilentRuin
July 28th, 2023, 15:32
It's on our list, but @pindercarl is in the midst of a big integration project and the fix is non-trivial.

Regards,
JPG

Sounds good. If you guys have a better workaround than the partial one that "mostly sometimes works" I came up with let me know [Workaround: going into Assets subdirectory with ones I use and searching for webm and making sure I get all of them to run in assets window at least once.]

SilentRuin
October 25th, 2023, 05:31
I'll chat with John when he gets back from vacation. The dimensions of a Webm file aren't known until the first frame is loaded. All of the image functions have a callback to set the scale after the image is loaded. The API functions looks to be setting the scale first.

Any chance this is nearing the "now serving..." on your list? This was last July I mentioned this so I'm just curiuos.

Moon Wizard
October 25th, 2023, 06:04
We are currently focused on the next big feature for images, of which the recent update implemented some of the back-end changes needed. (thus a slightly busier bug fix round with images/tokens)

Regards,
JPG

lugnut22
November 27th, 2023, 17:32
Looking forward to a fix for this webm issue, and happy to hear some of the groundwork has been implemented on the backend. Couldn't get a clear sense from the answer though - is the fix being worked into the this next big feature release for images? Or is the team busy with this next big feature release for images, and will potentially look back into this bug after completion of that release? Just trying to get a sense of timing.

Moon Wizard
November 27th, 2023, 18:38
We do not have a timeline for working on this because it is quite a bit of work for limited impact. It does not affect standard WEBM token/paint usage; it only affects the API usage. Are you working with the APIs?

Regards,
JPG

SilentRuin
November 27th, 2023, 23:23
We do not have a timeline for working on this because it is quite a bit of work for limited impact. It does not affect standard WEBM token/paint usage; it only affects the API usage. Are you working with the APIs?

Regards,
JPG

Likely working with an extension that uses the API - generic actions layer being one such.

Moon Wizard
November 27th, 2023, 23:59
The user has exactly one post, so I'm trying to get a feel for their situation before assuming anything. If they're a new user, they may be looking at basic functionality and thinking there is something to be done.

Regards,
JPG

MrDDT
May 6th, 2024, 18:45
Is this still not being looked at?
Has a way been found to allow access to this API without the bugs with WEBM?

pindercarl
May 6th, 2024, 18:56
Is this still not being looked at?
Has a way been found to allow access to this API without the bugs with WEBM?

I'm looking at this as part of the work I am currently doing.

MrDDT
May 6th, 2024, 19:51
Awesome thank you!

Vass_Dts
May 6th, 2024, 21:14
There is a portion of us users (that I have no way of knowing how large it is), that can't wait for this to be fixed so we can finally have reliable animated spell effects via Ruin and B9's extensions.

SilentRuin
May 6th, 2024, 23:39
There is a portion of us users (that I have no way of knowing how large it is), that can't wait for this to be fixed so we can finally have reliable animated spell effects via Ruin and B9's extensions.

Good luck - we will be coming up on the year anniversary of this report. I've given up on it getting fixed and just live with it.

MrDDT
May 7th, 2024, 00:57
There is a portion of us users (that I have no way of knowing how large it is), that can't wait for this to be fixed so we can finally have reliable animated spell effects via Ruin and B9's extensions.

Also I think it’s hard for people to justify using this APi when it’s not working haha