def go(self, alembic=False, usd=False, obj=False, mb=False, camera=False): self.alembic = alembic self.usd = usd self.obj = obj self.mb = mb self.camera = camera self.project = Project() self.chosen_asset = None if self.camera and self.alembic: #previs publish case shot_list = self.project.list_shots() self.item_gui = sfl.SelectFromList( l=shot_list, parent=maya_main_window(), title="What shot is this camera in?") self.item_gui.submitted.connect(self.shot_results) else: asset_list = self.project.list_assets() self.item_gui = sfl.SelectFromList( l=asset_list, parent=maya_main_window(), title="Select an asset to export to") self.item_gui.submitted.connect(self.asset_results)
def shot_results(self, value): shot_name = value[0] print(shot_name) self.shot = self.project.get_body(shot_name) if self.type == Asset.CAMERA: self.element = self.shot.get_element(Asset.CAMERA) cam_list = next(os.walk(self.element._filepath))[1] for name in cam_list: if not name.startswith(Asset.CAMERA): cam_list.remove(name) cam_list.sort(key=str.lower) print(cam_list) self.item_gui = sfl.SelectFromList( l=cam_list, parent=maya_main_window(), title="Select a camera to clone") self.item_gui.submitted.connect(self.results) elif self.type == Asset.ANIMATION: self.element = self.shot.get_element(Asset.ANIMATION) asset_list = next(os.walk(self.element._filepath))[1] for name in asset_list: if name == "cache": asset_list.remove(name) asset_list.sort(key=str.lower) print(asset_list) 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 save(self): shot_list = self.project.list_shots() self.item_gui = sfl.SelectFromList(l=shot_list, parent=maya_main_window(), title="Select a shot to save to") self.item_gui.submitted.connect(self.results)
def clone(self): shot_list = self.project.list_existing_shots() self.item_gui = sfl.SelectFromList(l=shot_list, parent=hou.ui.mainQtWindow(), title="Select a shot to clone from") self.item_gui.submitted.connect(self.shot_results)
def publish(self): shot_list = self.project.list_shots() self.item_gui = sfl.SelectFromList(l=shot_list, parent=hou.ui.mainQtWindow(), title="Select a shot to publish to") self.item_gui.submitted.connect(self.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 go(self, quick=True): self.quick = quick shot_list = self.project.list_shots() self.item_gui = sfl.SelectFromList( l=shot_list, parent=maya_main_window(), title="Which shot is this layout in?") self.item_gui.submitted.connect(self.shot_results)
def publish(self): asset_list = self.project.list_assets() self.item_gui = sfl.SelectFromList(l=asset_list, parent=hou.ui.mainQtWindow(), title="Select an asset to publish") self.item_gui.submitted.connect(self.results)
def clone(self): sequence_list = self.project.list_sequences() self.item_gui = sfl.SelectFromList(l=sequence_list, parent=hou.ui.mainQtWindow(), title="Select a sequence") self.item_gui.submitted.connect(self.seq_results)
def open(self, quick=True): self.quick = quick shot_list = self.project.list_shots() self.item_gui = sfl.SelectFromList(l=shot_list, parent=maya_main_window(), title="Select a shot to open") self.item_gui.submitted.connect(self.results)
def clone_geo(self): self.type = Asset.GEO asset_list = self.project.list_existing_assets() self.item_gui = sfl.SelectFromList(l=asset_list, parent=maya_main_window(), title="Select a model to clone") self.item_gui.submitted.connect(self.results)
def create_asset(self): project = Project() asset_list = project.list_existing_assets() self.item_gui = sfl.SelectFromList(l=asset_list, parent=hou.ui.mainQtWindow(), title="Select an asset to create") self.item_gui.submitted.connect(self.asset_results)
def clone(self): asset_list = self.project.list_existing_assets() self.item_gui = sfl.SelectFromList( l=asset_list, parent=hou.ui.mainQtWindow(), title="Select an asset's material to clone") self.item_gui.submitted.connect(self.results)
def clone_camera(self): pm.loadPlugin("AbcImport") self.type = Asset.CAMERA shot_list = self.project.list_existing_shots() self.item_gui = sfl.SelectFromList(l=shot_list, parent=maya_main_window(), title="Select a shot to clone") self.item_gui.submitted.connect(self.shot_results)
def publish(self): if len(hou.selectedNodes()) != 1: qd.error("Select only the last node in the network") return layout_list = Project().list_layouts() self.item_gui = sfl.SelectFromList(l=layout_list, parent=hou.qt.mainWindow(), title="Which layout are you publishing?") self.item_gui.submitted.connect(self.results)
def export(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 export to") self.item_gui.submitted.connect(passAlong)
def go(self): #get shot to add camera to shotList = self.project.list_existing_shots( ) #we shouldn't be adding cameras to shots that haven't been created yet anyway self.item_gui = sfl.SelectFromList( l=shotList, parent=maya_main_window(), title="Select shot to add extra camera to") self.item_gui.submitted.connect(self.shot_results)
def clone(self, quick=True): self.quick = quick self.project = Project() type_list = ["Model", "Rig", "Animation", "Camera"] self.item_gui = sfl.SelectFromList( l=type_list, parent=maya_main_window(), title="Select a type of asset to clone") self.item_gui.submitted.connect(self.type_results)
def get_asset(self, value): asset_name = value[0] print(asset_name) self.type = os.path.join(self.type, asset_name) shot_list = self.project.list_existing_shots() self.item_gui = sfl.SelectFromList(l=shot_list, parent=maya_main_window(), title="Select the shot to clone") self.item_gui.submitted.connect(self.results)
def results(self, value): print("Final value: ", value[0]) filename = value[0] self.namespace = filename if self.type == Asset.GEO or self.type == Asset.RIG: body = self.project.get_body(filename) self.body = body element = self.body.get_element(self.type) else: self.body = self.shot element = self.body.get_element(os.path.join(self.type, filename)) if element is None: qd.warning("Nothing was cloned.") return self.element = element 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] #if we're cloning a model, lets make sure we're getting the obj instead of the usda if self.type == Asset.GEO: path = selected_scene_file.split(".") selected_scene_file = path[0] + ".obj" self.open_scene_file(selected_scene_file) return self.publishes = element.list_publishes() print("publishes: ", self.publishes) if not self.publishes: qd.error("There have been no publishes in this department.") return # make the list a list of strings, not tuples self.sanitized_publish_list = [] for publish in self.publishes: 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 publish_asset(self, solaris): ''' this is what's called when the button is pushed. ''' project = Project() asset_list = project.list_assets() self.item_gui = sfl.SelectFromList(l=asset_list, parent=hou.ui.mainQtWindow(), title="Select an asset to publish") # call asset results function here to be used once selected if solaris: self.item_gui.submitted.connect(self.solaris_asset_results) else: self.item_gui.submitted.connect(self.asset_results)
def publish_shot(self): ''' publishes shot (entire .hip file). Nothing needs to be selected for this to work. ''' scene = hou.hipFile.name() print('file name is ' + scene) project = Project() # get project and its shots asset_list = project.list_shots() self.item_gui = sfl.SelectFromList( l=asset_list, parent=hou.qt.mainWindow(), title="Select a shot to publish to, my friend.") self.item_gui.submitted.connect(self.shot_results)
def seq_results(self, value): self.seq_name = value[0] self.sequence = self.project.get_sequence(self.seq_name) element = self.sequence.get_element(Asset.HDA) fx_list = next(os.walk(element._filepath))[1] for name in fx_list: if name == "cache": fx_list.remove(name) fx_list.sort(key=unicode.lower) self.item_gui = sfl.SelectFromList(l=fx_list, parent=hou.ui.mainQtWindow(), title="Select an effect to clone") self.item_gui.submitted.connect(self.results)
def shot_results(self, value): self.shot_name = value[0] self.shot = self.project.get_shot(self.shot_name) element = self.shot.get_element(Asset.CAMERA) asset_list = next(os.walk(element._filepath))[1] for name in asset_list: if name == "cache": asset_list.remove(name) asset_list.sort(key=unicode.lower) self.item_gui = sfl.SelectFromList(l=asset_list, parent=hou.ui.mainQtWindow(), title="Select an camera to clone") self.item_gui.submitted.connect(self.camera_results)
def shot_results(self, value): self.chosen_shot = value[0] print(self.chosen_shot) shot = self.project.create_shot(self.chosen_shot) #if the shot didn't exist already, set the frame range if shot is not None: pass else: print("we're here") shot = self.project.get_shot(self.chosen_shot) if shot is None: print("uh oh stinky") return #pre-vis publish publish_info = [] if self.camera: camera_num = int(shot.get_camera_number()) if camera_num == 1: #only one camera in the shot self.chosen_asset = "camera1" publish_info.append(AlembicExporter().exportSelected( asset_name=self.chosen_asset, shot_name=self.chosen_shot, camera=self.camera)) self.publish(publish_info) else: #pick which camera to publish cam_list = [] for number in range(1, camera_num + 1): camera_name = "camera" + str(number) cam_list.append(camera_name) self.item_gui = sfl.SelectFromList( l=cam_list, parent=maya_main_window(), title="Which camera are you publishing?") self.item_gui.submitted.connect(self.camera_results) #animation publish else: publish_info.append(AlembicExporter().exportSelected( asset_name=self.chosen_asset, shot_name=self.chosen_shot, camera=self.camera)) self.publish(publish_info)
def results(self, value): self.shot_name = value[0] self.shotBody = Project().get_body(self.shot_name) camElement = self.shotBody.get_element(Asset.CAMERA) asset_list = next(os.walk(camElement._filepath))[1] for name in asset_list: if name == "cache": asset_list.remove(name) asset_list.sort(key=unicode.lower) if len(asset_list) < 1: qd.error( "There is no camera for this shot, so it cannot be built. Quitting build for shot " + self.shot_name + "...") elif len(asset_list) == 1: self.camResults(asset_list) else: self.item_gui = sfl.SelectFromList( l=asset_list, parent=hou.ui.mainQtWindow(), title="Select a camera to clone") self.item_gui.submitted.connect(self.camera_results)
def results(self, value): self.shot_name = value[0] self.shot = self.project.get_shot(self.shot_name) if not self.shot: self.shot = self.project.create_shot(self.shot_name) if not self.shot: qd.error("Something's wrong here. Talk to Stephanie") self.layout_element = self.shot.get_element(Asset.LAYOUT) path = os.path.join(self.layout_element._filepath, self.shot_name + ".usda") if not os.path.exists(path): # no layout is associated with this shot yet layouts = self.project.list_existing_layouts() self.item_gui = sfl.SelectFromList( l=layouts, parent=hou.ui.mainQtWindow(), title="Select a layout for this shot") self.item_gui.submitted.connect(self.layout_results) return self.load(path)
def shot_results(self, value): self.shot_name = value[0] self.shot = self.project.get_shot(self.shot_name) if not self.shot: self.shot = self.project.create_shot(self.shot_name) if not self.shot: qd.error("This is real :'( (but the shot you picked isn't. talk to stephanie)") self.element = self.shot.get_element(Asset.LAYOUT) if self.element is None: qd.warning("Nothing was cloned.") return if self.quick: path = os.path.join(self.element._filepath, self.shot_name+".usda") if os.path.exists(path): self.open_scene_file(path) return else: self.choose_layout() return self.publishes = self.element.list_publishes() if not self.publishes: self.choose_layout() return # make the list a list of strings, not tuples self.sanitized_publish_list = [] for publish in self.publishes: 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 name_results(self, value): self.name = str(value) name = str(self.name) if not pipeline_io.checkFileName(name): self.create_body() return if self.name is None or self.name == "": return asset_type_list = AssetType().list_asset_types() if self.type: self.results([self.type]) return self.item_gui = sfl.SelectFromList(l=asset_type_list, parent=hou.qt.mainWindow(), title="What are you creating?", width=250, height=160) self.item_gui.submitted.connect(self.results)
def results(self, value): shot_name = value[0] self.name = shot_name shot = self.project.get_shot(shot_name) element = None try: element = shot.get_element(Asset.MAYA) except: element = shot.create_element(Asset.MAYA, Element.DEFAULT_NAME) if element.get_last_version() >= 0 and self.quick: filepath = element.get_last_publish()[3] print(filepath) mc.file(filepath, o=True, f=True) elif element.get_last_version() >= 0 and not self.quick: self.element = element self.publishes = element.list_publishes() if not self.publishes: qd.error("There have been no publishes in this department.") return # make the list a list of strings, not tuples self.sanitized_publish_list = [] for publish in self.publishes: 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 a version to open") self.item_gui.submitted.connect(self.version_results) else: qd.error("There's no maya file published for this shot.")