-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Add antialiased, draw outline and line color/width properties to ColorRect #92023
base: master
Are you sure you want to change the base?
Add antialiased, draw outline and line color/width properties to ColorRect #92023
Conversation
a0fc59f
to
f783013
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how to feel about several things:
- Back in 4.0 alpha, a PR was closed which pretty much would've done this (see Add
filled
,border_width
,editor_only
properties to ColorRect #65549 (comment) for reasoning). Years have passed and opinions may have changed, but have they, and why? - I don't think the new
draw_background
anddraw_outline
are necessary. On the surface, the same effect can be achieved by setting them to a fully transparent Color, which is pretty trivial to do both in the editor and in code.- I've never seen anyone request
draw_background
, but I may be completely mistaken.
- I've never seen anyone request
- "Outline" VS. "line", I am not sure which is true here.
"Outline" implies it's being drawn outside of the edges, but I assume that the line is actually drawn covering the edges and expanding both inside and outside. - Because
antialiased
and negativeline_width
are undesirable together, and I can easily see an user pressing buttons until something looks nice, a configuration warning could be nice. - All the new documentation descriptions are welcome of course, but they're a bit rough. One thing at the time.
</brief_description> | ||
<description> | ||
Displays a rectangle filled with a solid [member color]. If you need to display the border alone, consider using a [Panel] instead. | ||
Displays a rectangle filled with a solid [member color]. See also [ReferenceRect] for an alternative designed for UI debugging. | ||
[b]Tip:[/b] By having a [ColorRect] span the entire viewport, it can be used to create 2D post-processing shaders using a shader of type [code]canvas_item[/code] on the node. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
It makes sense for this context type to exist but at the same time, it is rarely if ever used by the class reference, so I wonder if it's worth setting a precedent for it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find most class descriptions to be pretty short already, so it doesn't hurt much to add this kind of information.
…rRect This exposes recently-added CanvasItem functionality to the ColorRect node, so that custom drawing methods don't need to be called if you want to benefit from antialiasing or non-filled rects. The outline is drawn on top of the background, which can also now be disabled.
f783013
to
0c239bd
Compare
circle
,rect
,multiline
, anddashedline
#84523.This exposes recently-added CanvasItem functionality to the ColorRect node, so that custom drawing methods don't need to be called if you want to benefit from antialiasing or non-filled rects.
The outline is drawn on top of the background, which can also now be disabled.
A similar approach could be used to expose functionality such as drawing circles and regular polygons, although this may make more sense as an extension of the Polygon2D node instead (since ColorRect is all about rectangles).
Testing project: test_color_rect.zip
Preview