diff options
author | Andrii Doroshenko (Xrayez) <xrayez@gmail.com> | 2020-01-08 20:21:30 +0200 |
---|---|---|
committer | Andrii Doroshenko (Xrayez) <xrayez@gmail.com> | 2020-07-01 18:09:11 +0300 |
commit | 851c1050b23d2f0b336e6fd3891d97fcd37e8c76 (patch) | |
tree | ef02fbf234cd34c6b12d05988ec83697ddf42e11 | |
parent | 8a484756de0d66aa91da7975672234d58ca31d7d (diff) |
Provide `draw_set_transform` defaults for rotation and scale
-rw-r--r-- | doc/classes/CanvasItem.xml | 4 | ||||
-rw-r--r-- | scene/main/canvas_item.cpp | 2 | ||||
-rw-r--r-- | scene/main/canvas_item.h | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml index b3a3722836..be361f93f3 100644 --- a/doc/classes/CanvasItem.xml +++ b/doc/classes/CanvasItem.xml @@ -285,9 +285,9 @@ </return> <argument index="0" name="position" type="Vector2"> </argument> - <argument index="1" name="rotation" type="float"> + <argument index="1" name="rotation" type="float" default="0.0"> </argument> - <argument index="2" name="scale" type="Vector2"> + <argument index="2" name="scale" type="Vector2" default="Vector2( 1, 1 )"> </argument> <description> Sets a custom transform for drawing via components. Anything drawn afterwards will be transformed by this. diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp index 721f573f39..d1bf038b8d 100644 --- a/scene/main/canvas_item.cpp +++ b/scene/main/canvas_item.cpp @@ -1174,7 +1174,7 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(D_METHOD("draw_mesh", "mesh", "texture", "normal_map", "specular_map", "specular_shininess", "transform", "modulate", "texture_filter", "texture_repeat"), &CanvasItem::draw_mesh, DEFVAL(Ref<Texture2D>()), DEFVAL(Ref<Texture2D>()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(Transform2D()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(TEXTURE_FILTER_PARENT_NODE), DEFVAL(TEXTURE_REPEAT_PARENT_NODE)); ClassDB::bind_method(D_METHOD("draw_multimesh", "multimesh", "texture", "normal_map", "specular_map", "specular_shininess", "texture_filter", "texture_repeat"), &CanvasItem::draw_multimesh, DEFVAL(Ref<Texture2D>()), DEFVAL(Ref<Texture2D>()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(TEXTURE_FILTER_PARENT_NODE), DEFVAL(TEXTURE_REPEAT_PARENT_NODE)); - ClassDB::bind_method(D_METHOD("draw_set_transform", "position", "rotation", "scale"), &CanvasItem::draw_set_transform); + ClassDB::bind_method(D_METHOD("draw_set_transform", "position", "rotation", "scale"), &CanvasItem::draw_set_transform, DEFVAL(0.0), DEFVAL(Size2(1.0, 1.0))); ClassDB::bind_method(D_METHOD("draw_set_transform_matrix", "xform"), &CanvasItem::draw_set_transform_matrix); ClassDB::bind_method(D_METHOD("get_transform"), &CanvasItem::get_transform); ClassDB::bind_method(D_METHOD("get_global_transform"), &CanvasItem::get_global_transform); diff --git a/scene/main/canvas_item.h b/scene/main/canvas_item.h index 31edd424a1..918610ac1e 100644 --- a/scene/main/canvas_item.h +++ b/scene/main/canvas_item.h @@ -348,7 +348,7 @@ public: void draw_string(const Ref<Font> &p_font, const Point2 &p_pos, const String &p_text, const Color &p_modulate = Color(1, 1, 1), int p_clip_w = -1); float draw_char(const Ref<Font> &p_font, const Point2 &p_pos, const String &p_char, const String &p_next = "", const Color &p_modulate = Color(1, 1, 1)); - void draw_set_transform(const Point2 &p_offset, float p_rot, const Size2 &p_scale); + void draw_set_transform(const Point2 &p_offset, float p_rot = 0.0, const Size2 &p_scale = Size2(1.0, 1.0)); void draw_set_transform_matrix(const Transform2D &p_matrix); static CanvasItem *get_current_item_drawn(); |