Continue translating Model to C++.
Return undef from Model::get_material if no material.
Update TODO comment.
Copy some code from model-xs branch

(fixes for set_material and implementation of duplicate_objects_grid).