Godot-proposals: Add instance at cursor

Created on 3 Feb 2020  路  9Comments  路  Source: godotengine/godot-proposals

Describe the project you are working on:
2D game with lots of different custom nodes.

Describe the problem or limitation you are having in your project:
I instance scenes a lot. Well, this is pretty common, lots of users asked for "scene tiles". But I don't even use TileMaps, so I instance nodes manually anyways. I even bound a shortcut to Instance Child Scene to quickly spawn scenes. My problem is that the instances all always created at the origin. You can of course drag and drop from file system at desired position, but due to sheer amount of different scenes and the way my files are organized, this is non-viable. It's much easier for me to press shortcut, fuzzy-search the scene name and press Enter. But then I need to move the node from (0, 0) to positions like (1200, 4600), which wastes my time.

Describe how this feature / enhancement will help you overcome this problem or limitation:
Would be cool if we had an option to instance a scene at the cursor position. Could be with Ctrl + Click or maybe then Selection List could be utilized (like, showing Add Instance on top of node list, dunno).

Show a mock up screenshots/video or a flow diagram explaining how your proposal will work:
image
image
image
(actually, it would be useful to have there "Add Child node" too)

Describe implementation detail for your proposal (in code), if possible:
It's basically Instance Child Scene, but called from 2D viewport and positioning the node at cursor.

If this enhancement will not be used often, can it be worked around with a few lines of script?:
It _might_ be possible to replicate the node selection dialog and add a CanvasEditor plugin to do that, but I imagine it would be really cumbersome. Although if the quick open dialog was exposed to plugins... Still, that's more than few lines.

Is there a reason why this should be core and not an add-on in the asset library?:
Not sure how many people have similar problem, but I can't be the only one (_;_;_). And it's a probably small QoL thing using already existing functionality in a way impossible for custom plugins.

editor

Most helpful comment

I've started a paint mode plugin for 3D. I know there are existing 'scatter' plugins but I believe what people are looking for here is a simple single-object click-to-place functionality. https://github.com/mnemoli/godotplacer (There are a lot of things I would do differently if this were integrated into the engine code - for example, I'd like it to be an actual _tool_, but it looks like the tool set is not currently extendable via plugins.)

Unity and UE4 do not come with this functionality built-in. I think it'd really give Godot a productivity edge if we did have something like this in the main engine.

All 9 comments

+1. I am working on a space game at a realistic scale, so you can guess stuff's placed really far from origin.
Requesting similar thing for 3D, too. The distances involved aren't quite as large, but still, having to move stuff manually from origin when you have a playing field of 500x500 metres or so is a pain.

but due to sheer amount of different scenes and the way my files are organized, this is non-viable.

You can favorite them, that's what I do when I need to instance a scene often.
Also, a plugin like Scene Scattering Tool for 2D would solve this as well, maybe I'll look into making it.

You can favorite them

And have hundreds of favorites? Well, I could only favorite the scenes I need _right now_, but there are some scenes I need pretty much always and I'd have to favorite/unfavorite other scenes a lot. That sounds really messy.

Although I never used favorites besides favorite nodes, I'll try it at least...

Yeah, favorites get really clumsy when you have more than ten, but if you only have a few it works really great.

Maybe we could implement a "paint mode" ? Where you could select a scene and instantiate it in one click on the viewport ? That could help in games where you have a lot of collectible to place on the screen.

Maybe we could implement a "paint mode" ? Where you could select a scene and instantiate it in one click on the viewport ?

Could be useful, but we'd also need a preview of where the instance will be placed (obviously).

Also I just realized this could be useful for built-in nodes, not only instances. I just had to create a Node2D and move it very long distance :I (with no other node to use reparenting trick). I'll update the OP.

@groud

Maybe we could implement a "paint mode" ? Where you could select a scene and instantiate it in one click on the viewport ?

I feel like this and some sort of easy-to-use grid placing of elements, complete with a layer system, would effectively fix a lot of people's problems with TileMap/GridMap by migrating the features people expect out of those nodes to the engine as a whole. I could easily imagine having a more Tiled or GameMaker: Studio like experience of painting instances into the world in specific grid locations (toggleable versus world space) and being able to create layers of elements without having to parent them under a specific node. Editor-level node groups would go a long way towards that since you'd be able to filter by group. There's already a WIP PR for adding editor-time global groups too.

Edit: I should probably convert this itself into an alternative proposal that could supercede a number of other proposals/Issues if done correctly.

Although I never used favorites besides favorite nodes, I'll try it at least...

After some time of using favorites, I started to get lost in the list (17 right now). The problem is that they are really messy. There are some scenes I instance less frequently, but I still need them now and then. Also I often add something new, or add something temporarily, because I need it now and then almost not anymore. It makes it hard to sort the favorites, also it became hard to distinguish them and find the one I look for (some custom icons would be helpful there).

tl;dr I just confirmed that using favorites is not a viable alternative

I've started a paint mode plugin for 3D. I know there are existing 'scatter' plugins but I believe what people are looking for here is a simple single-object click-to-place functionality. https://github.com/mnemoli/godotplacer (There are a lot of things I would do differently if this were integrated into the engine code - for example, I'd like it to be an actual _tool_, but it looks like the tool set is not currently extendable via plugins.)

Unity and UE4 do not come with this functionality built-in. I think it'd really give Godot a productivity edge if we did have something like this in the main engine.

Was this page helpful?
0 / 5 - 0 ratings