diff options
Diffstat (limited to 'servers')
-rw-r--r-- | servers/visual/rasterizer.h | 2 | ||||
-rw-r--r-- | servers/visual/visual_server_canvas.cpp | 13 | ||||
-rw-r--r-- | servers/visual/visual_server_canvas.h | 2 | ||||
-rw-r--r-- | servers/visual/visual_server_raster.h | 2 | ||||
-rw-r--r-- | servers/visual/visual_server_wrap_mt.h | 2 | ||||
-rw-r--r-- | servers/visual_server.h | 2 |
6 files changed, 23 insertions, 0 deletions
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 49dff0d557..90f2972ddf 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -836,6 +836,7 @@ public: bool clip; bool visible; bool behind; + bool update_when_visible; //VS::MaterialBlendMode blend_mode; int light_mask; Vector<Command *> commands; @@ -1037,6 +1038,7 @@ public: copy_back_buffer = NULL; distance_field = false; light_masked = false; + update_when_visible = false; } virtual ~Item() { clear(); diff --git a/servers/visual/visual_server_canvas.cpp b/servers/visual/visual_server_canvas.cpp index 0b4bbffddf..16cda0326d 100644 --- a/servers/visual/visual_server_canvas.cpp +++ b/servers/visual/visual_server_canvas.cpp @@ -30,6 +30,7 @@ #include "visual_server_canvas.h" #include "visual_server_global.h" +#include "visual_server_raster.h" #include "visual_server_viewport.h" void VisualServerCanvas::_render_canvas_item_tree(Item *p_canvas_item, const Transform2D &p_transform, const Rect2 &p_clip_rect, const Color &p_modulate, RasterizerCanvas::Light *p_lights) { @@ -119,6 +120,10 @@ void VisualServerCanvas::_render_canvas_item(Item *p_canvas_item, const Transfor ci->copy_back_buffer->screen_rect = xform.xform(ci->copy_back_buffer->rect).clip(p_clip_rect); } + if (ci->update_when_visible) { + VisualServerRaster::redraw_request(); + } + if ((!ci->commands.empty() && p_clip_rect.intersects(global_rect)) || ci->vp_render || ci->copy_back_buffer) { //something to draw? ci->final_transform = xform; @@ -390,6 +395,14 @@ void VisualServerCanvas::canvas_item_set_draw_behind_parent(RID p_item, bool p_e canvas_item->behind = p_enable; } +void VisualServerCanvas::canvas_item_set_update_when_visible(RID p_item, bool p_update) { + + Item *canvas_item = canvas_item_owner.getornull(p_item); + ERR_FAIL_COND(!canvas_item); + + canvas_item->update_when_visible = p_update; +} + void VisualServerCanvas::canvas_item_add_line(RID p_item, const Point2 &p_from, const Point2 &p_to, const Color &p_color, float p_width, bool p_antialiased) { Item *canvas_item = canvas_item_owner.getornull(p_item); diff --git a/servers/visual/visual_server_canvas.h b/servers/visual/visual_server_canvas.h index 4d9398a17e..966b51d341 100644 --- a/servers/visual/visual_server_canvas.h +++ b/servers/visual/visual_server_canvas.h @@ -171,6 +171,8 @@ public: void canvas_item_set_draw_behind_parent(RID p_item, bool p_enable); + void canvas_item_set_update_when_visible(RID p_item, bool p_update); + void canvas_item_add_line(RID p_item, const Point2 &p_from, const Point2 &p_to, const Color &p_color, float p_width = 1.0, bool p_antialiased = false); void canvas_item_add_polyline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width = 1.0, bool p_antialiased = false); void canvas_item_add_multiline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width = 1.0, bool p_antialiased = false); diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index a00b364565..7960c5468b 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -574,6 +574,8 @@ public: BIND2(canvas_item_set_visible, RID, bool) BIND2(canvas_item_set_light_mask, RID, int) + BIND2(canvas_item_set_update_when_visible, RID, bool) + BIND2(canvas_item_set_transform, RID, const Transform2D &) BIND2(canvas_item_set_clip, RID, bool) BIND2(canvas_item_set_distance_field_mode, RID, bool) diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h index 3a4d72c793..fcf9b08968 100644 --- a/servers/visual/visual_server_wrap_mt.h +++ b/servers/visual/visual_server_wrap_mt.h @@ -490,6 +490,8 @@ public: FUNC2(canvas_item_set_visible, RID, bool) FUNC2(canvas_item_set_light_mask, RID, int) + FUNC2(canvas_item_set_update_when_visible, RID, bool) + FUNC2(canvas_item_set_transform, RID, const Transform2D &) FUNC2(canvas_item_set_clip, RID, bool) FUNC2(canvas_item_set_distance_field_mode, RID, bool) diff --git a/servers/visual_server.h b/servers/visual_server.h index fd7f96339e..e74df1269a 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -863,6 +863,8 @@ public: virtual void canvas_item_set_visible(RID p_item, bool p_visible) = 0; virtual void canvas_item_set_light_mask(RID p_item, int p_mask) = 0; + virtual void canvas_item_set_update_when_visible(RID p_item, bool p_update) = 0; + virtual void canvas_item_set_transform(RID p_item, const Transform2D &p_transform) = 0; virtual void canvas_item_set_clip(RID p_item, bool p_clip) = 0; virtual void canvas_item_set_distance_field_mode(RID p_item, bool p_enable) = 0; |