def askSpecificMaterials(actor): materials = ss6Materials.getMaterialNames(actor) use = [] selector = SelectMaterial(materials) if selector.Show(): use = selector.get() return use
def copyToMatching(exp): actor, material = getSelection() names = ss6Materials.getMaterialNames(actor) use = [] pattern = re.compile(exp, re.I) for name in names: if pattern.search(name): use.append(name) materials = ss6Materials.namesToMaterials(actor, use) copyFrom(material, materials)
def askMatchingMaterials(actor): use = [] dlg = poser.DialogTextEntry(message="""\n\nEnter matching terms.\n\n\nExample: "skin lash" matches\nboth "SkinHead" and "Eyelashes".\n\n\n""") if dlg.Show(): #import pre as re import re import string text = dlg.Text() words = text.split() terms = [] for word in words: terms.append( "(" + re.sub("\W","",word) + ")" ) pattern = re.compile(string.join(terms, "|"), re.I) for name in ss6Materials.getMaterialNames(actor): if pattern.search(name): use.append(name) return use
def askMaterials(actor): methods = ["All materials.", "Material group...", "Specific materials...", "Matching materials...", "Current material."] selector = AskSelectMethod("Include...", methods=methods) if selector.Show(): method = selector.get() if method == methods[0]: return ss6Materials.getMaterialNames(actor) elif method == methods[1]: return askGroup(actor) elif method == methods[2]: return askSpecificMaterials(actor) elif method == methods[3]: return askMatchingMaterials(actor) else: return [poser.Scene().CurrentMaterial().Name()] else: return []
def askMaterials(actor): methods = [ "All materials.", "Material group...", "Specific materials...", "Matching materials...", "Current material." ] selector = AskSelectMethod("Include...", methods=methods) if selector.Show(): method = selector.get() if method == methods[0]: return ss6Materials.getMaterialNames(actor) elif method == methods[1]: return askGroup(actor) elif method == methods[2]: return askSpecificMaterials(actor) elif method == methods[3]: return askMatchingMaterials(actor) else: return [poser.Scene().CurrentMaterial().Name()] else: return []
def askMatchingMaterials(actor): use = [] dlg = poser.DialogTextEntry( message= """\n\nEnter matching terms.\n\n\nExample: "skin lash" matches\nboth "SkinHead" and "Eyelashes".\n\n\n""" ) if dlg.Show(): #import pre as re import re import string text = dlg.Text() words = text.split() terms = [] for word in words: terms.append("(" + re.sub("\W", "", word) + ")") pattern = re.compile(string.join(terms, "|"), re.I) for name in ss6Materials.getMaterialNames(actor): if pattern.search(name): use.append(name) return use
def __init__(self, actor, title="Group Editor", width=500, height=400, useDict=None): path = os.path.join(DIR_TEMP,"groupEditor.xml") self.actor = actor self.title = title self.width = width self.height = height self.suppressError = 0 if useDict: self.preset = useDict else: self.preset = ss6Materials.getPreset(self.actor) self.presetPath = ss6Materials.getPresetPath(self.actor) self.all_groups = self.preset.keys() self.all_groups.sort() self.all_materials = ss6Materials.getMaterialNames(actor) self.action = 0 xmlManager = PzrWidgetList(xmlFormatPath(path), PSDFiles=["./runtime/ui/26000_utility.psd","./runtime/python/poseworks/shaderspider/data/12000_groupEditor.psd"]) self.radioPane = PzrRadioPane(itemsPerCol=15) try: self.radioPane.var = self.all_groups[0] except: self.radioPane.var = -1 for group in self.all_groups: self.radioPane.AddRadiobutton(group) self.actSave = "Save and Exit" self.actNewGroup = "New Material Group" self.actEdit = "Edit Selected Group" self.actDelete = "Delete Selected Group" self.actions = [self.actSave, self.actNewGroup, self.actEdit, self.actDelete] self.actionPane = PzrRadioPane(groupID=24, initCommand=10100) self.actionPane.var = self.actions[0] for action in self.actions: self.actionPane.AddRadiobutton(action) self.text = PzrMessage("Label", text=PzrText(size=18)) self.saveBtn = PzrButton("Save", command=10201) xmlManager.addXML( PzrImage("DecoSquare", pictRes=12001, bb=PzrRect(left=0,top=0,right=193,bottom=400)).place(width-193,0) ) xmlManager.addXML( self.text.place(width-170, 40), indent=1 ) xmlManager.addXML( self.radioPane.place(20,40) ) xmlManager.addXML( self.actionPane.place(width-170,80) ) xmlManager.addXML( OkButton().place(width-90, height-27) ) xmlManager.addXML( CancelButton().place(width-160, height-27) ) xmlData = xmlManager.close() writeXML(path, xmlData) if len(self.all_groups) == 0: msg = "No groups found." else: msg = " " self.dlg = poser.Dialog(xmlFormatPath(path), title=title, message=msg, width=width, height=height) self.radioPane.SetText(self.dlg) self.radioPane.SetValues(self.dlg) self.actionPane.SetText(self.dlg) self.actionPane.SetValues(self.dlg) self.dlg.SetText(name="Label", text=title)