scenerygraphics / sciview

sciview is a tool for visualization and interaction with ND image and mesh data
BSD 2-Clause "Simplified" License
62 stars 17 forks source link

generateUniqueName is called twice in the open() member function #572

Closed smlpt closed 1 month ago

smlpt commented 2 months ago

Nothing big, but I noticed that here and in a few other places generateUniqueName() is called before passing the node to addNode(), which in turns also calls generateUniqueName() again.

kephale commented 1 month ago

@smlpt i see the code you are pointing at but did you confirm that generateUniqueName() is actually repeatedly called? I did some quick checks with different node types that do call generateUniqueName before going on to call addNode. I didn't see multiple calls to generateUniqueName(). However, I didnt verify with a bdv xml though because i dont have one readily accessible.

smlpt commented 1 month ago

@kephale so when I add an info log to generateUniqueName and add a box to the scene, it logs:

[INFO] generated unique name Box
[INFO] generated unique name Box

When I open an XML-based volume, it also logs:

[INFO] generated unique name C:\Software\datasets\MastodonTutorialDataset1\datasethdf5.xml
[INFO] generated unique name C:\Software\datasets\MastodonTutorialDataset1\datasethdf5.xml

And since most other primitives and file opening operations also call generateUniqueName before calling addNode, I suspect they all call the function twice. I guess it won't make a difference, but it is probably not the intended behavior.

kephale commented 1 month ago

Upps, lol. Yes, when I saw this issue i thought "that should be a quick fix" so i made the fix, then tried to replicate the bug :P