Why does snap_spinbox[2].get_value()
and snap_spinbox[3].get_value()
both return 0.01 when they, as snap step values, should return an integer like 64? Is it because I called it all the way from the wrong function (_enter_tree()
), or am I still missing another step, even after snap_dialog.get_ok().emit_signal("pressed")
?
[UPDATE 1] The snap step value will return the intended values after I open the "Configure Snap..." window. Anyone know how to do that via script?
[UPDATE 2] In the end, I stopped getting value from the snapbox. Instead, I created a ConfigFile that stores the snap settings, which would be applied to the snapbox upon _enter_tree()
.
[UPDATE 3] I've tried virtually opening the snap dialog, both by snap_dialog.popup_centered()
and through its parent PopupMenu
.
When I tried the former, the value are all defaults in the variable sense, not snap settings sense. This mean all entries are 0s, with few exceptions being 0.01 due to their range settings. After a few more testing, I've learnt that the snap settings only load after clicking Snapping Options (3 vertical dots icon) > "Configure Snap..."
Now, for the latter, I have to find a PopupMenu
that has 7 items total, and with the last one with the text of "Configure Snap...". This is the code I used to find it:
for c in children:
if c is PopupMenu:
if c.get_item_count() == 7:
if c.get_item_text(6) == "Configure Snap...":
c.get_parent().emit_signal("pressed")
c.emit_signal("index_pressed", 6)
break
However, calling its parent MenuButton
to emit_signal("pressed")
does not caused it to drop down the menu. Neither does calling emit_signal("index_pressed", 6)
from the PopupMenu
causes the SnapDialog to pop up.