def askGroup(actor): preset = ss6Materials.getPreset(actor) use = [] if preset: groups = preset.keys() groups.sort() group = poser.DialogSimple.AskMenu("Select a group...","Select group", groups) if group: use = preset[group] else: ErrorBox("No material groups defined for this object.\n\nYou can use the Edit Groups wacro to\ncreate new material groups.") return use
def askGroup(actor): preset = ss6Materials.getPreset(actor) use = [] if preset: groups = preset.keys() groups.sort() group = poser.DialogSimple.AskMenu("Select a group...", "Select group", groups) if group: use = preset[group] else: ErrorBox( "No material groups defined for this object.\n\nYou can use the Edit Groups wacro to\ncreate new material groups." ) 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)