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

color HSV constructor #15782

Closed
BlenderNPR opened this issue Jan 16, 2018 · 6 comments
Closed

color HSV constructor #15782

BlenderNPR opened this issue Jan 16, 2018 · 6 comments

Comments

@BlenderNPR
Copy link

BlenderNPR commented Jan 16, 2018

There are hsv member variables in Color type, yet there is no constructor to put hsv into use.
Facing this problem:
color(1,1,1,1) << in rgba
color(1,1,1,1) << in hsva?

Need hsv constructor, please. Thank 😁

HSV is more intuitive compared to RGB.

@groud
Copy link
Member

groud commented Jan 16, 2018

You already have a set_hsv() function, we cannot define two constructors with the same signature.

@vnen
Copy link
Member

vnen commented Jan 16, 2018

color(1,1,1,1) << in rgba
color(1,1,1,1) << in hsva?

The problem is how to differentiate between the two? It's impossible to use the same constructor. Though we have Color8 and ColorN constructors, maybe we can have ColorHSV?

@groud
Copy link
Member

groud commented Jan 16, 2018

maybe we can have ColorHSV?

It would make sense IMO.

@akien-mga
Copy link
Member

akien-mga commented Jan 16, 2018

The problem with Color8, ColorN and ColorHSV is that they're hacky GDScript-specific methods. It would be better to have proper static constructors like Color Color.from_hsv(h, s, v) and Color Color(String name, float alpha=1.0). See also #15435 and #14704.

@vnen
Copy link
Member

vnen commented Jan 16, 2018

It would be better to have proper static constructors like Color Color.from_hsv(h, s, v) and Color Color(String name, float alpha=1.0).

I agree. The problem is more fundamental because built-in types don't have static functions. I'm not sure if there's a hard limitation for that, but that's what happens currently.

@akien-mga
Copy link
Member

Fixed by #15852.

@akien-mga akien-mga added this to the 3.1 milestone Feb 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants