Custom 2D nodes

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jptsetung

Note : I’m not currently programming with Godot, I’m just trying it, and want to know how to do the things I was doing before with another engine.

So let’s say I want to make a custom 2D node, a sprite that I can deform. Instead of being defined by 4 vertices (corners), it’s defined by 16 vertices (a grid), and I would like to be able to deform the sprite by moving these vertices in a custom 2D node.
So how would I t do this? No need to enter the details, just want to know if it’s possible, if I could easily reuse this node on my code (or even share with the community?).

:bust_in_silhouette: Reply From: Zylann

It’s possible, you can use tool in a node script to make it execute in editor. I used that feature to do something similar in my game, so I was able to deform it in a shader and see the result without having to run the game :wink:

You can also make it appear in the new node window by writing an editor plugin, among some other things (especially if you want to have control points gizmos): Making Plugins — Godot Engine (3.0) documentation in English

Thx, interesting keywords to search for, I didn’t know about the tool mode.
Can we extend a node/sprite, and override the draw method by script ?

jptsetung | 2018-03-12 10:25

Actually this page tell me how to do it, so yes I probably can do thi! Custom drawing in 2D — Godot Engine (3.0) documentation in English

jptsetung | 2018-03-12 16:23