Modify existing script: apply it ONLY to selected objects?
I have a script that maps bitmap textures to objects in scene based on object name. My problem is that when I run it, ALL objects in the scene with the name "PlaneXXX" get remapped with images in the script's current path. I would like to modify it so that only the selected ones get remapped.
(I have played with "for obj in selection do" - such as putting it outside the "for object in selection" loop and integrating it into the "for p in $Plane*" line, but no luck.)
( local img_path = "C:/Users/Stenrik/rest/of/the/path/" for p in $Plane* do ( addModifier p (uvwMap()) convertToMesh p local num = substring p.name (p.name.count - 2) p.name.count local mat = standardMaterial() mat.diffuseMap = bitmapTexture filename:(img_path + "Diffuse" + num + ".png") mat.opacityMap = bitmapTexture filename:(img_path + "Alpha" + num + ".png") p.material = mat ) )