+1 vote

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.

in Engine by (5,169 points)

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.

1 Answer

+3 votes
Best answer

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.

by (5,169 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.