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

Monitors tab incorrectly reports integers as floats #99577

Closed
clayjohn opened this issue Nov 23, 2024 · 5 comments · Fixed by #99068
Closed

Monitors tab incorrectly reports integers as floats #99577

clayjohn opened this issue Nov 23, 2024 · 5 comments · Fixed by #99068

Comments

@clayjohn
Copy link
Member

Tested versions

  • Reproducible in latest master [0c45ace]

System information

M2 Macbook

Issue description

Values that are always integers are being reported as floats in the editor monitor.

Image

This is technically a regression from #47502

However, #47502 just exposed an underlying flaw in the monitor system: get_monitor() always returns a double

double Performance::get_monitor(Monitor p_monitor) const {

Steps to reproduce

Just look in the monitors tab

Minimal reproduction project (MRP)

N/A - this is native to the Godot editor itself

@carsonetb
Copy link
Contributor

carsonetb commented Nov 23, 2024

Hi!

I'd be interested in trying to fix this issue. I'm not sure if you've already started working on it, but if you haven't and you don't want to, I'd like to take a crack at it.

@clayjohn
Copy link
Member Author

I don't plan on working on this, so go ahead!

@carsonetb
Copy link
Contributor

carsonetb commented Nov 24, 2024

I think the simplest way to fix this issue would be to just check if the number ends with a .0 and if so remove it. I just added a few lines to EditorPerformanceProfiler::_create_label which do this:

default: {
	String ret = TS->format_number(rtos(p_value));
	if (ret.ends_with(".0")) {
		ret = ret.pad_decimals(0);
	}
	return ret;
}

This fixes the issue of integers as floats in the Monitor:

Image

By the way, I don't see how it's a flaw that get_monitor() returns a double. In 4.3 it returned a double but we didn't see the trailing ".0". Anyway, I'll probably create a pull request for this in a bit.

@AThousandShips
Copy link
Member

@clayjohn
Copy link
Member Author

Closing as a duplicate of #99000

@clayjohn clayjohn closed this as not planned Won't fix, can't repro, duplicate, stale Nov 24, 2024
@clayjohn clayjohn removed this from the 4.4 milestone Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants