Rename Group Materials
A common workflow for us is to assign materials in softimage with the help of groups. All objects in a group share the same material, which makes material assigning and overriding easy. During the last days I had to select tons of meshes, to group them and to assign a new material to it. Lazy as I am, I have written a script that renames the group material with the groups name. This saves a lot of keyboard write work. Btw, this script works also with partitions – Some people prefer sorting Materials on the top level of SI’s hierarchy.
xsi = Application collSel = xsi.Selection log = xsi.LogMessage for x in range(0,len(collSel)): #log(collSel(x).Type) oType = str(collSel(x).Type) oType2 = oType.replace("#","") log(oType2) if(oType2 == "Partition") or (oType2 == "Group"): log("Group Name: " + str(collSel(x).FullName) + " | Material: " + str(collSel(x).Material)) if(collSel(x).Material == "None"): log("sftools.debug: There is no Material applied to the group") else: oObject = collSel(x).Name oObjectPath = collSel(x).FullName oMaterial = collSel(x).Material oMatLib = collSel(x).Material.Library log(oMatLib) oMat = oMaterial.Name log(oMat) xsi.SetValue(str(oMatLib) + "." + str(oMat) + ".Name", str(collSel(x).Name) , "")