This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+2 votes

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,286 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

+5 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,286 points)

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

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 Frequently asked questions and 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 [email protected] with your username.