Example #1
0
 def reset_all(self):
     switch_input_parm = hou.parm('/obj/geo1//switch2/input')
     switch_input_parm.set(1)
     paint_node = hou.node('/obj/geo1//paint1')
     x = hou.parmTuple('/obj/geo1//paint1/fg')
     x[0].set(0)
     x[1].set(0)
     x[2].set(0)
     hou.parm('/obj/geo1//paint1/flood').pressButton()
     y = hou.parmTuple('/obj/geo1//paint1/bg')
     y[0].set(0)
     y[1].set(0)
     y[2].set(0)
     hou.parm('/obj/geo1//paint1/flood').pressButton()
Example #2
0
    def copy(self, name="", set_current=False):
        '''
            Return a copy of that take and add it to the list of take.
        '''
        if self.name not in _listTakeNames():
            raise TakeError("Can not find take: " + self.name)

        if not name:
            name = self.name + "_copy"

        out_take = Take(name)
        for k in self.take_members:

            p = hou.parm(k)
            if p is None:
                p = hou.parmTuple(k)

            if p is None:
                continue

            out_take.includeParms(k, self.take_members[k])

        if set_current:
            setTake(name)
        else:
            returnToMainTake()

        return out_take
Example #3
0
    def copy(self, name="", set_current=False):
        '''
            Return a copy of that take and add it to the list of take.
        '''
        if self.name not in _listTakeNames():
            raise TakeError("Can not find take: " + self.name)
        
        if not name:
            name = self.name + "_copy"
            
        out_take = Take(name)
        for k in self.take_members:
            
            p = hou.parm(k)
            if p is None:
                p = hou.parmTuple(k)

            if p is None:
                continue

            out_take.includeParms(k, self.take_members[k])
        
        if set_current:
            setTake(name)
        else:
            returnToMainTake()
        
        return out_take
	def __enter__( self ) :
		
		handlers = {
			"Int" : self.__simpleParmHandler,
			"Float" : self.__simpleParmHandler,
			"String" : self.__simpleParmHandler,
		}

		self.__restoreCommands = []
		for parmName, value in self.__parametersAndValues.items() :
			
			# check we can handle this type
			parm = hou.parm( parmName ) or hou.parmTuple( parmName )
			if not parm :
				raise TypeError( "Parameter \"%s\" does not exist." % parmName )
			
			parmType = parm.parmTemplate().dataType().name()
			handler = handlers.get( parmType, None )
			if not handler :
				raise TypeError( "Parameter \"%s\" has unsupported type \"%s\"." % ( parmName, parmType ) )

			# store a command to restore the parameter value later
			self.__restoreCommands.append( parm.asCode() )

			# and change the parameter value
			handler( parm, value )
def set_upstream_channel_ref_value(kwargs):
    """Callback function related to the menu above.
    """
    src = hou.parmTuple(kwargs["selectedtoken"])
    reset_parms(kwargs)
    parms = get_all_parms(kwargs)
    for parm in parms:
        parm.set("`chs(\"%s\"" ")`" % kwargs["selectedtoken"])
Example #6
0
def blackAssign():
############ create black shader ####
    if blackShader.name() == "constant_black":
        blackShader.destroy()
        constant = hou.galleries.galleryEntries('constant')[0]
        constant.createChildNode(hou.node("/shop")).setName('constant_black')
        hou.parmTuple('/shop/constant_black/difclr').set((0,0,0))
    else:
        constant = hou.galleries.galleryEntries('constant')[0]
        constant.createChildNode(hou.node("/shop")).setName('constant_black')
        hou.parmTuple('/shop/constant_black/difclr').set((0,0,0))    

############# select objects assign black shader ##################    
    candidateObjects = hou.parm('vobject')
    canEval = candidateObjects.eval()
    allNodes = hou.node("/obj").recursiveGlob(canEval, filter=hou.nodeTypeFilter.ObjGeometry)
    #print allNodes   
    for i in allNodes:
        objNode = hou.node("/obj/" + str(i))
        print i
        objNode.setParms({"/obj/" + str(i) + "/shop_materialpath": '/shop/constant_black'})
Example #7
0
 def items(self):
     result = list()
     underlying = []
     for path in self._underlying:
         try:
             result.append(hou.parmTuple(path))
             underlying.append(path)
         except hou.NotAvailable:
             pass
     self._underlying = underlying
     self._uniq = set(underlying)
     return result
Example #8
0
def rAssign():
    
    #### create red shader ####
    if redShader.name() == "constant_red":
        redShader.destroy()
        constant = hou.galleries.galleryEntries('constant')[0]
        constant.createChildNode(hou.node("/shop")).setName('constant_red')
        hou.parmTuple('/shop/constant_red/difclr').set((1,0,0))
    else:
        constant = hou.galleries.galleryEntries('constant')[0]
        constant.createChildNode(hou.node("/shop")).setName('constant_red')
        hou.parmTuple('/shop/constant_red/difclr').set((1,0,0))
        
    ##### assign red shader #####
    redParm = hou.parm('red_matte')
    redList = redParm.eval()
    allNodes = hou.node("/obj").recursiveGlob(redList, filter=hou.nodeTypeFilter.ObjGeometry)
    #print allNodes   
    for i in allNodes:
        objNode = hou.node("/obj/" + str(i))
        print i
        objNode.setParms({"/obj/" + str(i) + "/shop_materialpath": '/shop/constant_red'})
Example #9
0
def bAssign():
    
    #### create red shader ####
    if blueShader.name() == "constant_blue":
        blueShader.destroy()
        constant = hou.galleries.galleryEntries('constant')[0]
        constant.createChildNode(hou.node("/shop")).setName('constant_blue')
        hou.parmTuple('/shop/constant_blue/difclr').set((0,0,1))
    else:
        constant = hou.galleries.galleryEntries('constant')[0]
        constant.createChildNode(hou.node("/shop")).setName('constant_blue')
        hou.parmTuple('/shop/constant_blue/difclr').set((0,0,1))
        
    ##### assign red shader #####
    blueParm = hou.parm('blue_matte')
    blueList = blueParm.eval()
    allNodes = hou.node("/obj").recursiveGlob(blueList, filter=hou.nodeTypeFilter.ObjGeometry)
    #print allNodes   
    for i in allNodes:
        objNode = hou.node("/obj/" + str(i))
        print i
        objNode.setParms({"/obj/" + str(i) + "/shop_materialpath": '/shop/constant_blue'})
Example #10
0
def gAssign():
    
    #### create red shader ####
    if greenShader.name() == "constant_green":
        greenShader.destroy()
        constant = hou.galleries.galleryEntries('constant')[0]
        constant.createChildNode(hou.node("/shop")).setName('constant_green')
        hou.parmTuple('/shop/constant_green/difclr').set((0,1,0))
    else:
        constant = hou.galleries.galleryEntries('constant')[0]
        constant.createChildNode(hou.node("/shop")).setName('constant_green')
        hou.parmTuple('/shop/constant_green/difclr').set((0,1,0))
        
    ##### assign red shader #####
    greenParm = hou.parm('green_matte')
    greenList = greenParm.eval()
    allNodes = hou.node("/obj").recursiveGlob(greenList, filter=hou.nodeTypeFilter.ObjGeometry)
    #print allNodes   
    for i in allNodes:
        objNode = hou.node("/obj/" + str(i))
        print i
        objNode.setParms({"/obj/" + str(i) + "/shop_materialpath": '/shop/constant_green'})
Example #11
0
 def skelTreeCHOPs(self, node):
     path = node.path()
     for ch in ["t", "r", "s"]:
         ct = hou.parmTuple(path + "/" + ch)
         if ct:
             for c in ct:
                 trk = c.overrideTrack()
                 if trk:
                     chop = trk.chopNode()
                     if not chop in self.skelCHOPs:
                         self.skelCHOPs.append(chop)
     for link in node.outputConnectors()[0]:
         self.skelTreeCHOPs(link.outputNode())
Example #12
0
def bAssign():

    #### create red shader ####
    if blueShader.name() == "constant_blue":
        blueShader.destroy()
        constant = hou.galleries.galleryEntries('constant')[0]
        constant.createChildNode(hou.node("/shop")).setName('constant_blue')
        hou.parmTuple('/shop/constant_blue/difclr').set((0, 0, 1))
    else:
        constant = hou.galleries.galleryEntries('constant')[0]
        constant.createChildNode(hou.node("/shop")).setName('constant_blue')
        hou.parmTuple('/shop/constant_blue/difclr').set((0, 0, 1))

    ##### assign red shader #####
    blueParm = hou.parm('blue_matte')
    blueList = blueParm.eval()
    allNodes = hou.node("/obj").recursiveGlob(
        blueList, filter=hou.nodeTypeFilter.ObjGeometry)
    #print allNodes
    for i in allNodes:
        objNode = hou.node("/obj/" + str(i))
        print i
        objNode.setParms(
            {"/obj/" + str(i) + "/shop_materialpath": '/shop/constant_blue'})
Example #13
0
def rAssign():

    #### create red shader ####
    if redShader.name() == "constant_red":
        redShader.destroy()
        constant = hou.galleries.galleryEntries('constant')[0]
        constant.createChildNode(hou.node("/shop")).setName('constant_red')
        hou.parmTuple('/shop/constant_red/difclr').set((1, 0, 0))
    else:
        constant = hou.galleries.galleryEntries('constant')[0]
        constant.createChildNode(hou.node("/shop")).setName('constant_red')
        hou.parmTuple('/shop/constant_red/difclr').set((1, 0, 0))

    ##### assign red shader #####
    redParm = hou.parm('red_matte')
    redList = redParm.eval()
    allNodes = hou.node("/obj").recursiveGlob(
        redList, filter=hou.nodeTypeFilter.ObjGeometry)
    #print allNodes
    for i in allNodes:
        objNode = hou.node("/obj/" + str(i))
        print i
        objNode.setParms(
            {"/obj/" + str(i) + "/shop_materialpath": '/shop/constant_red'})
Example #14
0
def gAssign():

    #### create red shader ####
    if greenShader.name() == "constant_green":
        greenShader.destroy()
        constant = hou.galleries.galleryEntries('constant')[0]
        constant.createChildNode(hou.node("/shop")).setName('constant_green')
        hou.parmTuple('/shop/constant_green/difclr').set((0, 1, 0))
    else:
        constant = hou.galleries.galleryEntries('constant')[0]
        constant.createChildNode(hou.node("/shop")).setName('constant_green')
        hou.parmTuple('/shop/constant_green/difclr').set((0, 1, 0))

    ##### assign red shader #####
    greenParm = hou.parm('green_matte')
    greenList = greenParm.eval()
    allNodes = hou.node("/obj").recursiveGlob(
        greenList, filter=hou.nodeTypeFilter.ObjGeometry)
    #print allNodes
    for i in allNodes:
        objNode = hou.node("/obj/" + str(i))
        print i
        objNode.setParms(
            {"/obj/" + str(i) + "/shop_materialpath": '/shop/constant_green'})
Example #15
0
def blackAssign():
    ############ create black shader ####
    if blackShader.name() == "constant_black":
        blackShader.destroy()
        constant = hou.galleries.galleryEntries('constant')[0]
        constant.createChildNode(hou.node("/shop")).setName('constant_black')
        hou.parmTuple('/shop/constant_black/difclr').set((0, 0, 0))
    else:
        constant = hou.galleries.galleryEntries('constant')[0]
        constant.createChildNode(hou.node("/shop")).setName('constant_black')
        hou.parmTuple('/shop/constant_black/difclr').set((0, 0, 0))


############# select objects assign black shader ##################
    candidateObjects = hou.parm('vobject')
    canEval = candidateObjects.eval()
    allNodes = hou.node("/obj").recursiveGlob(
        canEval, filter=hou.nodeTypeFilter.ObjGeometry)
    #print allNodes
    for i in allNodes:
        objNode = hou.node("/obj/" + str(i))
        print i
        objNode.setParms(
            {"/obj/" + str(i) + "/shop_materialpath": '/shop/constant_black'})
Example #16
0
    def parms(self):
        '''returns a tuple of hou.parms'''
        hscript_cmd = 'takels  -i -l ' + self._name
        hscript_cmd_results = hou.hscript(hscript_cmd)

        if _takeErr(hscript_cmd_results[1]):
            result = None
        else:
            parm_names_paths = hscript_cmd_results[0].split('\n')
            parm_names_paths = [x for x in parm_names_paths if x != '']
            parm_names_paths.remove(self._name)

            # make parm objects
            parms = []
            for parm_names_path in parm_names_paths:

                node_path = parm_names_path.split(' ', 1)[0]
                parm_names = parm_names_path.split(' ', 1)[1].split()

                for parm_name in parm_names:
                    if '-flag' in parm_name:
                        continue

                    parm = hou.parm(node_path + '/' + parm_name)

                    if parm == None:
                        parm = hou.parmTuple(node_path + '/' + parm_name)
                        if parm == None:
                            msg = "unable to resolve parm object for: " + node_path + '/' + parm_name
                            print >> sys.stderr, msg
                            continue

                        else:
                            [parms.append(i) for i in parm]

                    else:
                        parms.append(parm)

            if len(parms) == 0:
                result = None
            else:
                result = tuple(parms)

        return result
Example #17
0
	def parms(self):
		
		'''returns a tuple of hou.parms'''
		hscript_cmd = 'takels  -i -l ' + self._name
		hscript_cmd_results = hou.hscript(hscript_cmd)
		
		if _takeErr(hscript_cmd_results[1]):
			result = None
		else: 
			parm_names_paths = hscript_cmd_results[0].split('\n')
			parm_names_paths = [x for x in parm_names_paths if x!='']
			parm_names_paths.remove(self._name)

			# make parm objects
			parms = []
			for parm_names_path in parm_names_paths:
				
				node_path = parm_names_path.split(' ',1)[0]
				parm_names = parm_names_path.split(' ',1)[1].split()
				
				for parm_name in parm_names:
					if '-flag' in parm_name:
						continue
					
					parm = hou.parm(node_path + '/' + parm_name)
					
					if parm == None:
						parm = hou.parmTuple(node_path + '/' + parm_name)
						if parm == None:
							msg = "unable to resolve parm object for: "+node_path + '/' + parm_name
							print >> sys.stderr, msg
							continue
						
						else: [parms.append(i) for i in parm]

					else: parms.append(parm)

			if len(parms) == 0:
				result = None
			else: result = tuple(parms)

		return result
Example #18
0
def evalFrmRot(node, fno):
	rOrd = getRotOrd(node)
	parms = hou.parmTuple(node.path() + "/r")
	return qrot(parms.evalAtFrame(fno), rOrd)
import hou

hipfile = sys.argv[1]
frame = int(sys.argv[2])

print 'Exporting ASS files to render, from %s.' % hipfile
print 'Doing frame %04d.' % frame

time_start = time.time()
print "Loading file %s" % (hipfile)
hou.hipFile.load(hipfile, suppress_save_prompt=True, ignore_load_warnings=True)
print "Loaded!"
time_end = time.time() - time_start
print 'Scene loading took %d seconds.' % (time_end + 1)

print 'Setting settings...'
hou.parm('/obj/asset_lookdev/ar_skip_license_check').set(0)
hou.parmTuple('/obj/asset_lookdev/f').deleteAllKeyframes()
hou.parm('/obj/asset_lookdev/f1').set(frame)
hou.parm('/obj/asset_lookdev/f2').set(frame)

# RENDER
time_start = time.time()
print "Starting to render...",
hou.parm('/obj/asset_lookdev/render_to_disk_main').pressButton()
time_end = time.time() - time_start
print 'Ass file exports took %d seconds.' % (time_end + 1)

print 'Done. Exiting.'
quit()
Example #20
0
def evalFrmScl(node, fno):
	parms = hou.parmTuple(node.path() + "/s")
	return hou.Vector3(parms.evalAtFrame(fno))
Example #21
0
def hasRotAnim(node):
	parms = hou.parmTuple(node.path() + "/r")
	return ckParmsAnim(parms)
import hou

hou.cd('/obj/geo1')

# 获取独一个参数对象
parm = hou.parm('./sphere1/radx')

# 查看参数对象当前值
print parm.eval()

# 设置值
parm.set(5)

# 获取一组参数对象
parmTuple = hou.parmTuple('./sphere1/rad')
print parmTuple.eval()  # 返回(1.0,1.0,1.0)

# 设置一组参数对象
parmTuple.set((5.0, 5.0, 5.0))
Example #23
0
def hasSclAnim(node):
    parms = hou.parmTuple(node.path() + "/s")
    return ckParmsAnim(parms)
Example #24
0
def hasRotAnim(node):
    parms = hou.parmTuple(node.path() + "/r")
    return ckParmsAnim(parms)
Example #25
0
def evalFrmRot(node, fno):
    rOrd = getRotOrd(node)
    parms = hou.parmTuple(node.path() + "/r")
    return qrot(parms.evalAtFrame(fno), rOrd)
Example #26
0
frame = int(sys.argv[2])

print 'Exporting ASS files to render, from %s.' % hipfile
print 'Doing frame %04d.' % frame

time_start = time.time()
print "Loading file %s" % (hipfile)
hou.hipFile.load(hipfile, suppress_save_prompt=True, ignore_load_warnings=True)
print "Loaded!"
time_end = time.time() - time_start
print 'Scene loading took %d seconds.' % (time_end + 1)

print 'Setting settings...'
hou.parm('/obj/ij_stereo_camera_rig/ar_skip_license_check').set(0)
hou.parm('/obj/ij_stereo_camera_rig/enable_volumes').set(0)
hou.parmTuple('/obj/ij_stereo_camera_rig/f').deleteAllKeyframes()
hou.parm('/obj/ij_stereo_camera_rig/f1').set(frame)
hou.parm('/obj/ij_stereo_camera_rig/f2').set(frame)
hou.parm('/obj/ij_stereo_camera_rig/view_cache').set(1)
hou.parm('/obj/ij_stereo_camera_rig/usecache').set(1)
hou.parm('/obj/ij_stereo_camera_rig/main_res').set('1.0')

# RENDER
time_start = time.time()
print "Starting to render...",
hou.parm('/obj/ij_stereo_camera_rig/render_to_disk_crypto').pressButton()
time_end = time.time() - time_start
print 'Ass file exports took %d seconds.' % (time_end + 1)

print 'Done. Exiting.'
quit()
Example #27
0
def hasPosAnim(node):
	parms = hou.parmTuple(node.path() + "/t")
	return ckParmsAnim(parms)
Example #28
0
def evalFrmScl(node, fno):
    parms = hou.parmTuple(node.path() + "/s")
    return hou.Vector3(parms.evalAtFrame(fno))
Example #29
0
    cpy.setInput(0, trns)
    cpy.setInput(1, orint_wrngl)
    unpck.setInput(0, cpy)
    attrbwrngl_aftunpck.setInput(0, unpck)
    null.setInput(0, attrbwrngl_aftunpck)
    geo.layoutChildren()
    mrg.setInput(0, null)
    mrg.setInput(1, switchwithexp)

    # set parm

    grnd_path = grnd.parm('objpath1')
    grnd_path.set(sel_node_path)
    uvtxtr_coord = uvtxtr.parm('coord')
    uvtxtr_coord.set(0)
    hou.parmTuple('/obj/geo2/paint1/bg')
    pnt_bg = pnt.parmTuple('bg')
    pnt_bg[0].set(0)
    pnt_bg[1].set(0)
    pnt_bg[2].set(0)
    hou.parm('/obj/geo2/switch2/input')
    switchwoexp_input = switchwoexp.parm('input')
    switchwoexp_input.set(1)
    pntfg = pnt.parmTuple('fg')
    pntfg[0].set(0)
    pntfg[1].set(0)
    pntfg[2].set(0)
    pnt.parm('flood').pressButton()
    pntfg[0].set(1)
    pntfg[1].set(0)
    pntfg[2].set(0)
Example #30
0
def hasPosAnim(node):
    parms = hou.parmTuple(node.path() + "/t")
    return ckParmsAnim(parms)
Example #31
0
import hou
# 可视化中的节点 拖拽到source editor中直接生成节点对象代码
hou.node('/obj/geo1/box1')
# 可视化中的参数名称 拖拽到source editor中直接生成组参数对象代码
hou.parmTuple('/obj/geo1/sphere1/rad')
# 可视化中的参数中一组值的其中一个值,框选值后 拖拽到source editor中直接生成其中一个值参数对象代码
hou.parm('/obj/geo1/sphere1/radx')
# 可视化中的工具栏 拖拽到source editor中直接生成工具节点对象代码
hou.shelves.tools()['geometry_box']
Example #32
0
def rndr(render_node_path):
    import hou, os, re, glob
    import time
    # path to the output driver that will perform the rendering (example: '/out/mantra1')
    rop_node_path = render_node_path

    # Get the name of the render node type
    # the parm names that this script is looking for on the rop node might be named differently depending on which render engine is used
    rop_node_type = hou.node(rop_node_path).type().name()
    # Some possiblities might be:
    # 'Redshift_ROP'
    # 'ifd'
    # 'wren'
    # 'arnold'

    # Save a backup of the houdini scene
    if rop_node_type == 'Redshift_ROP':
        backup_file_path = saveArchive(
            os.path.dirname(
                os.path.abspath(
                    hou.parm(rop_node_path +
                             '/RS_outputFileNamePrefix').eval())))
    elif rop_node_type == 'ifd':
        backup_file_path = saveArchive(
            os.path.dirname(
                os.path.abspath(
                    hou.parm(rop_node_path + '/vm_picture').eval())))
    else:
        print 'ERROR'

    # Do the rendering
    hou.node(rop_node_path).render()
    ###hou.hscript('opparm -c '+rop_node_path+' execute')

    # Initialize an empty list, will be used to store all images generated by the render
    img_seq = []

    # frange is assigned a tuple (3 item list) so we know the frame range that was rendered (start, end, inc)
    frange = hou.parmTuple(rop_node_path + '/f').eval()

    # https://stackoverflow.com/questions/4189766/range-with-step-of-type-float/4189798#4189798
    # Iterate thru the range of frames rendered and eval the frame filepath at that specific frame
    # Doing this to get a list of all files that should be generated by the render.
    for i in xrange(int(frange[0]), int(frange[1] + 1.0), int(frange[2])):
        # Eval the frame file path parameter at every frame that was rendered to get complete list of images generated
        if rop_node_type == 'Redshift_ROP':
            img_seq.append(
                os.path.abspath(
                    hou.parm(rop_node_path +
                             '/RS_outputFileNamePrefix').evalAtFrame(i)))
        elif rop_node_type == 'ifd':
            img_seq.append(
                os.path.abspath(
                    hou.parm(rop_node_path + '/vm_picture').evalAtFrame(i)))

    # This loops thru each frame of the rendered img_seq
    # I was doing this to convert each frame to a .png, but it's possible ffmpeg can just directly encode .exr to a movie
    for img in img_seq:
        if os.path.isfile(img):
            base, ext = os.path.splitext(img)

            #print 'running "%s"' % str('icp %s %s' % (img, base+'.png'))
            # http://www.sidefx.com/docs/houdini/ref/utils/iconvert.html
            #os.system('icp %s %s' % (img, base+'.png'))

            # This convert command seems much faster than Houdini's icp command
            ###os.system('iconvert %s %s' % (img, base+'.png'))
            tmp_var = 50
            #print 'iconvert %s %s' % (img, base+'.png')
            #os.system('convert %s -colorspace RGB -colorspace RGB %s' % (img, base+'.png'))

            # Might want to clean up these temporary png files later on!!!

    # This should be the directory containing the rendered frames
    ffmpeg_input = os.path.abspath(os.path.join(img_seq[0], os.pardir))

    # append a path sep and the baseName of the first image of the frames rendered
    ffmpeg_input += os.path.sep + getSeqInfo(img_seq[0])[0]
    print '00  ' + ffmpeg_input

    # Kind of sloppy, need to clean up naming of vars as this is no longer a flbk script
    mov_output_path = ffmpeg_input
    print '01  ' + mov_output_path
    mov_output_path += time.strftime("%Y.%m.%d_%H.%M.%S")
    print '01  ' + mov_output_path
    # Make sure we don't already have a period at the end of the string (avoid filename..mov situation)
    if mov_output_path.endswith('.'):
        mov_output_path += 'mov'
    else:
        mov_output_path += '.mov'
    print '02  ' + mov_output_path
    # Not sure if it's always %04d, or maybe just %4d works?
    # str(getSeqInfo(img_seq[0])[1]) is the numPad of the img_seq (zero padding length)
    ffmpeg_input += '%0' + str(getSeqInfo(img_seq[0])[1]) + 'd'

    # This appends the img_seq file extension
    ffmpeg_input += os.path.splitext(img_seq[0])[1]

    # Make me a .mov
    # https://stackoverflow.com/questions/14430593/encoding-a-readable-movie-by-quicktime-using-ffmpeg
    # ffmpeg -i /tmp/%04d.JPEG -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" -f mp4 -vcodec libx264 -pix_fmt yuv420p .v1.mp4
    # add -y to the command line after input file path to force overwriting if file exists
    # See link below for more info about adding metadata with ffmpeg
    # https://ubuntuforums.org/showthread.php?t=1193808
    # You can simply press enter where you want the newline as you are typing your command.

    convert2mov_command = 'ffmpeg'

    # I think starting with a linear image, we have to tell ffmpeg gamma 2.2 or else it will look too dark
    convert2mov_command += ' -gamma 2.2'  # https://superuser.com/a/1139735

    convert2mov_command += ' -start_number ' + str(
        int(frange[0])
    )  # In case we aren't starting at frame 1, http://hamelot.io/visualization/using-ffmpeg-to-convert-a-set-of-images-into-a-video/

    convert2mov_command += ' -i ' + ffmpeg_input
    convert2mov_command += ' -y'
    convert2mov_command += ' -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2"'
    convert2mov_command += ' -f mp4 -vcodec libx264 -pix_fmt yuv420p'

    # http://ffmpeg.gusari.org/viewtopic.php?f=11&t=3032
    # by default ffmpeg outputs 25fps, change this with: -r 24
    convert2mov_command += ' -r ' + str(hou.fps())

    # Set the Constant Rate Factor of the video
    # http://slhck.info/video/2017/02/24/crf-guide.html
    convert2mov_command += ' -crf 8'
    # Set the bitrate of the vide0
    # https://gist.github.com/ksharsha/b06d184391290bc3b87fdadadb73c5bc#file-ffmpeg-compress
    #convert2mov_command+=' -b:v 750k'
    convert2mov_command += ' -metadata title="' + hou.getenv('HIPNAME') + '"'
    convert2mov_command += ' -metadata comment="' + hou.hipFile.path(
    ) + '\n' + hou.getenv('USER') + '\n' + hou.applicationVersionString(
    ) + '\n' + hou.applicationPlatformInfo() + '"'

    convert2mov_command += ' ' + mov_output_path

    print 'running "%s"' % convert2mov_command
    os.system(convert2mov_command)
Example #33
0
def hasSclAnim(node):
	parms = hou.parmTuple(node.path() + "/s")
	return ckParmsAnim(parms)