def publish( self, selectedHDA=None ): #, departments=[Department.HDA, Department.ASSEMBLY, Department.MODIFY, Department.MATERIAL, Department.HAIR, Department.CLOTH]): project = Project() self.selectedHDA = selectedHDA if selectedHDA is None: nodes = hou.selectedNodes() if len(nodes) == 1: selectedHDA = nodes[0] self.selectedHDA = selectedHDA elif len(nodes) > 1: qd.error( 'Too many nodes selected. Please select only one node.') return else: qd.error('No nodes selected. Please select a node.') return if selectedHDA.type().definition() is not None: self.src = selectedHDA.type().definition().libraryFilePath() asset_list = project.list_props_and_characters() self.item_gui = sfl.SelectFromList( l=asset_list, parent=houdini_main_window(), title="Select an asset to publish to") self.item_gui.submitted.connect(self.asset_results) else: qd.error('The selected node is not a digital asset') return
def results(self, value): print("Final value: ", value[0]) filename = value[0] project = Project() body = project.get_body(filename) element = body.get_element("model") filepath = body.get_filepath() self.publishes = element.list_publishes() print("publishes: ", self.publishes) print("path: ", filepath) # make the list a list of strings, not tuples self.sanitized_publish_list = [] for publish in self.publishes: path = publish[3] file_ext = path.split('.')[-1] if not file_ext == "mb": continue label = publish[0] + " " + publish[1] + " " + publish[2] self.sanitized_publish_list.append(label) self.item_gui = sfl.SelectFromList( l=self.sanitized_publish_list, parent=maya_utils.maya_main_window(), title="Select publish to clone") self.item_gui.submitted.connect(self.publish_selection_results)
def rollback_element(self, node, department, name): self.node = node self.department = department project = Project() body = project.get_body(name) element = body.get_element(department) self.publishes = element.list_publishes() print("publishes: ", self.publishes) if not self.publishes: qd.error("There have been no publishes for this department. Rollback failed.") return # make the list a list of strings, not tuples self.sanitized_publish_list = [] for publish in self.publishes: path = publish[3] file_ext = path.split('.')[-1] if not file_ext == "hda" and not file_ext =="hdanc": continue label = publish[0] + " " + publish[1] + " " + publish[2] self.sanitized_publish_list.append(label) self.item_gui = sfl.SelectFromList(l=self.sanitized_publish_list, parent=houdini_main_window(), title="Select publish to clone") self.item_gui.submitted.connect(self.publish_selection_results)
def publish( self, selectedHDA=None ): #, departments=[Department.HDA, Department.ASSEMBLY, Department.MODIFY, Department.MATERIAL, Department.HAIR, Department.CLOTH]): project = Project() self.selectedHDA = selectedHDA if self.selectedHDA is None: self.selectedHDA = get_selected_node() if self.selectedHDA is None: return if self.selectedHDA.type().definition() is not None: self.src = self.selectedHDA.type().definition().libraryFilePath() if self.node_name: self.asset_results([self.node_name]) return asset_list = project.list_props_and_actors() self.item_gui = sfl.SelectFromList( l=asset_list, parent=houdini_main_window(), title="Select an asset to publish to") self.item_gui.submitted.connect(self.asset_results) else: qd.error('The selected node is not a digital asset') return
def import_shot(self): shots = Project().list_shots() self.item_gui = sfl.SelectFromList(l=shots, parent=utils.get_main_window(), title="Select a shot to import:") self.item_gui.submitted.connect(self.results)
def shot_results(self, value): shot_name = value[0] project = Project() body = project.get_body(shot_name) element = body.get_element("lighting") self.publishes = element.list_publishes() print("publishes: ", self.publishes) if not self.publishes: # has not been imported. Import it first. importer = Importer() importer.import_shot([shot_name]) return # make the list a list of strings, not tuples self.sanitized_publish_list = [] for publish in self.publishes: path = publish[3] file_ext = path.split('.')[-1] if not file_ext == "hip" and not file_ext == "hipnc": continue label = publish[0] + " " + publish[1] + " " + publish[2] self.sanitized_publish_list.append(label) self.item_gui = sfl.SelectFromList(l=self.sanitized_publish_list, parent=houdini_main_window(), title="Select publish to clone") self.item_gui.submitted.connect(self.publish_selection_results)
def go(self): project = Project() asset_list = project.list_assets() self.item_gui = sfl.SelectFromList(l=asset_list, parent=maya_main_window(), title="Select an asset to clone") self.item_gui.submitted.connect(self.results)
def asset_results(self, value): chosen_asset = value[0] project = Project() self.frame_range = qd.input("Enter frame range (as numeric input) or leave blank if none:") if self.frame_range is None or self.frame_range == u'': self.frame_range = 1 self.frame_range = str(self.frame_range) if not self.frame_range.isdigit(): qd.error("Invalid frame range input. Setting to 1.") self.body = project.get_body(chosen_asset) self.body.set_frame_range(self.frame_range) department_list = [] asset_type = self.body.get_type() if str(asset_type) == 'prop': department_list = self.body.prop_export_departments() self.department_results(department_list) elif str(asset_type) == 'character': department_list = self.body.char_export_departments() elif str(asset_type) == 'set': department_list = self.body.set_export_departments() elif str(asset_type) == 'shot': department_list = self.body.shot_export_departments() self.item_gui = sfl.SelectFromList(l=department_list, multiple_selection=True, parent=maya_main_window(), title="Select department(s) for this export: ") self.item_gui.submitted.connect(self.department_results)
def clone_set(self): project = Project() asset_list = project.list_sets() self.asset_gui = sfl.SelectFromList(l=asset_list, parent=houdini_main_window(), title="Select a set to clone") self.asset_gui.submitted.connect(self.asset_results)
def clone_hda(self, hda=None): project = Project() asset_list = project.list_props_and_actors() self.item_gui = sfl.SelectFromList(l=asset_list, parent=houdini_main_window(), title="Select an asset to clone") self.item_gui.submitted.connect(self.asset_results)
def playblast(self): asset_list = Project().list_assets() self.item_gui = sfl.SelectFromList( l=asset_list, parent=maya_main_window(), title="Select an asset to playblast") self.item_gui.submitted.connect(self.asset_results)
def clone_tool(self, node=None): self.project = Project() hda_list = self.project.list_hdas() self.item_gui = sfl.SelectFromList(l=hda_list, parent=houdini_main_window(), title="Select a tool to clone") self.item_gui.submitted.connect(self.tool_results)
def clone_shot(self): self.quick = True project = Project() asset_list = project.list_shots() self.item_gui = sfl.SelectFromList(l=asset_list, parent=maya_main_window(), title="Select a shot to clone") self.item_gui.submitted.connect(self.results)
def publish_set(self, node=None): self.departments = [Department.ASSEMBLY] project = Project() set_list = project.list_sets() self.item_gui = sfl.SelectFromList(l=set_list, parent=houdini_main_window(), title="Select a set to publish") self.item_gui.submitted.connect(self.set_results)
def go(self): project = Project() asset_list = project.list_shots() self.item_gui = sfl.SelectFromList( l=asset_list, parent=maya_main_window(), title="Select shots to clear Ribs/IFDs", multiple_selection=True) self.item_gui.submitted.connect(self.results)
def run(self): project = Project() shot_list = project.list_shots() print("shot list: ", shot_list) self.select_from_list_dialog = sfl.SelectFromList( l=shot_list, parent=houdini_main_window(), title="Select a shot to import") self.select_from_list_dialog.submitted.connect(self.import_shot)
def reference_any(self): self.project = Project() asset_list = self.project.list_assets() self.item_gui = sfl.SelectFromList( l=asset_list, parent=maya_main_window(), title="What do you want to reference?", multiple_selection=True) self.item_gui.submitted.connect(self.post_reference)
def import_template(self): self.templates_dir = Environment().get_templates_dir() files = os.listdir(self.templates_dir) self.item_gui = sfl.SelectFromList( l=files, parent=utils.get_main_window(), title="Select template(s) to import", multiple_selection=True) self.item_gui.submitted.connect(self.template_results)
def publish_shot(self): scene = hou.hipFile.name() self.departments = [Department.HDA, Department.LIGHTING, Department.FX] project = Project() asset_list = project.list_shots() self.item_gui = sfl.SelectFromList(l=asset_list, parent=houdini_main_window(), title="Select a shot to publish to") self.item_gui.submitted.connect(self.shot_results)
def go(self): environment = Environment() self.reference_dir = environment.get_reference_geo_dir() files = os.listdir(self.reference_dir) self.item_gui = sfl.SelectFromList( l=files, parent=maya_main_window(), title="Select reference actor(s) to import", multiple_selection=True) self.item_gui.submitted.connect(self.results)
def dereference_assets(self): self.references = get_loaded_references() ref_names = [] for ref in self.references: ref_names.append(str(ref)) self.item_gui = sfl.SelectFromList(l=ref_names, parent=maya_main_window(), title="Select Assets to Unload", multiple_selection=True) self.item_gui.submitted.connect(self.dereference_asset)
def untag_multiple(self): tagged_items = {} for node in self.all: if (node_is_tagged_with_flag(node, "DCC_Alembic_Export_Flag")): tagged_items.update({str(node): node}) self.item_gui = sfl.SelectFromList(l=tagged_items, parent=maya_main_window(), title="Untag Multiple", multiple_selection=True) self.item_gui.submitted.connect(self.mass_untag)
def publish(self): # this is the function that we will use to publish. project = Project() asset_list = project.list_assets() self.item_gui = sfl.SelectFromList( l=asset_list, parent=maya_main_window(), title="Select an asset to publish to") self.item_gui.submitted.connect(self.asset_results)
def snapshot(self): if self.asset_name: self.shapshot_results([self.asset_name]) return asset_list = Project().list_assets() self.item_gui = sfl.SelectFromList( l=asset_list, parent=maya_main_window(), title="Which asset is this snap for?") self.item_gui.submitted.connect(self.shapshot_results)
def name_results(self, value): self.name = str(value) if self.name is None or self.name == "": return asset_type_list = AssetType().list_asset_types() self.item_gui = sfl.SelectFromList(l=asset_type_list, parent=houdini_main_window(), title="What are you creating?", width=250, height=160) self.item_gui.submitted.connect(self.results)
def create_body(self): self.name = qd.input("What's the name of this asset?") if self.name is None: return asset_type_list = AssetType().list_maya_types() self.item_gui = sfl.SelectFromList(l=asset_type_list, parent=maya_main_window(), title="What are you creating?", width=250, height=120) self.item_gui.submitted.connect(self.results)
def publish(self, quick=True): if quick: shot_name = os.environ.get("DCC_NUKE_ASSET_NAME") else: shot_name = None if shot_name is None: shots = Project().list_shots() self.item_gui = sfl.SelectFromList( l=shots, parent=utils.get_main_window(), title="Select a shot to publish to:") self.item_gui.submitted.connect(self.results) else: self.results([shot_name])
def results(self, value): print("Final value: ", value[0]) filename = value[0] project = Project() body = project.get_body(filename) self.body = body type = body.get_type() element = self.get_element_option(type, body) if self.quick: latest = element.get_last_publish() if not latest: qd.error("There have been no publishes in this department.") return else: selected_scene_file = latest[3] self.open_scene_file(selected_scene_file) return if element is None: qd.warning("Nothing was cloned.") return self.publishes = element.list_publishes() print("publishes: ", self.publishes) if not self.publishes: qd.error( "There have been no publishes in this department. Maybe you meant model?" ) return # make the list a list of strings, not tuples self.sanitized_publish_list = [] for publish in self.publishes: path = publish[3] file_ext = path.split('.')[-1] if not file_ext == "mb": continue label = publish[0] + " " + publish[1] + " " + publish[2] self.sanitized_publish_list.append(label) self.item_gui = sfl.SelectFromList(l=self.sanitized_publish_list, parent=maya_main_window(), title="Select publish to clone") self.item_gui.submitted.connect(self.publish_selection_results)
def run(self): self.environment = Environment() self.project = Project() hda_dir = self.environment.get_hda_dir() # GET LIST OF CAMERAS self.cameraList = hou.node('/').recursiveGlob( '*', hou.nodeTypeFilter.ObjCamera) cameraNameList = [camera.name() for camera in self.cameraList] self.item_gui = sfl.SelectFromList( l=cameraNameList, parent=houdini_main_window(), title="Select cameras to snapshot from", multiple_selection=True) self.item_gui.submitted.connect(self.camera_results) print self.item_gui
def asset_results(self, value): chosen_asset = value[0] project = Project() self.body = project.get_body(chosen_asset) asset_type = self.body.get_type() if asset_type == AssetType.ACTOR or asset_type == AssetType.PROP: self.export = True department_list = get_departments_by_type(asset_type) self.item_gui = sfl.SelectFromList( l=department_list, parent=maya_main_window(), title="Select department for this publish") self.item_gui.submitted.connect(self.department_results)