Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | AaronWizard |
Background: I have a node that extends Node2D that’s meant to have custom position snapping in the 2D scene editor. I use an editor plugin to control how the node is positioned after it’s dragged with the mouse or nudged with the arrow keys. I’m now trying to figure out how to control the node’s position during editing when one is added to the scene by dragging it from the FileSystem window to the 2D scene editor.
I’m trying to get a node’s position when it’s initialized in the editor by drag-and-drop. I’ve tried accessing it in the node’s _ready
and in _enter_tree
functions (with the node’s script set to tool mode) but these seem to be called before you’ve finally dropped the node into the scene, so those functions always report (0, 0). I’ve also tried using an editor plugin that handles the node’s class, but none of its functions seem to be called when the node is first initialized.
How else may I access the node’s final position on drag-and-drop initialization, if possible?