I'm trying, without success, to access the data of a mesh from a MeshInstance node.
I've imported a 3d object, opened it as "New Inherited", turned it as "Unique" and saved it as foo.mesh. Then, on a new scene, I did create a MeshInstance and loaded the foo.mesh as its Mesh.
The Script is attached to the very MeshInstance, kinda like follows:
extends MeshInstance
func _ready():
var themesh = Mesh
var mdt = MeshDataTool.new()
if mdt.create_from_surface(themesh, 0):
print("Ok!!")
print(mdt.get_vertex_count()) # get_vertex_count() returns 0
else:
print("Failed...")