0 votes

Hello,
I am trying to modify the vertex colours of a mesh at run time. I am using the MeshDataTool to access the mesh details so that i can change the values. On the desktop it worked fine, however on iOS ( built it on ipad mini 2) it throws an error. The code i am trying to execute is

    var meshData=MeshDataTool.new()
    meshData.create_from_surface(meshNode.get_mesh(),0)
    for vertexIndex in range(meshData.get_vertex_count()):
    meshData.set_vertex_color(vertexIndex,Color(0.5,0,0.5))
    var mesh=Mesh.new()
    meshData.commit_to_surface(mesh)
    meshNode.set_mesh(mesh)

the error log for iOS build
[1;31mERROR: createfromsurface: [0m[1mCondition ' arrays.empty() ' is true. returned: ERRINVALIDPARAMETER
[0;31m At: scene/resources/meshdatatool.cpp:52.[0m
[1;31mERROR: meshaddsurface: [0m[1mCondition ' arraylen==0 ' is true.
[0;31m At: drivers/gles2/rasterizer
gles2.cpp:1877.[0m
[1;31mERROR: add_surface: [0m[1mCondition ' len==0 ' is true.
[0;31m At: scene/resources/mesh.cpp:262.[0m

Is it not possible to use the MeshDataTool on iOS. it runs without any problems on desktop? Is there something else im missing here? meshNode does have a mesh assigned to it. I ran a print(meshNode.getmesh().getsurfacecount()) and it returned 1.
i printed out the surface
getarraylen and it gives the proper value which is 36 in my case.

in Engine by (17 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.