defold / defold/defold

Editor Outline: Dragging and dropping some nodes to the parent's parent produces incorrect `:node-id-paths`

Open
#11,755 0 comments 0 reactions 0 assignees View on GitHub
bug editor
Dominant language
C++
Stars
6.3k
Forks
455
Avg merge
1d 19h
Merged PRs (30d)
130

Description

In this test scenario, I can drag almost all the text nodes and drop them into the `Nodes` node and the node-id-paths seem to work correctly, except for this little guy highlighted in the screenshot

Image

The way that I realized this was happening is because this `ext-with-tree-view-props` extension handles scrolling to an item when we have lost visibility on it after dragging it into another node. The reason it's failing though is because there's a check to make sure that the old and new selected node-id-paths are different. So for all other nodes it seems to be generating a new node-id-path but not for this particular one.

```clojure
(def ^:private ext-with-tree-view-props
(fx/make-ext-with-props
(assoc fx.tree-view/props
:selected-node-id-paths
(fx.prop/make
(fx.mutator/setter
(fn set-selected-node-id-paths [^TreeView tree-view [new-selected-node-id-paths _key]]
(let [selection-model (.getSelectionModel tree-view)
old-selected-node-id-paths (coll/transfer (.getSelectedItems selection-model) #{}
(keep #(some-> % TreeItem/.getValue :node-id-path)))]
(when-not (= old-selected-node-id-paths new-selected-node-id-paths)
;; WE DON'T REACH THIS
))))
fx.lifecycle/scalar))))
```

In this sample project, go to the main.collection and expand all of the nodes and boxes in j-GUI -> overlays. Also expand gameobjects elsewhere in the hiearchy. Drag text1, text2, text3, etc; into `Nodes`, they should succeed, but `text6` should not.

Defold Version 1.12.0

OS: Fedora Linux 42 (Workstation Edition) x86_64
Kernel: Linux 6.17.4-200.fc42.x86_64
DE: qtile
WM: LG3D (X11)
CPU: AMD Ryzen 9 5900HS (16) @ 4.68 GHz
GPU 1: NVIDIA GeForce GTX 1650 Mobile / Max-Q [Discrete]
GPU 2: AMD Radeon Vega Series / Radeon Vega Mobile Series [Integrated]
Memory: 11.04 GiB / 15.03 GiB (73%)
Disk (/): 312.93 GiB / 952.28 GiB (33%) - btrfs

[Tinyswords2.zip](https://github.com/user-attachments/files/24673030/Tinyswords2.zip)

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue in main.collection by expanding j-GUI -> overlays and the other gameobjects, then drag text1, text2, text3 and text6 into Nodes. Start with the ext-with-tree-view-props code shown in the report and compare the selected node-id-paths for text6 and the working nodes. Done means the drop produces the correct new path and the visibility-scrolling behavior is triggered.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
desktop, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.