Hi everyone. I'm going to make script to move node from point a to point b and upon reaching point b go back to point a then to b, to a, to b... just simple moving platform. What i want is draw gizmo. Just cube on point a, cube on point b and line between them. Is possible to draw purely visual(without handles) editor-only gizmo ? Thanks -Garrom

I was looking all around internet (various keywords. Googling up to page 27) but it is not mentioned anywhere. If someone knows, please tell me.

Sure I guess, why not? This might be a starting point:

@Megalomaniak said: Sure I guess, why not? This might be a starting point:

Sounds fine but he said _draw is available only on CanvasItem (and everything what inherit from it). Do you know what to use in 3D where is no CanvasItem ?

Could use MeshInstance to construct your widgets inside of using SurfaceTool and MeshDataTool.

The main focus of that video and the corresponding one on GDQuest channel would be the tool mode.

Might want to also look into plugins development after you have gotten used to building tool logic.

@Megalomaniak said: Could use MeshInstance to construct your widgets inside of using SurfaceTool and MeshDataTool.

The main focus of that video and the corresponding one on GDQuest channel would be the tool mode.

Might want to also look into plugins development after you have gotten used to building tool logic.

Hmm. Can i draw to 3D without needing of additional nodes just like I can draw to 2D ? That would be great !

Not sure I haven't actually tried this. But with some thinking outside the box I'm sure a solution to a problem can always be found.

You can make try and make gizmos by spawning MeshInstance nodes and supplying a mesh or one of the mesh shapes (like the cube, sphere, etc) to it. That's what I did to draw custom gizmos when I made my IK plugin.

Here's the code I used (pulled from the IK addon):

` func _setup_for_editor():

So we can see the target in the editor, let's create a mesh instance,

Add it as our child, and name it

var indicator = MeshInstance.new() add_child(indicator) indicator.name = "(EditorOnly) Visual indicator"

We need to make a mesh for the mesh instance.

The code below makes a small sphere mesh

var indicator_mesh = SphereMesh.new() indicator_mesh.radius = 0.1 indicator_mesh.height = 0.2 indicator_mesh.radial_segments = 8 indicator_mesh.rings = 4

The mesh needs a material (unless we want to use the defualt one).

Let's create a material and use editor_gizmo_texture.png to texture it.

var indicator_material = SpatialMaterial.new() indicator_material.flags_unshaded = true indicator_material.albedo_texture = preload("editor_gizmo_texture.png") indicator_material.albedo_color = Color(1, 0.5, 0, 1) indicator_mesh.material = indicator_material indicator.mesh = indicator_mesh `

@TwistedTwigleg said: You can make try and make gizmos by spawning MeshInstance nodes and supplying a mesh or one of the mesh shapes (like the cube, sphere, etc) to it. That's what I did to draw custom gizmos when I made my IK plugin.

Here's the code I used (pulled from the IK addon):

` func _setup_for_editor():

So we can see the target in the editor, let's create a mesh instance,

Add it as our child, and name it

var indicator = MeshInstance.new() add_child(indicator) indicator.name = "(EditorOnly) Visual indicator"

We need to make a mesh for the mesh instance.

The code below makes a small sphere mesh

var indicator_mesh = SphereMesh.new() indicator_mesh.radius = 0.1 indicator_mesh.height = 0.2 indicator_mesh.radial_segments = 8 indicator_mesh.rings = 4

The mesh needs a material (unless we want to use the defualt one).

Let's create a material and use editor_gizmo_texture.png to texture it.

var indicator_material = SpatialMaterial.new() indicator_material.flags_unshaded = true indicator_material.albedo_texture = preload("editor_gizmo_texture.png") indicator_material.albedo_color = Color(1, 0.5, 0, 1) indicator_mesh.material = indicator_material indicator.mesh = indicator_mesh `

Yes, i know that but this is way that I want avoid. I don't want extra nodes for gizmos but rather render it passively from script like 2D drawing(shown on video). I don't know why, it just does not seems elegant to me.

5 years later