PDA

View Full Version : Widgets naturally blurry



Meanmelter
January 31st, 2021, 23:20
Hey all,

I have been working on several custom features for my custom universe, and I have been primarily testing my extension on the Starfinder ruleset.
One thing I have been working on is a brand new health bar that displays horizontally above the tokens.
I have gotten it to finally work and started implementing my own custom health bar over the pre-existing one that comes in Core-RPG, however it is always blurry. If I remove several features of the code '.setClipRegion, .setSize, .setPosition' it always comes out as a blurry health bar despite being a pixel image. I tested this by rotating the pre-existing health bar and noticed it too is blurry, in-fact the default health bar is blurry compared to the actual file!
I use some big tokens (Most are 256, though some are 512) and I have tried different grid sizes (25,50,100,200) but regardless it seems the health bars always come out blurry

Here is the default health bar zoomed into a token I found in the rules asset, notice how blurry the green bar is up until the end where it cuts off. This is without any additional extensions but the base SFRPG and grid size 100x100
43383
Here is the same situation, grid size 200x200
43386
Here is the health bar zoomed in >500% using nomacs, crisp and clean bar. Note the bar is 20x200px
43384

I think there must be some kind of scaling done on the back end? I have made a custom health bar below token_healthbar_fgu.png in attachments, which is a horizontal 200x20 bar that when displayed horizontally, with setSize(200, 20) will appear larger than the token on a 200x200 grid. I also have my token "auto-scale to grid" feature turned off, but it seems that does the same as 100% to grid as the tokens always scale to grid size.

Code here for custom bar

function TokenManager.updateHealthBarScale(tokenCT, nPercentWounded)
Debug.console("Using new updateHealthBarScale");
local widgetHealthBar = tokenCT.findWidget("healthbar");
if widgetHealthBar then
Debug.console("widgetHealthBar confirmed widget exsits");
if UtilityManager.isClientFGU() then
Debug.console("Confirmed client is FGU");
local extensionBar = OptionsManager.getOption("THBE"); --New option menu to confirm ON/OFF, toggles horizontal/vertical bar
Debug.console(extensionBar);
-- Extension bar is loaded
if extensionBar == "on" then
Debug.console("Extension bar loaded");

--local nBarw, nBarh = tokenCT.getSize();
local nBarw = 200
local nBarh = 20

-- This only applies if token scale is 80% in the options menu
local sOptTASG = OptionsManager.getOption("TASG");
if sOptTASG == "80" then
Debug.console("Applying %80 shrink")
barw = nBarh * 0.8;
barh = nBarw * 0.8;
end
--widgetHealthBar.setClipRegion(0,0,100-nPercentWounded*100,100);
widgetHealthBar.setSize(nBarw, nBarh);
widgetHealthBar.setPosition("top", 0, -5);

damned
February 1st, 2021, 01:06
There are quite a few issues with scaling of Widgets on large tokens...

Meanmelter
February 1st, 2021, 05:57
There are quite a few issues with scaling of Widgets on large tokens...

Is there a recommended size? I tried with some new 50x50/128x128 tokens on 50x50/128x128 and still ran into this weird blur. I also resized the health bar from scratch so it would remain crisp on said tokens.

However, I would like to also report, that it would seem that .BMP widgets are much less blurry all around! Not entirely blur-proof, but much less noticeable. I wonder if maybe whatever handles the images has some kind of weird setting in it? I tried to do a search in the Core-RPG files but I could not locate anything of importance.

Meanmelter
February 6th, 2021, 07:24
Good news
43502
Just scale whatever your pixel widget is by 500% :)
You can scale larger for an even sharper look. The image above is 500%