From a0e720efb2fffd7869517f3d0348f54b09dc3385 Mon Sep 17 00:00:00 2001 From: Xavier Loh Date: Sun, 13 Mar 2022 21:25:20 +0800 Subject: [PATCH] Expose `RenderingServer::canvas_item_add_animation_slice` in GDScript --- doc/classes/RenderingServer.xml | 11 +++++++++++ servers/rendering_server.cpp | 1 + 2 files changed, 12 insertions(+) diff --git a/doc/classes/RenderingServer.xml b/doc/classes/RenderingServer.xml index 50990b53203..213dafa074a 100644 --- a/doc/classes/RenderingServer.xml +++ b/doc/classes/RenderingServer.xml @@ -149,6 +149,17 @@ Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. + + + + + + + + + Subsequent drawing commands will be ignored unless they fall within the specified animation slice. This is a faster way to implement animations that loop on background rather than redrawing constantly. + + diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp index d34fd572ad7..a6992014e88 100644 --- a/servers/rendering_server.cpp +++ b/servers/rendering_server.cpp @@ -2580,6 +2580,7 @@ void RenderingServer::_bind_methods() { ClassDB::bind_method(D_METHOD("canvas_item_add_particles", "item", "particles", "texture"), &RenderingServer::canvas_item_add_particles); ClassDB::bind_method(D_METHOD("canvas_item_add_set_transform", "item", "transform"), &RenderingServer::canvas_item_add_set_transform); ClassDB::bind_method(D_METHOD("canvas_item_add_clip_ignore", "item", "ignore"), &RenderingServer::canvas_item_add_clip_ignore); + ClassDB::bind_method(D_METHOD("canvas_item_add_animation_slice", "item", "animation_length", "slice_begin", "slice_end", "offset"), &RenderingServer::canvas_item_add_animation_slice, DEFVAL(0.0)); ClassDB::bind_method(D_METHOD("canvas_item_set_sort_children_by_y", "item", "enabled"), &RenderingServer::canvas_item_set_sort_children_by_y); ClassDB::bind_method(D_METHOD("canvas_item_set_z_index", "item", "z_index"), &RenderingServer::canvas_item_set_z_index); ClassDB::bind_method(D_METHOD("canvas_item_set_z_as_relative_to_parent", "item", "enabled"), &RenderingServer::canvas_item_set_z_as_relative_to_parent);