Real time update of procedural geometry

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

I’d like to generate my geometry procedurally, I wrote the following code:

tool

extends Polygon2D


func _ready():
	var points = PoolVector2Array()
	points.append(Vector2(0, 0))
	points.append(Vector2(10, 0))
	points.append(Vector2(10, 10))
	points.append(Vector2(0, 10))
	self.polygon = points

func _process(delta):
	pass

It works in game, and also in the editor. But for the changes to appear in the editor, I need to restart it.

What I’d like is to have the code reloaded and re-executed each time it changes on disk without my intervention.

I have a lot of procedural geometry I need to adjust, and for this I’d like to see the changes I make to my code in real time.

By restart you mean revert right? Saving the scene, and then hit the revert button. That’s how I know how to update tool scripts.

SIsilicon | 2018-05-10 17:18

No I mean close the editor and restart it. Didn’t know it could work other way.

Nicolas Goy | 2018-05-10 22:06

The more you know
I guess that’ll count as an answer.

SIsilicon | 2018-05-11 01:36

:bust_in_silhouette: Reply From: SIsilicon

By restart you mean revert right? Saving the scene, and then hit the revert button. That’s how I know how to update tool scripts.

Vote n’ Select. :smiley:

Now what I want is the scene to revert itself automatically everytime the script file changes on disk.

Nicolas Goy | 2018-05-11 20:12

Don’t think that’s a feature. Wish it was :frowning:
You could go to Godot github issues, and add a feature proposal.

SIsilicon | 2018-05-11 22:16

:bust_in_silhouette: Reply From: Nicolas Goy

I found a way to have the workflow I want.

I need to check the “Sync Script Changes” under the debug menu, and I can have reload on file change while playing the game.

While working on the script, the geometry needs to be created in _process instead of _ready. Of course this is not optimal in term of performances, but it works.

Optimally, I’d like this behavior in the editor without having to change the script, but having it in the played scene works and is a start.