I want to create a copy of a loaded (static) model, including it’s material, so that I can change the color in the copy’s material. How do I accomplish this?
The reason this is necessary is that you are locating the material with a find_material() call, which automatically searches all child nodes of wall. Presumably it has found the material in question from a child node. That means you need to replace the material by setting the new one on the same child node, otherwise the child node’s original material setting will override whatever you assign to wall, the parent node.
Unless, of course, you use an override value, which is my suggested change. The override value ,1 in this case means to force the material to apply to all child nodes of wall (unless they have a higher override value, which presumably they won’t).
The copy_to() technique will make a copy of all nodes and their properties, but it won’t duplicate out the materials, as you have observed. Note that calling load_model() of the same filename is effectively the same thing as another call to copy_to(), since models are cached internally at each load.