def check_seq(self, node): path = self._compute_output_path(node) node_color = hou.Color((0, 0.8, 0)) return_str = None if '$F4' in path: path = path.replace('$F4', '*') sequences = pyseq.get_sequences(path) if len(sequences) == 1: seq = sequences[0] if seq: if seq.missing(): return_str = '[%s-%s], missing %s' % (seq.format('%s'), seq.format('%e'), seq.format('%M')) else: return_str = seq.format('%R') node_color = hou.Color((0.8, 0, 0)) else: return_str = 'Invalid Sequence Object!' else: return_str = 'No or multiple sequences detected!' elif path.split('.')[-1] == 'abc': if os.path.exists(path): abcRange = abc.alembicTimeRange(path) if abcRange: return_str = '[%s-%s] - ABC Archive' % (int( abcRange[0] * hou.fps()), int(abcRange[1] * hou.fps())) else: return_str = 'Single Abc' node_color = hou.Color((0.8, 0, 0)) else: return_str = 'No Cache!' else: if os.path.exists(path): return_str = 'Single Frame' node_color = hou.Color((0.8, 0, 0)) else: return_str = 'No Cache!' # update shotgun files node as well for file_node in node.dependents(include_children=False): if file_node.type().name() == 'sgtk_file' and file_node.parm( 'mode').evalAsString() == 'out' and file_node.parm( 'rop').evalAsString() == node.path( ) and file_node.parm('overver').evalAsInt() == 0: file_node.parm('seqlabel').set(return_str) node.setColor(node_color) node.parm('seqlabel').set(return_str)
def check_seq(self, node): # sync with rop node if node.parm('mode').evalAsString( ) == 'out' and node.parm('overver').evalAsInt() != 1: rop_node_path = node.parm('rop').evalAsString() rop_node = hou.node(rop_node_path) if rop_node and rop_node.type().name() == 'sgtk_geometry': rop_node.hm().app().handler.check_seq(rop_node) else: node.parm('seqlabel').set('Invalid Out node!') else: path = node.parm('filepath').evalAsString() if node.parm('mode').evalAsString() == 'file' or node.parm( 'overver').evalAsInt(): path = node.parm('filepath').unexpandedString() returnStr = None if '$F' in path: path = path.replace('$F4', '*') path = path.replace('$F', '*') sequences = pyseq.get_sequences(path) if len(sequences) == 1: seq = sequences[0] if seq: if seq.missing(): returnStr = '[%s-%s], missing %s' % (seq.format( '%s'), seq.format('%e'), seq.format('%M')) else: returnStr = seq.format('%R') else: returnStr = 'Invalid Sequence Object!' else: returnStr = 'No or multiple sequences detected!' elif path.split('.')[-1] == 'abc': if os.path.exists(path): abcRange = abc.alembicTimeRange(path) if abcRange: returnStr = '[%s-%s] - ABC Archive' % (int( abcRange[0] * hou.fps()), int(abcRange[1] * hou.fps())) else: returnStr = 'Single Abc' else: returnStr = 'No Cache!' else: if os.path.exists(path): returnStr = 'Single Frame' else: returnStr = 'No Cache!' node.parm('seqlabel').set(returnStr)
def check_seq(self, node): path = node.parm('filepath').evalAsString() if node.parm('mode').evalAsString() == 'file' or node.parm( 'overver').evalAsInt(): path = node.parm('filepath').unexpandedString() returnStr = None if '$F' in path: path = path.replace('$F4', '*') path = path.replace('$F', '*') sequences = pyseq.get_sequences(path) if len(sequences) == 1: seq = sequences[0] if seq: if seq.missing(): returnStr = '[%s-%s], missing %s' % (seq.format('%s'), seq.format('%e'), seq.format('%m')) else: returnStr = seq.format('%R') else: returnStr = 'Invalid Sequence Object!' else: returnStr = 'No or multiple sequences detected!' elif path.split('.')[-1] == 'abc': if os.path.exists(path): abcRange = abc.alembicTimeRange(path) if abcRange: returnStr = '[%s-%s] - ABC Archive' % (int( abcRange[0] * hou.fps()), int(abcRange[1] * hou.fps())) else: returnStr = 'Single Abc' else: returnStr = 'No Cache!' else: if os.path.exists(path): returnStr = 'Single Frame' else: returnStr = 'No Cache!' node.parm('seqlabel').set(returnStr)
def setFrameRangeByABC(abcpath): frame_range = abc.alembicTimeRange(abcpath) if frame_range is not None: fps = hou.fps() FSTART = frame_range[0] FEND = frame_range[1] hou.hscript("setenv -g F_START='{F_START}'".format(F_START=FSTART * fps)) hou.hscript("setenv -g F_END='{F_END}'".format(F_END=FEND * fps)) hou.playbar.setFrameRange(FSTART * fps, FEND * fps) hou.playbar.setPlaybackRange(FSTART * fps, FEND * fps) else: print "please give a valid path"
hipSC = hipSC[:2] + '0' + hipSC[2:] # Find ABC file from Number of Scene. Example: SC001 ==> QQH_EP03_SC100_Anim_V03_out1_frm61.abc abcLists = os.listdir(abcPath) abcLists = [i for i in abcLists if os.path.splitext(i)[1] == '.abc'] abcLists = [i for i in abcLists if hipSC.lower() in i.lower()] if len(abcLists) == 0: hou.ui.displayMessage('Error: $JOB/abc have not abc File for this scene.', title='Search Path', severity=hou.severityType.Error) abcLists.sort() abcFile = abcLists[-1] abcFullFile = abcPath + '/' + abcFile # Set FrameRange timeRange = abc.alembicTimeRange(abcFullFile) if timeRange is not None: hou.playbar.setFrameRange(hou.playbar.frameRange()[0], hou.timeToFrame(timeRange[1]) - 1) #hou.playbar.setPlaybackRange(hou.playbar.playbackRange()[0], hou.timeToFrame(timeRange[1])-1) # Filter Camera, (Need Optimization!!!) abcMenuTuples = abc.alembicGetObjectPathListForMenu( hou.expandString(abcFullFile)) cameraList = [] for i in set(abcMenuTuples): cameraABCObject = abc.alembicGetSceneHierarchy(abcFullFile, i) if cameraABCObject[1] == 'camera': cameraList.append(i) cameraExclude = [ '/front/frontShape', '/top/topShape', '/side/sideShape',
hipName = hipName.split('.')[0] if 'sc' in hipName: hipSC = [i for i in hipName.split('_') if 'sc'.lower() in i.lower()][0] if len(hipSC) is 3: hipSC = hipSC[:2] + '00' + hipSC[2:] if len(hipSC) is 4: hipSC = hipSC[:2] + '0' + hipSC[2:] else: hipSC = '' # Dialog for select file abcFullFile = hou.ui.selectFile(pattern='*' + hipSC + '*' + '.abc', multiple_select=False) # Set FrameRange timeRange = abc.alembicTimeRange(hou.expandString(abcFullFile)) if timeRange is not None: hou.playbar.setFrameRange(hou.playbar.frameRange()[0], hou.timeToFrame(timeRange[1]) - 1) #hou.playbar.setPlaybackRange(hou.playbar.playbackRange()[0], hou.timeToFrame(timeRange[1])-1) # Filter Camera, (Need Optimization!!!) abcMenuTuples = abc.alembicGetObjectPathListForMenu( hou.expandString(abcFullFile)) if abcMenuTuples is None: quit() cameraList = [] for i in set(abcMenuTuples): cameraABCObject = abc.alembicGetSceneHierarchy(abcFullFile, i) if cameraABCObject[1] == 'camera': cameraList.append(i)