0 votes

I want to create a little in-editor tool to let me quickly create objects at my mouse's position. The plan is to make a popup menu appear when i right click with a list of all the objects, then creates the object i select at the position i right clicked. But I'm having a hard time finding the right resources for learning how to make plugins or tool scripts like this. Can someone help me learn the steps i might take to implement this or something similar?

Godot version 3.2.3
in Engine by (243 points)
edited by

2 Answers

0 votes
Best answer

You could get the mouse input over the viewport with this method.
EditorPlugin.forward-canvas-gui-input

Then to draw an overlay where you can select an object you can use
EditorPlugin.forward_canvas_draw_over_viewport(overlay). This method is currently not described in the online documentation but you can find an example in the class ref xml.

by (291 points)
selected by
0 votes

I don't know if this is the actual app that you want to create or a part of your game but.
You want to create a scene, add a popup(this is where you will add your menu) and script it like this -- 'if you click the right mouse button, you want to set the popup position to your global mouse position and then do a popup(). This will manage the mechanics of right click.
for the object etc., Create different buttons that represent the objects you want to add. and add it to the popup. After that, each button has an export (PackedScene) of your object and then if you click that button you will just instance that object into your scene. and add it as a child. done

by (380 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.