Skip to content

Instantly share code, notes, and snippets.

@timoschwarzer
Created October 28, 2016 22:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timoschwarzer/62b6c9869fdd7eab33ee805e4040fbf9 to your computer and use it in GitHub Desktop.
Save timoschwarzer/62b6c9869fdd7eab33ee805e4040fbf9 to your computer and use it in GitHub Desktop.
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp
index b0e002b..288a631 100644
--- a/tools/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp
@@ -3197,6 +3197,7 @@ void CanvasItemEditor::_bind_methods() {
ObjectTypeDB::bind_method("_viewport_draw",&CanvasItemEditor::_viewport_draw);
ObjectTypeDB::bind_method("_viewport_input_event",&CanvasItemEditor::_viewport_input_event);
ObjectTypeDB::bind_method("_snap_changed",&CanvasItemEditor::_snap_changed);
+ ObjectTypeDB::bind_method("get_canvas_transform_matrix",&CanvasItemEditor::get_canvas_transform_matrix);
ObjectTypeDB::bind_method(_MD("_selection_result_pressed"),&CanvasItemEditor::_selection_result_pressed);
ObjectTypeDB::bind_method(_MD("_selection_menu_hide"),&CanvasItemEditor::_selection_menu_hide);
@@ -3293,6 +3294,9 @@ void CanvasItemEditor::focus_selection() {
_focus_selection(VIEW_CENTER_TO_SELECTION);
}
+Matrix32 CanvasItemEditor::get_canvas_transform_matrix() {
+ return transform;
+}
CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.h b/tools/editor/plugins/canvas_item_editor_plugin.h
index 9f4bc46..c8c7159 100644
--- a/tools/editor/plugins/canvas_item_editor_plugin.h
+++ b/tools/editor/plugins/canvas_item_editor_plugin.h
@@ -166,6 +166,8 @@ class CanvasItemEditor : public VBoxContainer {
HBoxContainer *hb;
Matrix32 transform;
+ Matrix32 get_canvas_transform_matrix();
+
float zoom;
Vector2 snap_offset;
Vector2 snap_step;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment