rv字幕创建


def createRVRect(sourcesNode, MessageText, displayToggle):
    rvOverlayNode = extra_commands.associatedNode('RVOverlay', sourcesNode)
    rvOverlayTextNode = '{}.rect:Black1'.format(rvOverlayNode)
    commands.newProperty('{}.width'.format(rvOverlayTextNode), commands.FloatType, 1)
    commands.newProperty('{}.height'.format(rvOverlayTextNode), commands.FloatType, 1)
    commands.newProperty('{}.color'.format(rvOverlayTextNode), commands.FloatType, 4)
    commands.newProperty('{}.position'.format(rvOverlayTextNode), commands.FloatType, 2)
    commands.newProperty('{}.active'.format(rvOverlayTextNode), commands.IntType, 1)
    
    commands.setFloatProperty('{}.width'.format(rvOverlayTextNode), [2.0], True)
    commands.setFloatProperty('{}.height'.format(rvOverlayTextNode), [0.13], True)
    commands.setFloatProperty('{}.color'.format(rvOverlayTextNode), [0.0, 0.0, 0.0, 0.0], True)
    commands.setFloatProperty('{}.position'.format(rvOverlayTextNode), [-1.0, -0.5], True)
    commands.setIntProperty('{}.active'.format(rvOverlayTextNode), [displayToggle], True)
    
    createRVOverlay(sourcesNode, -1.0, 0.5, MessageText, displayToggle)

def createRVOverlay(sourcesNode, posX, posY, MessageText, displayToggle):
    rvOverlayNode = extra_commands.associatedNode('RVOverlay', sourcesNode)
    rvOverlayTextNode = '{}.text:Message'.format(rvOverlayNode)
    commands.newProperty('{}.position'.format(rvOverlayTextNode), commands.FloatType, 2)
    commands.newProperty('{}.color'.format(rvOverlayTextNode), commands.FloatType, 4)
    commands.newProperty('{}.spacing'.format(rvOverlayTextNode), commands.FloatType, 1)
    commands.newProperty('{}.size'.format(rvOverlayTextNode), commands.FloatType, 1)
    commands.newProperty('{}.scale'.format(rvOverlayTextNode), commands.FloatType, 1)
    commands.newProperty('{}.rotation'.format(rvOverlayTextNode), commands.FloatType, 1)
    commands.newProperty('{}.font'.format(rvOverlayTextNode), commands.StringType, 1)
    commands.newProperty('{}.string'.format(rvOverlayTextNode), commands.StringType, 1)
    commands.newProperty('{}.text'.format(rvOverlayTextNode), commands.StringType, 1)
    commands.newProperty('{}.active'.format(rvOverlayTextNode), commands.IntType, 1)
    
    commands.setFloatProperty('{}.position'.format(rvOverlayTextNode), [posX, posY], True)
    commands.setFloatProperty('{}.color'.format(rvOverlayTextNode), [0.95, 0.5, 0.5, 0.8], True)
    commands.setFloatProperty('{}.spacing'.format(rvOverlayTextNode), [0.95], True)
    commands.setFloatProperty('{}.size'.format(rvOverlayTextNode), [0.002], True)
    commands.setFloatProperty('{}.scale'.format(rvOverlayTextNode), [1.0], True)
    commands.setFloatProperty('{}.rotation'.format(rvOverlayTextNode), [0.0], True)
    commands.setStringProperty('{}.font'.format(rvOverlayTextNode), [''], True)
    commands.setIntProperty('{}.active'.format(rvOverlayTextNode), [displayToggle], True)
    commands.setStringProperty('{}.text'.format(rvOverlayTextNode), [MessageText], True)

from rv import commands, runtime, extra_commands

x = '''
字幕内容'''
createRVRect(commands.nodesOfType('RVFileSource')[0], x, 1)



评论
  目录