How to render custom mesh i workspace and reload on property change in godot ?

Creating custom mesh in GODOT

1. Add a "Mesh Instance" node to the scene

2. Create a script make sure this instance "extends MeshInstance"

3. You can create custom mesh using 3 different ways 
    Surface tools
    Immediate geometry
    Using array
    you can read more about this here 
    https://docs.godotengine.org/en/3.1/tutorials/content/procedural_geometry.html

4. After you created the mesh attach to node like this  "mesh=st.commit".Note mesh variable already available in the Node.

Rendering and reloading in work space 

Add 'tool' word at the top of the script 
Add line  'export(bool) onready var trigger_generation= false setget GenerateMesh'  at the top
Add function 
    func GenerateMesh(_newval):
if(_newval != trigger_generation):
callMeshGenerationFunction()

If you check the property in the 'trigger_generation' in the property window mesh will be regenerated every time.



Comments

Popular posts from this blog

Auto import Kenny.nl 3d models to Godot using gdscript