def updateList(self): self.loadFile() nodes = ['Camera'] bundles = ['No Bundle'] takes = [] allnodesIterate = hou.node('/').allSubChildren(True) for node in allnodesIterate: if node.type().nameWithCategory() == 'Object/cam': nodes.append(node.path()) self.combo_cam.clear() self.combo_cam.addItems(nodes) bndls = hou.nodeBundles() for b in bndls: bundles.append(b.name()) tks = hou.takes.takes() for t in tks: takes.append(t.name()) self.combo_bundle.clear() self.combo_bundle.addItems(bundles) self.combo_takes.clear() takes.sort() takes = ['No Take'] + takes self.combo_takes.addItems(takes) self.ln_name.clear() self.ln_begin.clear() self.ln_end.clear() self.ln_notes.clear() self.resz()
def add_items(self, mat_light_list, widget_type): bundles = hou.nodeBundles() temp_mat_light_list = [] global bundle_list bundle_list = [] for bundle in bundles: has_bundle = False bundle_list.append(bundle) if len(bundle.nodes()) < 1: pass else: for i in mat_light_list: if i in bundle.nodes() or i.parent() in bundle.nodes(): if has_bundle == False: item = QTreeWidgetItem(widget_type, [bundle.name()]) has_bundle = True if i not in temp_mat_light_list: child = QTreeWidgetItem(item, [i.path()]) temp_mat_light_list.append(i) for i in mat_light_list: if i not in temp_mat_light_list: item = QTreeWidgetItem(widget_type, [i.path()]) temp_mat_light_list.append(i)
def _checkBundle(self, value): """given the string value, checks if a bundle exists with the name""" bundles = hou.nodeBundles() bundleNames = [bundle.name() for bundle in bundles] if value in bundleNames: return True else: return False
def outputBundles(now, dirtybundles, for_update): ss_parms = soho.evaluate(stylesheetParms) if for_update: bundle_list = dirtybundles.split() elif ss_parms['declare_bundles'].Value[0]: bundle_list = list(bundle.name() for bundle in hou.nodeBundles()) else: bundle_list = [] for bundle in bundle_list: outputBundle(bundle)
def pasteBundles(): bundles = [] bundle_pattern = [] bundle_filter = [] # Add bundles nodes to dictionary for bdl in hou.nodeBundles(): bundle_pattern.append( bdl.pattern()) bundle_filter.append( bdl.filter()) nodes_list = [] for node in bdl.nodes(): nodes_list.append(node.path()) bundles.append( {bdl.name() : nodes_list } ) bundle_elements = {x.keys()[0]: x.values()[0] for x in bundles} bundle_dict = {'bundles':bundle_elements, 'bundle_pattern':bundle_pattern, 'bundle_filter':str(bundle_filter)} pyperclip.copy(bundle_dict)
# write bundle names, filter and pattern to file import hou namedumpfile = '/u/toa/Desktop/b_name.txt' patterndumpfile = '/u/toa/Desktop/b_pattern.txt' filterdumpfile = '/u/toa/Desktop/b_filter.txt' a = file(namedumpfile, 'w') b = file(patterndumpfile, 'w') c = file(filterdumpfile, 'w') # write bundle names, filter and pattern for bdl in hou.nodeBundles(): a.write(str(bdl.name())) a.write("\n") a.close b.write(str(bdl.pattern())) b.write("\n") b.close c.write(str(bdl.filter())) c.write("\n") c.close # Read bundle names, filter and pattern from file namedumpfile = '/u/toa/Desktop/b_name.txt' patterndumpfile = '/u/toa/Desktop/b_pattern.txt' filterdumpfile = '/u/toa/Desktop/b_filter.txt' import hou a = file(namedumpfile, 'r') b = file(patterndumpfile, 'r')