aboutsummaryrefslogtreecommitdiff
path: root/scene/2d/canvas_item.cpp
diff options
context:
space:
mode:
authorJuan Linietsky2016-08-30 23:44:14 -0300
committerJuan Linietsky2016-08-30 23:46:41 -0300
commitfb4d6d1db0ed0fb8deb530be4b0ae481fb5ba3cd (patch)
tree00e8915abce7590ad63e129d7f15425fe75322c5 /scene/2d/canvas_item.cpp
parent2f0e2a78b5caaf659e078c549682e3d1347f7066 (diff)
downloadgodot-fb4d6d1db0ed0fb8deb530be4b0ae481fb5ba3cd.tar.gz
godot-fb4d6d1db0ed0fb8deb530be4b0ae481fb5ba3cd.tar.zst
godot-fb4d6d1db0ed0fb8deb530be4b0ae481fb5ba3cd.zip
More visual script improvements
-Added anti-aliasing on lines -Improved draw performance enormously -Removed sequence ports for most nodes, current visual scripts will likely be broken now. Sorry!
Diffstat (limited to 'scene/2d/canvas_item.cpp')
-rw-r--r--scene/2d/canvas_item.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index eb4f45797..2555b0fc9 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -650,21 +650,22 @@ int CanvasItem::get_light_mask() const{
}
-void CanvasItem::item_rect_changed() {
+void CanvasItem::item_rect_changed(bool p_size_changed) {
- update();
+ if (p_size_changed)
+ update();
emit_signal(SceneStringNames::get_singleton()->item_rect_changed);
}
-void CanvasItem::draw_line(const Point2& p_from, const Point2& p_to,const Color& p_color,float p_width) {
+void CanvasItem::draw_line(const Point2& p_from, const Point2& p_to,const Color& p_color,float p_width,bool p_antialiased) {
if (!drawing) {
ERR_EXPLAIN("Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal.");
ERR_FAIL();
}
- VisualServer::get_singleton()->canvas_item_add_line(canvas_item,p_from,p_to,p_color,p_width);
+ VisualServer::get_singleton()->canvas_item_add_line(canvas_item,p_from,p_to,p_color,p_width,p_antialiased);
}
void CanvasItem::draw_rect(const Rect2& p_rect, const Color& p_color) {
@@ -1028,7 +1029,7 @@ void CanvasItem::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_is_on_top"),&CanvasItem::_is_on_top);
//ObjectTypeDB::bind_method(_MD("get_transform"),&CanvasItem::get_transform);
- ObjectTypeDB::bind_method(_MD("draw_line","from","to","color","width"),&CanvasItem::draw_line,DEFVAL(1.0));
+ ObjectTypeDB::bind_method(_MD("draw_line","from","to","color","width"),&CanvasItem::draw_line,DEFVAL(1.0),DEFVAL(false));
ObjectTypeDB::bind_method(_MD("draw_rect","rect","color"),&CanvasItem::draw_rect);
ObjectTypeDB::bind_method(_MD("draw_circle","pos","radius","color"),&CanvasItem::draw_circle);
ObjectTypeDB::bind_method(_MD("draw_texture","texture:Texture","pos","modulate"),&CanvasItem::draw_texture,DEFVAL(Color(1,1,1,1)));