summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-03-13 17:18:42 +0100
committerGitHub <noreply@github.com>2022-03-13 17:18:42 +0100
commit972bca75a82c16f4f2f4c5f770632c9cb65c444d (patch)
treef1de1645da507b064ebc01b5c1bc1947fad39fd3
parent0dc6dab28deb9fab467ea75197cae3a970de6f81 (diff)
parenta0e720efb2fffd7869517f3d0348f54b09dc3385 (diff)
Merge pull request #59107 from otonashixav/expose-add-animation-slice
-rw-r--r--doc/classes/RenderingServer.xml11
-rw-r--r--servers/rendering_server.cpp1
2 files changed, 12 insertions, 0 deletions
diff --git a/doc/classes/RenderingServer.xml b/doc/classes/RenderingServer.xml
index 50990b5320..213dafa074 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.
</description>
</method>
+ <method name="canvas_item_add_animation_slice">
+ <return type="void" />
+ <argument index="0" name="item" type="RID" />
+ <argument index="1" name="animation_length" type="float" />
+ <argument index="2" name="slice_begin" type="float" />
+ <argument index="3" name="slice_end" type="float" />
+ <argument index="4" name="offset" type="float" default="0.0" />
+ <description>
+ 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.
+ </description>
+ </method>
<method name="canvas_item_add_circle">
<return type="void" />
<argument index="0" name="item" type="RID" />
diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp
index d34fd572ad..a6992014e8 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);