blackears / cyclopsLevelBuilder

A Godot plugin to let you block in levels inside the Godot editor.
MIT License
1.09k stars 44 forks source link

Unable to select blocks by clicking within the space in the editing interface #177

Open xklse opened 5 months ago

xklse commented 5 months ago

I speculate this may be a common issue with plugins, where third-party nodes cannot be selected

blackears commented 5 months ago

I have plans to redesign this, but it will be a big redesign. Unfortunately there is no easy way to fix this with the way Godot's editor handles things.

blackears commented 5 months ago

You can select nodes in the Scene window. Once one node is selected, it will be possible to select others.

xklse commented 5 months ago

Yes, this issue seems to occur in many nodes involving scene editing. The alternative operation you mentioned is also my current backup process. Besides that, I think the plugin functionality is very good. I look forward to seeing future improvements.

hayahane commented 5 months ago

Running into a similar problem when making custom terrain, do you know how to achieve selectable 3d nodes? At first I thought it is gizmos issue, but after reading the editor code i suspect it's a renderingserver instance issue, which returns nothing when the custom node inherits VisualInstance3D and use setbase internal.

blackears commented 5 months ago

The issue is that a plugin will only accept input events when one of the objects that it manages is selected. So I can't run my selection code unless a CyclopsBlock is already selected.

hayahane commented 5 months ago

I managed to use EditorNode3DGizmoPlugin to solve my problem. I don't know if it will helpful, but I'll post it here.

Godot uses ray intersection to find a visual instance internally. Since a visual instance is not a node at most times, Godot then look up the node which is the base of that instance. After that the editor will try to get it's gizmo and do ray intersection with the collision of the gizmo. So the most important step is to update gizmo's collision_mesh/collision_segment in _redraw virtual function, that's how it a custom node can be selected.

I read some of the code of Cyclops, and it's to complicated for a short-time explore. Maybe using a more standard EditorNode3DGizmoPlugin can solve the problem? I'm not sure.

image

https://github.com/blackears/cyclopsLevelBuilder/assets/39263675/f73c4ebf-555a-4a24-9f4a-77a0990d4306

blackears commented 5 months ago

I looked at EditorNode3DGizmoPlugin back when I started. It only gives you a small selection of handles to work with. It doesn't provide the input even options I need for the more complicated things that Cyclops does.

hayahane commented 5 months ago

Maybe only use this for selection? There seems to be no way to select any node without a valid gizmo attached.

blackears commented 5 months ago

I have something else planned.

hayahane commented 5 months ago

I have something else planned.

Great, looking forward to it!