diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index 56b1b05595bf..ccfb6dc01d75 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -408,7 +408,7 @@ class CanvasItemEditor : public VBoxContainer { bool _is_node_movable(const Node *p_node, bool p_popup_warning = false); void _find_canvas_items_at_pos(const Point2 &p_pos, Node *p_node, Vector<_SelectResult> &r_items, const Transform2D &p_parent_xform = Transform2D(), const Transform2D &p_canvas_xform = Transform2D()); void _get_canvas_items_at_pos(const Point2 &p_pos, Vector<_SelectResult> &r_items, bool p_allow_locked = false); - + void _find_canvas_items_in_rect(const Rect2 &p_rect, Node *p_node, List *r_items, const Transform2D &p_parent_xform = Transform2D(), const Transform2D &p_canvas_xform = Transform2D()); bool _select_click_on_item(CanvasItem *item, Point2 p_click_pos, bool p_append); diff --git a/scene/2d/skeleton_2d.cpp b/scene/2d/skeleton_2d.cpp index cf6ed2eb4a09..ae31305c7470 100644 --- a/scene/2d/skeleton_2d.cpp +++ b/scene/2d/skeleton_2d.cpp @@ -283,11 +283,12 @@ bool Bone2D::_editor_get_bone_shape(Vector *shape, Vector *out Vector2 rel; if (other_bone) { rel = (other_bone->get_global_transform().get_origin() - get_global_transform().get_origin()); + rel = rel.rotated(-get_global_rotation()); // Undo Bone2D node's rotation so its drawn correctly regardless of the node's rotation } else { float angle_to_use = get_rotation() + bone_angle; rel = Vector2(cos(angle_to_use), sin(angle_to_use)) * length; + rel = rel.rotated(-get_rotation()); // Undo Bone2D node's rotation so its drawn correctly regardless of the node's rotation } - rel = rel.rotated(-get_rotation()); Vector2 relt = rel.tangent().normalized() * bone_width; Vector2 reln = rel.normalized(); @@ -475,6 +476,14 @@ Bone2D::Bone2D() { } } +Bone2D::~Bone2D() { +#ifdef TOOLS_ENABLED + if (!editor_gizmo_rid.is_null()) { + RenderingServer::get_singleton()->free(editor_gizmo_rid); + } +#endif // TOOLS_ENABLED +} + ////////////////////////////////////// bool Skeleton2D::_set(const StringName &p_path, const Variant &p_value) { diff --git a/scene/2d/skeleton_2d.h b/scene/2d/skeleton_2d.h index bf69ea0740b2..6531c022161a 100644 --- a/scene/2d/skeleton_2d.h +++ b/scene/2d/skeleton_2d.h @@ -95,6 +95,7 @@ class Bone2D : public Node2D { #endif // TOOLS_ENABLED Bone2D(); + ~Bone2D(); }; class SkeletonModificationStack2D;