function updateFileData(objFile) local f = io.open(objFile, "r") local fileData = f:read("*all") f:close() fileData = fileData:gsub("g (%w+)", "usemtl %1") f = io.open(objFile, "w") f:write(fileData) f:close() --print (fileData) end -- main function body -- get the selected mesh local selectedRt = octane.project.getSelection()[1] if not selectedRt or selectedRt.type ~= octane.NT_GEO_MESH then showError("no mesh selected") return nil end --print (selectedRt) -- get the file path for the mesh local objFileName = octane.node.getAttribute( selectedRt , 29 ) --print (objFileName ) updateFileData(objFileName) --reload mesh octane.node.setAttribute(selectedRt, 94, true, true)