Texture Coordinate Modification Not Working in Rhino 8.0

Dear Rhino Developers,

I’m encountering a critical compatibility issue between Rhino 7.0 and 8.0, and would greatly appreciate your expertise.

Problem Summary:

  • Preconditions: Material and texture axes are properly configured before execution.
  • Project Constraint: I can ONLY modify the mesh’s m_T texture coordinate array .
  • Rhino 7.0: Directly modifying m_T (see code below) successfully updates texture display.
  • Rhino 8.0: Identical code executes without errors, but no visual changes to texture.

Code Snippet (Working in 7.0, Failing in 8.0):

const CRhinoMeshObject* mesh_obj = CRhinoMeshObject::Cast(ob);
if (mesh_obj)
{
    const ON_Mesh* mesh = mesh_obj->Mesh();
    if (mesh)
    {
        ON_Mesh* copy_mesh = mesh->Duplicate();
        if (copy_mesh)
        {
            for (int i = 0; i < copy_mesh->m_T.Count(); i++)
            {
                ON_2fPoint pt(copy_mesh->m_T[i].x * 1.5, copy_mesh->m_T[i].y * 2);
                copy_mesh->m_T[i] = pt;
            }
            RhinoApp().ActiveDoc()->ReplaceObject(mesh_obj, *copy_mesh);
        }
    }
}

Best regards,
Ye

Hi @147026546

If you’re mesh object is already using surface mapping then you only need to modify the m_S array.
Your code already modifies the texture coordinates in the m_T array so it is enough to simply call SetSurfaceParamtersFromTextureCoodinates after those modifications.
And if your object does not already use surface mapping then you need to set one up in order to see the changes. Note that if object does not have any texture mappings then it uses a surface parameter mapping by default.