-- helper to pop-up an error dialog local function showError(text) octane.gui.showDialog { type = octane.gui.dialogType.BUTTON_DIALOG, icon = octane.gui.dialogIcon.WARNING, title = "Daylight Animation Error", text = text, } end 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 local function reloadMeshGroupsAsMaterials() -- get the selected mesh local selected = octane.project.getSelection()[1] if not selected or selected.type ~= octane.NT_GEO_MESH then showError("no mesh selected") return nil end -- get the file path for the mesh local objFileName = octane.node.getAttribute( selected , 29 ) --print (objFileName ) updateFileData(objFileName) --reload mesh octane.node.setAttribute(selected, 94, true, true) end reloadMeshGroupsAsMaterials()