def ball_pressed(*args): t.selectAll() sa = [] for se in t.getAllItems(): select(se.split("=")[0], add=True) sa.append(se.split("=")[0]) if window('medwin1', q=True, ex=True): modelEd.update_objects(ls(sa)) if objExists("mvcam*Shape*"): modelEd.viewFit("mvcam*Shape*") highlight_buttons('ball')
def item_selected(*args): item = t.getSelectItem()[0].split("=")[0] print "item", item select(item) highlight_buttons('item') if window('medwin1', q=True, ex=True): modelEd.update_objects( ls(item) ) # needs the 'ls' to actually select the object in scene if objExists("mvcam*Shape*"): modelEd.viewFit("mvcam*Shape*")
def bhv_pressed(*args): t.removeAll() hvo = [ ] # List, because there can be more than one heaviest object (draw) for i in dic: if dic.get(i) == dic.get(lst[-1].getChildren()[0]): hvo.append(i.getParent()) t.append("%s = %s triangles" % (i.getParent(), dic.get(i))) t.selectAll() if window('medwin1', q=True, ex=True): modelEd.update_objects(hvo) if objExists("mvcam*Shape*"): modelEd.viewFit("mvcam*Shape*") select(hvo) highlight_buttons('bhv')
def bavg_pressed(*args): highlight_buttons('bavg') t.removeAll() ho = [] for i in lst: # lst has the items sorted by triangles if dic.get(i.getChildren() [0]) >= avg: # dic has both values and shapes ho.append(i) t.append("%s = %s triangles" % (i, dic.get(i.getChildren()[0]))) t.selectAll() select(ho) if window('medwin1', q=True, ex=True): modelEd.update_objects(ho) if objExists("mvcam*Shape*"): modelEd.viewFit("mvcam*Shape*")
def item_selected(*args): if button('instance_btn', q=True, ex=True): button('instance_btn', e=True, enable=True) t.removeAll() io = [] # prospects or instanced objects ind = args[0].getSelectIndexedItem()[0] - 1 for i in lst: if dic.get(i.getChildren() [0]) == insLst[ind]: # selected index value = lst value io.append(i) t.append(io) t.selectAll() select(io) if window('medwin1', q=True, ex=True): modelEd.update_objects(io) if objExists("mvcam*Shape*"): modelEd.viewFit("mvcam*Shape*")