@@ -618,6 +618,9 @@ void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos, Node *p_no
618618 if (CanvasLayer *cl = Object::cast_to<CanvasLayer>(p_node)) {
619619 xform = cl->get_transform ();
620620 } else if (Viewport *vp = Object::cast_to<Viewport>(p_node)) {
621+ if (!vp->is_visible_subviewport ()) {
622+ return ;
623+ }
621624 xform = vp->get_popup_base_transform ();
622625 if (!vp->get_visible_rect ().has_point (xform.xform_inv (p_pos))) {
623626 return ;
@@ -718,6 +721,9 @@ void CanvasItemEditor::_find_canvas_items_in_rect(const Rect2 &p_rect, Node *p_n
718721 if (CanvasLayer *cl = Object::cast_to<CanvasLayer>(p_node)) {
719722 xform = cl->get_transform ();
720723 } else if (Viewport *vp = Object::cast_to<Viewport>(p_node)) {
724+ if (!vp->is_visible_subviewport ()) {
725+ return ;
726+ }
721727 xform = vp->get_popup_base_transform ();
722728 if (!vp->get_visible_rect ().intersects (xform.xform_inv (p_rect))) {
723729 return ;
@@ -797,6 +803,10 @@ List<CanvasItem *> CanvasItemEditor::_get_edited_canvas_items(bool p_retrieve_lo
797803 CanvasItem *ci = Object::cast_to<CanvasItem>(E.key );
798804 if (ci) {
799805 if (ci->is_visible_in_tree () && (p_retrieve_locked || !_is_node_locked (ci))) {
806+ Viewport *vp = ci->get_viewport ();
807+ if (vp && !vp->is_visible_subviewport ()) {
808+ continue ;
809+ }
800810 CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data <CanvasItemEditorSelectedItem>(ci);
801811 if (se) {
802812 selection.push_back (ci);
@@ -3819,6 +3829,9 @@ void CanvasItemEditor::_draw_invisible_nodes_positions(Node *p_node, const Trans
38193829 parent_xform = Transform2D ();
38203830 canvas_xform = cl->get_transform ();
38213831 } else if (Viewport *vp = Object::cast_to<Viewport>(p_node)) {
3832+ if (!vp->is_visible_subviewport ()) {
3833+ return ;
3834+ }
38223835 parent_xform = Transform2D ();
38233836 canvas_xform = vp->get_popup_base_transform ();
38243837 }
@@ -3947,10 +3960,15 @@ void CanvasItemEditor::_draw_locks_and_groups(Node *p_node, const Transform2D &p
39473960
39483961 if (ci && !ci->is_set_as_top_level ()) {
39493962 parent_xform = parent_xform * ci->get_transform ();
3950- } else {
3951- CanvasLayer *cl = Object::cast_to<CanvasLayer>(p_node);
3963+ } else if (CanvasLayer *cl = Object::cast_to<CanvasLayer>(p_node)) {
3964+ parent_xform = Transform2D ();
3965+ canvas_xform = cl->get_transform ();
3966+ } else if (Viewport *vp = Object::cast_to<Viewport>(p_node)) {
3967+ if (!vp->is_visible_subviewport ()) {
3968+ return ;
3969+ }
39523970 parent_xform = Transform2D ();
3953- canvas_xform = cl ? cl-> get_transform () : p_canvas_xform ;
3971+ canvas_xform = vp-> get_popup_base_transform () ;
39543972 }
39553973
39563974 for (int i = p_node->get_child_count () - 1 ; i >= 0 ; i--) {
0 commit comments