Closed JMY1000 closed 8 years ago
I've read this a few times but am not understanding. Please give a concrete example.
@erich666 It's not important from the Mineways side of things, only from the CyclesMineways. If there's another material that exists for some other reason (like being added by the user), even if it shouldn't be modified by CyclesMineways, due to the current programming, it's possible that it gets modified anyways.
Have you tried this out? the code:
if (material.active_texture and len(material.active_texture.name)>=2 and material.active_texture.name[0:2]=="Kd"):
is the protection I put in a while ago.
It works by first checking if "material.active_texture" exists, so the rest of the code doesn't error out. Then it checks to see if the name is >= to 2 length, then if checks if it starts with "Kd". Mineways materials all seem to have "Kd.
Normal Blender users won't use this as it's more of a blender internal engine thing (it is also what controls the "texture view" in blender). For a user to accidentally have their material changed by the script, they would either need to set their own active_texture to something that starts with "Kd"(which is very hard to do accidentally) or copy and paste a Mineways object (untested).
Currently there's not really a great system for checking to see if any given material is related to Mineways or something else that just exists in the scene. Adding some form of checks to help with that beyond what exists would be good.