Can GDScript be used to lock a node in tool mode?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By avencherus
:warning: Old Version Published before Godot 3 was released.

I’ve been hunting for a way to give a custom plugin node certain attributes of the node it extends, while being unable to affect it’s placement on the canvas in the editor.

If it is something that can be dragged around accidentally, it can become a bit of a source of frustration. It will also be time saving for my node to lock itself upon creation.

My experience with tool mode is just up to breaking everything up to the project manager, but I think you can’t touch the scene editor options like lock selection.

You may be able to add a variable to lock the pos, like, if is locked, when moving it returns to the original pos.

eons | 2016-10-11 16:32

:bust_in_silhouette: Reply From: avencherus

The easiest is to just set the metadata for the node.

node.set_meta("_edit_lock_", true) to lock it.
node.set_meta("_edit_lock_", null) to unlock it.

There is a more complicated/hacky method involving finding the unlock and lock buttons and emitting their button pushed signal after making a temporary selection with the editor selection class.

I know this is a bit late but where do I get a list of all the meta data names? for example, I wanna toggle the selectable icon (the one next to the lock icon) using tool enter image description here

CakeLover | 2022-01-19 10:07