提交 a85947a7 编写于 作者: LinuxSuRen's avatar LinuxSuRen

Put all logo files into a dir

上级 4ec7945d
此差异已折叠。
# OpenShot Video Editor is a program that creates, modifies, and edits video files.
# Copyright (C) 2009 Jonathan Thomas
#
# This file is part of OpenShot Video Editor (http://launchpad.net/openshot/).
#
# OpenShot Video Editor is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenShot Video Editor is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenShot Video Editor. If not, see <http://www.gnu.org/licenses/>.
# Import Blender's python API. This only works when the script is being
# run from the context of Blender. Blender contains its own version of Python
# with this library pre-installed.
import bpy
from bpy.props import *
from math import pi
def load_font(font_path):
""" Load a new TTF font into Blender, and return the font object """
# get the original list of fonts (before we add a new one)
original_fonts = bpy.data.fonts.keys()
# load new font
bpy.ops.font.open(filepath=font_path)
# get the new list of fonts (after we added a new one)
for font_name in bpy.data.fonts.keys():
if font_name not in original_fonts:
return bpy.data.fonts[font_name]
# no new font was added
return None
# the stuff
#
# name: createDissolveText
# @param
# @return
#
def createDissolveText(title, extrude, bevel_depth, spacemode, textsize, width, font):
""" Create aned animate the exploding texte """
# create text
bpy.ops.object.text_add(radius=1.0, enter_editmode=False, align='WORLD', location=(0.0, 0.0, 0.0), rotation=(0.0, 0.0, 0.0))
ActiveObjectText = bpy.context.view_layer.objects.active
# naming/renaming the text element
ActiveObjectText.name = 'Text'
# placing text in position
ActiveObjectText.rotation_euler[0] = pi / 2 # xaxis
ActiveObjectText.rotation_euler[1] = 0.0 # yaxis
ActiveObjectText.rotation_euler[2] = 0.0 # zaxis
ActiveObjectText.location[0] = 0
ActiveObjectText.location[1] = 0
ActiveObjectText.location[2] = 0
# changing text
ActiveObjectText.data.body = title
# text size
ActiveObjectText.data.size = textsize
ActiveObjectText.data.space_character = width
ActiveObjectText.data.font = font
# centering text
ActiveObjectText.data.align_x = spacemode
# extrude text
ActiveObjectText.data.extrude = extrude # 0.04
# bevel text
ActiveObjectText.data.bevel_depth = bevel_depth # 0.005
ActiveObjectText.data.bevel_resolution = 5
# adjust text position
ActiveObjectText.location.z = -ActiveObjectText.dimensions[1] / 3
# affect dissolve material
ActiveObjectText.data.materials.append(bpy.data.materials['DissolveMaterial'])
ActiveObjectText = bpy.context.view_layer.objects.active
# selecting Text
bpy.context.view_layer.objects.active = ActiveObjectText
# convert to mesh to apply effect
bpy.ops.object.convert(target='MESH', keep_original=False)
# add remesh modifier to text
bpy.ops.object.modifier_add(type='REMESH')
# modifying parameters
ActiveObjectText.modifiers['Remesh'].octree_depth = 9 # 10 best quality but vertices number too high
ActiveObjectText.modifiers['Remesh'].scale = 0.99
ActiveObjectText.modifiers['Remesh'].mode = 'SMOOTH'
ActiveObjectText.modifiers['Remesh'].use_remove_disconnected = False
# apply this modifier
bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Remesh")
# Nb quads for particle system
NbQuads = len(ActiveObjectText.data.polygons.values())
# Add Particle System
bpy.ops.object.particle_system_add()
# Particle parameters
ActiveObjectText.particle_systems[0].settings.count = NbQuads
ActiveObjectText.particle_systems[0].settings.frame_start = 10
ActiveObjectText.particle_systems[0].settings.frame_end = 60
ActiveObjectText.particle_systems[0].settings.lifetime = 80
ActiveObjectText.particle_systems[0].point_cache.frame_step = 1
ActiveObjectText.particle_systems[0].settings.normal_factor = 0.0
# not useful
ActiveObjectText.particle_systems[0].settings.use_dynamic_rotation = True
ActiveObjectText.particle_systems[0].settings.render_type = 'NONE'
ActiveObjectText.particle_systems[0].settings.render_type = 'OBJECT'
ActiveObjectText.particle_systems[0].settings.instance_object = bpy.data.objects['Sphere']
ActiveObjectText.particle_systems[0].settings.effector_weights.gravity = 0
ActiveObjectText.particle_systems[0].settings.use_adaptive_subframes = True
ActiveObjectText.particle_systems[0].settings.courant_target = 0.2
# Adding Wind force field on center and rotate it -90 on Y
bpy.ops.object.effector_add(type='WIND', radius=1.0, enter_editmode=False, align='WORLD', location=(0.0, 0.0, 0.0), rotation=(0, -pi / 2, 0))
ActiveObjectWindField = bpy.context.view_layer.objects.active
ActiveObjectWindField.name = 'WindField'
# settings
ActiveObjectWindField.field.strength = 1.0
ActiveObjectWindField.field.flow = 1.0
ActiveObjectWindField.field.noise = 0.0
ActiveObjectWindField.field.seed = 27
ActiveObjectWindField.field.apply_to_location = True
ActiveObjectWindField.field.apply_to_rotation = True
ActiveObjectWindField.field.use_absorption = False
# Adding Turbulence Force Field
bpy.ops.object.effector_add(type='TURBULENCE', radius=1.0, enter_editmode=False, align='WORLD', location=(0.0, 0.0, 0.0), rotation=(0, 0, 0))
ActiveObjectTurbulenceField = bpy.context.view_layer.objects.active
ActiveObjectTurbulenceField.name = 'TurbulenceField'
# settings
ActiveObjectTurbulenceField.field.strength = 15
ActiveObjectTurbulenceField.field.size = 0.75
ActiveObjectTurbulenceField.field.flow = 0.5
ActiveObjectTurbulenceField.field.seed = 23
ActiveObjectTurbulenceField.field.apply_to_location = True
ActiveObjectTurbulenceField.field.apply_to_rotation = True
ActiveObjectTurbulenceField.field.use_absorption = False
# Don't forget to deselect before select!
bpy.ops.object.select_all(action='DESELECT')
# selecting Text
bpy.context.view_layer.objects.active = ActiveObjectText
# adding wipe texture to text
sTex = bpy.data.textures.new('Wipe', type='BLEND')
sTex.use_color_ramp = True
TexSlot = ActiveObjectText.particle_systems[0].settings.texture_slots.add()
TexSlot.texture = sTex
bpy.ops.object.select_all(action='DESELECT')
# Create plane for controlling action of particle system (based on time)
# if text is created on the fly 'Wipe' texture does not work! don't know really why!
# so use of an existing plane, and resize it to the text x dimension
bpy.ops.mesh.primitive_plane_add(size=2.0, calc_uvs=True, enter_editmode=False, align='WORLD', location=(0.0, 0.0, 0.0), rotation=(pi / 2, 0, 0))
ActiveObjectPlane = bpy.context.view_layer.objects.active
ActiveObjectPlane.name = 'Plane'
# Change dimensions
ActiveObjectPlane.dimensions = ((ActiveObjectText.dimensions[0] * 1.2), (ActiveObjectText.dimensions[1] * 1.2), 0)
# hide plane for render
ActiveObjectPlane.hide_render = True
# show as wire in 3D
# TODO: Not sure how to convert draw_type = 'WIRE'. Some ideas below.
#ActiveObjectPlane.render_type = 'LINE'
#ActiveObjectPlane.display_type = 'WIRE'
#ActiveObjectPlane.show_wire = True
bpy.ops.object.select_all(action='DESELECT')
# selecting Text
bpy.context.view_layer.objects.active = ActiveObjectText
TexSlot.texture_coords = 'OBJECT'
TexSlot.object = ActiveObjectPlane
TexSlot.use_map_time = True
ActiveObjectText.data.update()
bpy.ops.object.modifier_add(type='EXPLODE')
bpy.ops.mesh.uv_texture_add() # name UVMap by default
ActiveObjectText.modifiers['Explode'].particle_uv = 'UVMap'
ActiveObjectText.data.update()
# Don't forget to deselect before select!
bpy.ops.object.select_all(action='DESELECT')
# selecting Text
bpy.context.view_layer.objects.active = ActiveObjectText
TexSlot.texture_coords = 'OBJECT'
TexSlot.object = ActiveObjectPlane
TexSlot.use_map_time = False
TexSlot.use_map_time = True
ActiveObjectText.data.update()
# Debug Info:
# ./blender -b test.blend -P demo.py
# -b = background mode
# -P = run a Python script within the context of the project file
# Init all of the variables needed by this script. Because Blender executes
# this script, OpenShot will inject a dictionary of the required parameters
# before this script is executed.
params = {
'title': 'Oh Yeah! OpenShot!',
'extrude': 0.05,
'bevel_depth': 0.01,
'spacemode': 'CENTER',
'text_size': 1,
'width': 1.0,
'fontname': 'Bfont',
'color': [0.8, 0.8, 0.8],
'alpha': 1.0,
'output_path': '/tmp/',
'fps': 24,
'quality': 90,
'file_format': 'PNG',
'color_mode': 'RGBA',
'horizon_color': [0, 0, 0],
'resolution_x': 1920,
'resolution_y': 1080,
'resolution_percentage': 100,
'start_frame': 20,
'end_frame': 25,
'animation': True,
'diffuse_color': [0.57, 0.57, 0.57, 1.0]
}
#BEGIN INJECTING PARAMS
params['file_name'] = u'TitleFileName'
params['title'] = u'My Title'
params['extrude'] = 0.05
params['bevel_depth'] = 0.01
params['fontname'] = u'Bfont'
params['spacemode'] = u'CENTER'
params['text_size'] = 2.0
params['width'] = 1.0
params['diffuse_color'] = [0.4980392156862745, 0.4980392156862745, 0.4980392156862745, 1.0]
params['start_frame'] = 1
params['end_frame'] = 128
params['animation_speed'] = u'1'
params['resolution_x'] = 1280
params['resolution_y'] = 720
params['resolution_percentage'] = 50
params['quality'] = 100
params['file_format'] = u'PNG'
params['color_mode'] = u'RGBA'
params['alpha_mode'] = 1
params['animation'] = True
params['output_path'] = u'/Users/rick/Workspace/GitHub/jenkins-zh/jenkins-open-tutorial/Jenkins-tomcat-windows_assets/blender/22DB7AFUL8/TitleFileName'
#END INJECTING PARAMS
#ONLY RENDER 1 FRAME FOR PREVIEW
params['start_frame'] = 64
params['end_frame'] = 64
#END ONLY RENDER 1 FRAME FOR PREVIEW
# The remainder of this script will modify the current Blender .blend project
# file, and adjust the settings. The .blend file is specified in the XML file
# that defines this template in OpenShot.
# ----------------------------------------------------------------------------
# Get font object
font = None
if params["fontname"] != "Bfont":
# Add font so it's available to Blender
font = load_font(params["fontname"])
else:
# Get default font
font = bpy.data.fonts["Bfont"]
# Create dissolve text changes (slow)
createDissolveText(params["title"], params["extrude"], params["bevel_depth"], params["spacemode"], params["text_size"], params["width"], font)
# Change the material settings (color, alpha, etc...)
material_object = bpy.data.materials["DissolveMaterial"]
print(material_object)
material_object.node_tree.nodes[1].inputs[17].default_value = params["diffuse_color"]
material_object = bpy.data.materials["TextMaterial"]
print(material_object)
material_object.node_tree.nodes[1].inputs[17].default_value = params["diffuse_color"]
# Set the render options. It is important that these are set
# to the same values as the current OpenShot project. These
# params are automatically set by OpenShot
bpy.context.scene.render.filepath = params["output_path"]
bpy.context.scene.render.fps = params["fps"]
bpy.context.scene.render.image_settings.file_format = params["file_format"]
bpy.context.scene.render.image_settings.color_mode = params["color_mode"]
bpy.context.scene.render.film_transparent = params["alpha_mode"]
bpy.data.worlds[0].color = params["horizon_color"]
bpy.context.scene.render.resolution_x = params["resolution_x"]
bpy.context.scene.render.resolution_y = params["resolution_y"]
bpy.context.scene.render.resolution_percentage = params["resolution_percentage"]
bpy.context.scene.frame_start = params["start_frame"]
bpy.context.scene.frame_end = params["end_frame"]
# Animation Speed (use Blender's time remapping to slow or speed up animation)
animation_speed = int(params["animation_speed"]) # time remapping multiplier
new_length = int(params["end_frame"]) * animation_speed # new length (in frames)
bpy.context.scene.frame_end = new_length
bpy.context.scene.render.frame_map_old = 1
bpy.context.scene.render.frame_map_new = animation_speed
if params["start_frame"] == params["end_frame"]:
bpy.context.scene.frame_start = params["end_frame"]
bpy.context.scene.frame_end = params["end_frame"]
# Render the current animation to the params["output_path"] folder
bpy.ops.render.render(animation=params["animation"])
# OpenShot Video Editor is a program that creates, modifies, and edits video files.
# Copyright (C) 2009 Jonathan Thomas
#
# This file is part of OpenShot Video Editor (http://launchpad.net/openshot/).
#
# OpenShot Video Editor is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenShot Video Editor is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenShot Video Editor. If not, see <http://www.gnu.org/licenses/>.
# Import Blender's python API. This only works when the script is being
# run from the context of Blender. Blender contains it's own version of Python
# with this library pre-installed.
import bpy
def load_font(font_path):
""" Load a new TTF font into Blender, and return the font object """
# get the original list of fonts (before we add a new one)
original_fonts = bpy.data.fonts.keys()
# load new font
bpy.ops.font.open(filepath=font_path)
# get the new list of fonts (after we added a new one)
for font_name in bpy.data.fonts.keys():
if font_name not in original_fonts:
return bpy.data.fonts[font_name]
# no new font was added
return None
# Debug Info:
# ./blender -b test.blend -P demo.py
# -b = background mode
# -P = run a Python script within the context of the project file
# Init all of the variables needed by this script. Because Blender executes
# this script, OpenShot will inject a dictionary of the required parameters
# before this script is executed.
params = {
'title': 'Oh Yeah! OpenShot!',
'extrude': 0.1,
'bevel_depth': 0.02,
'spacemode': 'CENTER',
'text_size': 1.5,
'width': 1.0,
'fontname': 'Bfont',
'color': [0.8, 0.8, 0.8],
'alpha': 1.0,
'output_path': '/tmp/',
'fps': 24,
'quality': 90,
'file_format': 'PNG',
'color_mode': 'RGBA',
'horizon_color': [0.57, 0.57, 0.57],
'resolution_x': 1920,
'resolution_y': 1080,
'resolution_percentage': 100,
'start_frame': 20,
'end_frame': 25,
'animation': True,
}
#BEGIN INJECTING PARAMS
params['file_name'] = u'TitleFileName'
params['Alongtimeago'] = u'A long time ago in a video\neditor far, far away...'
params['TitleSpaceMovie'] = u'open\nshot'
params['Episode'] = u'Episode IV'
params['EpisodeTitle'] = u'A NEW OPENSHOT'
params['MainText'] = u'It is a period of software war. Free software developers have won some battles with free, and open-source applications. They leave the source code available for everybody in the Galaxy, allowing people to access software knowledge and truth.\n\nBut the EULA Galactic Empire is not dead and prepares its revenge with an ultimate weapon: the blue screen of DEATH. This armored system can anihilate an entire device by a simple segfault.\n\nBut the rebel hackers have a secret weapon too: an atomic penguin which protects them from almost all digital injuries...'
params['start_frame'] = 1
params['end_frame'] = 210
params['animation_speed'] = u'1'
params['title'] = u'Title'
params['extrude'] = 0.1
params['bevel_depth'] = 0.02
params['fontname'] = u'Bfont'
params['spacemode'] = u'CENTER'
params['text_size'] = 1.0
params['width'] = 1.0
params['diffuse_color'] = [0.15294117647058825, 0.058823529411764705, 0.0, 1.0]
params['specular_color'] = [1.0, 1.0, 1.0]
params['specular_intensity'] = 0.5
params['use_alpha'] = u'Yes'
params['thickness'] = 0.01
params['title1'] = u'Title 1'
params['start_x'] = -2.4
params['start_z'] = 0.6
params['diffuse_color_bg'] = [0.8745098039215686, 0.8627450980392157, 0.9058823529411765, 1.0]
params['specular_color_bg'] = [1.0, 1.0, 1.0]
params['specular_intensity_bg'] = 0.5
params['alpha_bg'] = 0.733
params['sub_title'] = u'Sub Title'
params['resolution_x'] = 1280
params['resolution_y'] = 720
params['resolution_percentage'] = 50
params['quality'] = 100
params['file_format'] = u'PNG'
params['color_mode'] = u'RGBA'
params['alpha_mode'] = 1
params['animation'] = True
params['output_path'] = u'/Users/rick/Workspace/GitHub/jenkins-zh/jenkins-open-tutorial/template_assets/blender/6GD56836DN/TitleFileName'
#END INJECTING PARAMS
#ONLY RENDER 1 FRAME FOR PREVIEW
params['start_frame'] = 105
params['end_frame'] = 105
#END ONLY RENDER 1 FRAME FOR PREVIEW
# The remainder of this script will modify the current Blender .blend project
# file, and adjust the settings. The .blend file is specified in the XML file
# that defines this template in OpenShot.
# ----------------------------------------------------------------------------
# Modify Text / Curve settings
#print (bpy.data.curves.keys())
text_object = bpy.data.curves["Title"]
text_object.extrude = params["extrude"]
text_object.bevel_depth = params["bevel_depth"]
text_object.body = params["title"]
text_object.align_x = params["spacemode"]
text_object.size = params["text_size"]
text_object.space_character = params["width"]
# Get font object
font = None
if params["fontname"] != "Bfont":
# Add font so it's available to Blender
font = load_font(params["fontname"])
else:
# Get default font
font = bpy.data.fonts["Bfont"]
text_object.font = font
text_object = bpy.data.curves["Subtitle"]
text_object.extrude = params["extrude"]
text_object.bevel_depth = params["bevel_depth"]
text_object.body = params["sub_title"]
text_object.align_x = params["spacemode"]
text_object.size = params["text_size"]
text_object.space_character = params["width"]
# set the font
text_object.font = font
# Change the material settings (color, alpha, etc...)
material_object = bpy.data.materials["Text"]
material_object.diffuse_color = params["diffuse_color"]
material_object.specular_color = params["specular_color"]
material_object.specular_intensity = params["specular_intensity"]
# Set the render options. It is important that these are set
# to the same values as the current OpenShot project. These
# params are automatically set by OpenShot
bpy.context.scene.render.filepath = params["output_path"]
bpy.context.scene.render.fps = params["fps"]
bpy.context.scene.render.image_settings.file_format = params["file_format"]
bpy.context.scene.render.image_settings.color_mode = params["color_mode"]
bpy.context.scene.render.film_transparent = params["alpha_mode"]
bpy.data.worlds[0].color = params["horizon_color"]
bpy.context.scene.render.resolution_x = params["resolution_x"]
bpy.context.scene.render.resolution_y = params["resolution_y"]
bpy.context.scene.render.resolution_percentage = params["resolution_percentage"]
bpy.context.scene.frame_start = params["start_frame"]
bpy.context.scene.frame_end = params["end_frame"]
# Animation Speed (use Blender's time remapping to slow or speed up animation)
animation_speed = int(params["animation_speed"]) # time remapping multiplier
new_length = int(params["end_frame"]) * animation_speed # new length (in frames)
bpy.context.scene.frame_end = new_length
bpy.context.scene.render.frame_map_old = 1
bpy.context.scene.render.frame_map_new = animation_speed
if params["start_frame"] == params["end_frame"]:
bpy.context.scene.frame_start = params["end_frame"]
bpy.context.scene.frame_end = params["end_frame"]
# Render the current animation to the params["output_path"] folder
bpy.ops.render.render(animation=params["animation"])
# OpenShot Video Editor is a program that creates, modifies, and edits video files.
# Copyright (C) 2009 Jonathan Thomas
#
# This file is part of OpenShot Video Editor (http://launchpad.net/openshot/).
#
# OpenShot Video Editor is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenShot Video Editor is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenShot Video Editor. If not, see <http://www.gnu.org/licenses/>.
# Import Blender's python API. This only works when the script is being
# run from the context of Blender. Blender contains it's own version of Python
# with this library pre-installed.
import bpy
def load_font(font_path):
""" Load a new TTF font into Blender, and return the font object """
# get the original list of fonts (before we add a new one)
original_fonts = bpy.data.fonts.keys()
# load new font
bpy.ops.font.open(filepath=font_path)
# get the new list of fonts (after we added a new one)
for font_name in bpy.data.fonts.keys():
if font_name not in original_fonts:
return bpy.data.fonts[font_name]
# no new font was added
return None
# Debug Info:
# ./blender -b test.blend -P demo.py
# -b = background mode
# -P = run a Python script within the context of the project file
# Init all of the variables needed by this script. Because Blender executes
# this script, OpenShot will inject a dictionary of the required parameters
# before this script is executed.
params = {
'title': 'Oh Yeah! OpenShot!',
'extrude': 0.1,
'bevel_depth': 0.02,
'spacemode': 'CENTER',
'text_size': 1.5,
'width': 1.0,
'fontname': 'Bfont',
'color': [0.8, 0.8, 0.8],
'alpha': 1.0,
'output_path': '/tmp/',
'fps': 24,
'quality': 90,
'file_format': 'PNG',
'color_mode': 'RGBA',
'horizon_color': [0.7, 0.7, 0.7],
'resolution_x': 1920,
'resolution_y': 1080,
'resolution_percentage': 100,
'start_frame': 20,
'end_frame': 25,
'animation': True,
'thickness': 0.015,
}
#BEGIN INJECTING PARAMS
params['file_name'] = u'TitleFileName'
params['Alongtimeago'] = u'A long time ago in a video\neditor far, far away...'
params['TitleSpaceMovie'] = u'open\nshot'
params['Episode'] = u'Episode IV'
params['EpisodeTitle'] = u'A NEW OPENSHOT'
params['MainText'] = u'It is a period of software war. Free software developers have won some battles with free, and open-source applications. They leave the source code available for everybody in the Galaxy, allowing people to access software knowledge and truth.\n\nBut the EULA Galactic Empire is not dead and prepares its revenge with an ultimate weapon: the blue screen of DEATH. This armored system can anihilate an entire device by a simple segfault.\n\nBut the rebel hackers have a secret weapon too: an atomic penguin which protects them from almost all digital injuries...'
params['start_frame'] = 1
params['end_frame'] = 250
params['animation_speed'] = u'1'
params['title'] = u'My Title'
params['extrude'] = 0.259
params['bevel_depth'] = 0.016
params['fontname'] = u'Bfont'
params['spacemode'] = u'CENTER'
params['text_size'] = 1.0
params['width'] = 1.0
params['diffuse_color'] = [0.0, 0.4549019607843137, 0.9058823529411765, 1.0]
params['specular_color'] = [0.0, 0.7411764705882353, 1.0]
params['specular_intensity'] = 0.5
params['use_alpha'] = u'Yes'
params['thickness'] = 0.01
params['resolution_x'] = 1280
params['resolution_y'] = 720
params['resolution_percentage'] = 50
params['quality'] = 100
params['file_format'] = u'PNG'
params['color_mode'] = u'RGBA'
params['alpha_mode'] = 1
params['animation'] = True
params['output_path'] = u'/Users/rick/Workspace/GitHub/jenkins-zh/jenkins-open-tutorial/template_assets/blender/9FX2M8V087/TitleFileName'
#END INJECTING PARAMS
#ONLY RENDER 1 FRAME FOR PREVIEW
params['start_frame'] = 125
params['end_frame'] = 125
#END ONLY RENDER 1 FRAME FOR PREVIEW
# The remainder of this script will modify the current Blender .blend project
# file, and adjust the settings. The .blend file is specified in the XML file
# that defines this template in OpenShot.
# ----------------------------------------------------------------------------
# Modify Text / Curve settings
#print (bpy.data.curves.keys())
text_object = bpy.data.curves["Text"]
text_object.extrude = params["extrude"]
text_object.bevel_depth = params["bevel_depth"]
text_object.body = params["title"]
text_object.align_x = params["spacemode"]
text_object.size = params["text_size"]
text_object.space_character = params["width"]
# Get font object
font = None
if params["fontname"] != "Bfont":
# Add font so it's available to Blender
font = load_font(params["fontname"])
else:
# Get default font
font = bpy.data.fonts["Bfont"]
# set the font
text_object.font = font
# Change the material settings (color, alpha, etc...)
material_object = bpy.data.materials["Material.001"]
material_object.diffuse_color = params["diffuse_color"]
material_object.specular_color = params["specular_color"]
material_object.specular_intensity = params["specular_intensity"]
# Convert to mesh to apply effect
bpy.ops.object.convert(target='MESH', keep_original=False)
ActiveObjectText = bpy.context.view_layer.objects.active
# Add Wireframe modifier to new mesh
bpy.ops.object.modifier_add(type='WIREFRAME')
ActiveObjectText.modifiers['Wireframe'].use_even_offset = False
ActiveObjectText.modifiers['Wireframe'].thickness = params["thickness"]
# Set the render options. It is important that these are set
# to the same values as the current OpenShot project. These
# params are automatically set by OpenShot
bpy.context.scene.render.filepath = params["output_path"]
bpy.context.scene.render.fps = params["fps"]
bpy.context.scene.render.image_settings.file_format = params["file_format"]
bpy.context.scene.render.image_settings.color_mode = params["color_mode"]
bpy.context.scene.render.film_transparent = params["alpha_mode"]
bpy.data.worlds[0].color = params["horizon_color"]
bpy.context.scene.render.resolution_x = params["resolution_x"]
bpy.context.scene.render.resolution_y = params["resolution_y"]
bpy.context.scene.render.resolution_percentage = params["resolution_percentage"]
bpy.context.scene.frame_start = params["start_frame"]
bpy.context.scene.frame_end = params["end_frame"]
# Animation Speed (use Blender's time remapping to slow or speed up animation)
animation_speed = int(params["animation_speed"]) # time remapping multiplier
new_length = int(params["end_frame"]) * animation_speed # new length (in frames)
bpy.context.scene.frame_end = new_length
bpy.context.scene.render.frame_map_old = 1
bpy.context.scene.render.frame_map_new = animation_speed
if params["start_frame"] == params["end_frame"]:
bpy.context.scene.frame_start = params["end_frame"]
bpy.context.scene.frame_end = params["end_frame"]
# Render the current animation to the params["output_path"] folder
bpy.ops.render.render(animation=params["animation"])
# OpenShot Video Editor is a program that creates, modifies, and edits video files.
# Copyright (C) 2009 Jonathan Thomas
#
# This file is part of OpenShot Video Editor (http://launchpad.net/openshot/).
#
# OpenShot Video Editor is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenShot Video Editor is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenShot Video Editor. If not, see <http://www.gnu.org/licenses/>.
# Import Blender's python API. This only works when the script is being
# run from the context of Blender. Blender contains it's own version of Python
# with this library pre-installed.
import bpy
def load_font(font_path):
""" Load a new TTF font into Blender, and return the font object """
# get the original list of fonts (before we add a new one)
original_fonts = bpy.data.fonts.keys()
# load new font
bpy.ops.font.open(filepath=font_path)
# get the new list of fonts (after we added a new one)
for font_name in bpy.data.fonts.keys():
if font_name not in original_fonts:
return bpy.data.fonts[font_name]
# no new font was added
return None
# Debug Info:
# ./blender -b test.blend -P demo.py
# -b = background mode
# -P = run a Python script within the context of the project file
# Init all of the variables needed by this script. Because Blender executes
# this script, OpenShot will inject a dictionary of the required parameters
# before this script is executed.
params = {
'title': 'Oh Yeah! OpenShot!',
'extrude': 0.1,
'bevel_depth': 0.02,
'spacemode': 'LEFT',
'text_size': 1.5,
'width': 1.0,
'fontname': 'Bfont',
'color': [0.8, 0.8, 0.8],
'alpha': 1.0,
'output_path': '/tmp/',
'fps': 24,
'quality': 90,
'file_format': 'PNG',
'color_mode': 'RGBA',
'horizon_color': [0.57, 0.57, 0.57],
'resolution_x': 1920,
'resolution_y': 1080,
'resolution_percentage': 100,
'start_frame': 20,
'end_frame': 25,
'animation': True,
}
#BEGIN INJECTING PARAMS
params['file_name'] = u'TitleFileName'
params['Alongtimeago'] = u'A long time ago in a video\neditor far, far away...'
params['TitleSpaceMovie'] = u'open\nshot'
params['Episode'] = u'Episode IV'
params['EpisodeTitle'] = u'A NEW OPENSHOT'
params['MainText'] = u'It is a period of software war. Free software developers have won some battles with free, and open-source applications. They leave the source code available for everybody in the Galaxy, allowing people to access software knowledge and truth.\n\nBut the EULA Galactic Empire is not dead and prepares its revenge with an ultimate weapon: the blue screen of DEATH. This armored system can anihilate an entire device by a simple segfault.\n\nBut the rebel hackers have a secret weapon too: an atomic penguin which protects them from almost all digital injuries...'
params['start_frame'] = 1
params['end_frame'] = 180
params['animation_speed'] = u'1'
params['title'] = u'My Title'
params['extrude'] = 0.0
params['bevel_depth'] = 0.02
params['fontname'] = u'Bfont'
params['spacemode'] = u'CENTER'
params['text_size'] = 1.0
params['width'] = 1.0
params['diffuse_color'] = [1.0, 1.0, 1.0, 1.0]
params['specular_color'] = [1.0, 1.0, 1.0]
params['specular_intensity'] = 0.5
params['use_alpha'] = u'Yes'
params['thickness'] = 0.01
params['title1'] = u'Title 1'
params['start_x'] = -2.4
params['start_z'] = 0.6
params['diffuse_color_bg'] = [0.8745098039215686, 0.8627450980392157, 0.9058823529411765, 1.0]
params['specular_color_bg'] = [1.0, 1.0, 1.0]
params['specular_intensity_bg'] = 0.5
params['alpha_bg'] = 0.733
params['resolution_x'] = 1280
params['resolution_y'] = 720
params['resolution_percentage'] = 50
params['quality'] = 100
params['file_format'] = u'PNG'
params['color_mode'] = u'RGBA'
params['alpha_mode'] = 1
params['animation'] = True
params['output_path'] = u'/Users/rick/Workspace/GitHub/jenkins-zh/jenkins-open-tutorial/template_assets/blender/AL1PE2MZFW/TitleFileName'
#END INJECTING PARAMS
#ONLY RENDER 1 FRAME FOR PREVIEW
params['start_frame'] = 90
params['end_frame'] = 90
#END ONLY RENDER 1 FRAME FOR PREVIEW
# The remainder of this script will modify the current Blender .blend project
# file, and adjust the settings. The .blend file is specified in the XML file
# that defines this template in OpenShot.
# ----------------------------------------------------------------------------
# TITLE 1 - Modify Text / Curve settings
text_object1 = bpy.data.curves["Title1"]
text_object1.extrude = params["extrude"]
text_object1.bevel_depth = params["bevel_depth"]
text_object1.body = params["title1"]
text_object1.align_x = params["spacemode"]
text_object1.size = params["text_size"]
text_object1.space_character = params["width"]
# Get font object
font = None
if params["fontname"] != "Bfont":
# Add font so it's available to Blender
font = load_font(params["fontname"])
else:
# Get default font
font = bpy.data.fonts["Bfont"]
text_object1.font = font
# TITLE - Change the material settings (color, alpha, etc...)
material_object1 = bpy.data.materials["Title.Material"]
material_object1.diffuse_color = params["diffuse_color"]
material_object1.specular_color = params["specular_color"]
material_object1.specular_intensity = params["specular_intensity"]
bpy.data.materials["Title.Material"].node_tree.nodes[1].inputs[0].default_value = params["diffuse_color"]
# GLASS - Change the material settings (color, alpha, etc...)
material_object2 = bpy.data.materials["Background.Material"]
material_object2.diffuse_color = params["diffuse_color_bg"]
material_object2.specular_color = params["specular_color_bg"]
material_object2.specular_intensity = params["specular_intensity_bg"]
bpy.data.materials["Background.Material"].node_tree.nodes[1].inputs[0].default_value = params["diffuse_color_bg"]
bpy.data.materials["Background.Material"].node_tree.nodes[1].inputs[18].default_value = params["alpha_bg"]
# ADJUST STARTING POSITION (Keyframes)
bpy.data.actions["TextAction"].fcurves[0].keyframe_points[0].co = (40.0, params["start_x"])
bpy.data.actions["TextAction"].fcurves[0].keyframe_points[0].handle_left.y = params["start_x"]
bpy.data.actions["TextAction"].fcurves[0].keyframe_points[0].handle_right.y = params["start_x"]
bpy.data.actions["TextAction"].fcurves[0].keyframe_points[1].co = (80.0, params["start_x"])
bpy.data.actions["TextAction"].fcurves[0].keyframe_points[1].handle_left.y = params["start_x"]
bpy.data.actions["TextAction"].fcurves[0].keyframe_points[1].handle_right.y = params["start_x"]
bpy.data.actions["TextAction"].fcurves[2].keyframe_points[1].co = (80.0, params["start_z"])
bpy.data.actions["TextAction"].fcurves[2].keyframe_points[1].handle_left.y = params["start_z"]
bpy.data.actions["TextAction"].fcurves[2].keyframe_points[1].handle_right.y = params["start_z"]
bpy.data.actions["TextAction"].fcurves[0].keyframe_points[2].co = (150.0, params["start_x"])
bpy.data.actions["TextAction"].fcurves[0].keyframe_points[2].handle_left.y = params["start_x"]
bpy.data.actions["TextAction"].fcurves[0].keyframe_points[2].handle_right.y = params["start_x"]
bpy.data.actions["TextAction"].fcurves[2].keyframe_points[2].co = (150.0, params["start_z"])
bpy.data.actions["TextAction"].fcurves[2].keyframe_points[2].handle_left.y = params["start_z"]
bpy.data.actions["TextAction"].fcurves[2].keyframe_points[2].handle_right.y = params["start_z"]
bpy.data.actions["TextAction"].fcurves[0].keyframe_points[3].co = (190.0, params["start_x"])
bpy.data.actions["TextAction"].fcurves[0].keyframe_points[3].handle_left.y = params["start_x"]
bpy.data.actions["TextAction"].fcurves[0].keyframe_points[3].handle_right.y = params["start_x"]
# Set the render options. It is important that these are set
# to the same values as the current OpenShot project. These
# params are automatically set by OpenShot
bpy.context.scene.render.filepath = params["output_path"]
bpy.context.scene.render.fps = params["fps"]
bpy.context.scene.render.image_settings.file_format = params["file_format"]
bpy.context.scene.render.image_settings.color_mode = params["color_mode"]
bpy.context.scene.render.film_transparent = params["alpha_mode"]
bpy.context.scene.render.resolution_x = params["resolution_x"]
bpy.context.scene.render.resolution_y = params["resolution_y"]
bpy.context.scene.render.resolution_percentage = params["resolution_percentage"]
bpy.context.scene.frame_start = params["start_frame"]
bpy.context.scene.frame_end = params["end_frame"]
# Animation Speed (use Blender's time remapping to slow or speed up animation)
animation_speed = int(params["animation_speed"]) # time remapping multiplier
new_length = int(params["end_frame"]) * animation_speed # new length (in frames)
bpy.context.scene.frame_end = new_length
bpy.context.scene.render.frame_map_old = 1
bpy.context.scene.render.frame_map_new = animation_speed
if params["start_frame"] == params["end_frame"]:
bpy.context.scene.frame_start = params["end_frame"]
bpy.context.scene.frame_end = params["end_frame"]
# Render the current animation to the params["output_path"] folder
bpy.ops.render.render(animation=params["animation"])
# OpenShot Video Editor is a program that creates, modifies, and edits video files.
# Copyright (C) 2009 Jonathan Thomas
#
# This file is part of OpenShot Video Editor (http://launchpad.net/openshot/).
#
# OpenShot Video Editor is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenShot Video Editor is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenShot Video Editor. If not, see <http://www.gnu.org/licenses/>.
# Import Blender's python API. This only works when the script is being
# run from the context of Blender. Blender contains it's own version of Python
# with this library pre-installed.
import bpy
def load_font(font_path):
""" Load a new TTF font into Blender, and return the font object """
# get the original list of fonts (before we add a new one)
original_fonts = bpy.data.fonts.keys()
# load new font
bpy.ops.font.open(filepath=font_path)
# get the new list of fonts (after we added a new one)
for font_name in bpy.data.fonts.keys():
if font_name not in original_fonts:
return bpy.data.fonts[font_name]
# no new font was added
return None
# Debug Info:
# ./blender -b test.blend -P demo.py
# -b = background mode
# -P = run a Python script within the context of the project file
# Init all of the variables needed by this script. Because Blender executes
# this script, OpenShot will inject a dictionary of the required parameters
# before this script is executed.
params = {
'title': 'Oh Yeah! OpenShot!',
'extrude': 0.1,
'bevel_depth': 0.02,
'spacemode': 'CENTER',
'text_size': 1.5,
'width': 1.0,
'fontname': 'Bfont',
'color': [0.8, 0.8, 0.8],
'alpha': 1.0,
'output_path': '/tmp/',
'fps': 24,
'quality': 90,
'file_format': 'PNG',
'color_mode': 'RGBA',
'horizon_color': [0.57, 0.57, 0.57],
'resolution_x': 1920,
'resolution_y': 1080,
'resolution_percentage': 100,
'start_frame': 20,
'end_frame': 25,
'animation': True,
}
#BEGIN INJECTING PARAMS
params['file_name'] = u'TitleFileName'
params['Alongtimeago'] = u'A long time ago in a video\neditor far, far away...'
params['TitleSpaceMovie'] = u'open\nshot'
params['Episode'] = u'Episode IV'
params['EpisodeTitle'] = u'A NEW OPENSHOT'
params['MainText'] = u'It is a period of software war. Free software developers have won some battles with free, and open-source applications. They leave the source code available for everybody in the Galaxy, allowing people to access software knowledge and truth.\n\nBut the EULA Galactic Empire is not dead and prepares its revenge with an ultimate weapon: the blue screen of DEATH. This armored system can anihilate an entire device by a simple segfault.\n\nBut the rebel hackers have a secret weapon too: an atomic penguin which protects them from almost all digital injuries...'
params['start_frame'] = 1
params['end_frame'] = 120
params['animation_speed'] = u'1'
params['title'] = u'My Title'
params['extrude'] = 0.1
params['bevel_depth'] = 0.02
params['fontname'] = u'Bfont'
params['spacemode'] = u'CENTER'
params['text_size'] = 1.0
params['width'] = 1.0
params['diffuse_color'] = [1.0, 1.0, 1.0, 1.0]
params['specular_color'] = [1.0, 1.0, 1.0]
params['specular_intensity'] = 0.5
params['use_alpha'] = u'Yes'
params['resolution_x'] = 1280
params['resolution_y'] = 720
params['resolution_percentage'] = 50
params['quality'] = 100
params['file_format'] = u'PNG'
params['color_mode'] = u'RGBA'
params['alpha_mode'] = 1
params['animation'] = True
params['output_path'] = u'/Users/rick/Workspace/GitHub/jenkins-zh/jenkins-open-tutorial/template_assets/blender/C7NRBSNRYP/TitleFileName'
#END INJECTING PARAMS
#ONLY RENDER 1 FRAME FOR PREVIEW
params['start_frame'] = 60
params['end_frame'] = 60
#END ONLY RENDER 1 FRAME FOR PREVIEW
# The remainder of this script will modify the current Blender .blend project
# file, and adjust the settings. The .blend file is specified in the XML file
# that defines this template in OpenShot.
# ----------------------------------------------------------------------------
# Modify Text / Curve settings
#print (bpy.data.curves.keys())
text_object = bpy.data.curves["Text"]
text_object.extrude = params["extrude"]
text_object.bevel_depth = params["bevel_depth"]
text_object.body = params["title"]
text_object.align_x = params["spacemode"]
text_object.size = params["text_size"]
text_object.space_character = params["width"]
# Get font object
font = None
if params["fontname"] != "Bfont":
# Add font so it's available to Blender
font = load_font(params["fontname"])
else:
# Get default font
font = bpy.data.fonts["Bfont"]
text_object.font = font
# Change the material settings (color, alpha, etc...)
material_object = bpy.data.materials["Material"]
material_object.diffuse_color = params["diffuse_color"]
material_object.specular_color = params["specular_color"]
material_object.specular_intensity = params["specular_intensity"]
# Set the render options. It is important that these are set
# to the same values as the current OpenShot project. These
# params are automatically set by OpenShot
bpy.context.scene.render.filepath = params["output_path"]
bpy.context.scene.render.fps = params["fps"]
bpy.context.scene.render.image_settings.file_format = params["file_format"]
if params["use_alpha"] == "No":
bpy.context.scene.render.image_settings.color_mode = "RGB"
else:
bpy.context.scene.render.image_settings.color_mode = params["color_mode"]
bpy.context.scene.render.film_transparent = params["alpha_mode"]
bpy.context.scene.render.resolution_x = params["resolution_x"]
bpy.context.scene.render.resolution_y = params["resolution_y"]
bpy.context.scene.render.resolution_percentage = params["resolution_percentage"]
bpy.context.scene.frame_start = params["start_frame"]
bpy.context.scene.frame_end = params["end_frame"]
# Animation Speed (use Blender's time remapping to slow or speed up animation)
animation_speed = int(params["animation_speed"]) # time remapping multiplier
new_length = int(params["end_frame"]) * animation_speed # new length (in frames)
bpy.context.scene.frame_end = new_length
bpy.context.scene.render.frame_map_old = 1
bpy.context.scene.render.frame_map_new = animation_speed
if params["start_frame"] == params["end_frame"]:
bpy.context.scene.frame_start = params["end_frame"]
bpy.context.scene.frame_end = params["end_frame"]
# Render the current animation to the params["output_path"] folder
bpy.ops.render.render(animation=params["animation"])
# OpenShot Video Editor is a program that creates, modifies, and edits video files.
# Copyright (C) 2009 Jonathan Thomas
#
# This file is part of OpenShot Video Editor (http://launchpad.net/openshot/).
#
# OpenShot Video Editor is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenShot Video Editor is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenShot Video Editor. If not, see <http://www.gnu.org/licenses/>.
# Import Blender's python API. This only works when the script is being
# run from the context of Blender. Blender contains it's own version of Python
# with this library pre-installed.
import bpy
def load_font(font_path):
""" Load a new TTF font into Blender, and return the font object """
# get the original list of fonts (before we add a new one)
original_fonts = bpy.data.fonts.keys()
# load new font
bpy.ops.font.open(filepath=font_path)
# get the new list of fonts (after we added a new one)
for font_name in bpy.data.fonts.keys():
if font_name not in original_fonts:
return bpy.data.fonts[font_name]
# no new font was added
return None
# Debug Info:
# ./blender -b test.blend -P demo.py
# -b = background mode
# -P = run a Python script within the context of the project file
# Init all of the variables needed by this script. Because Blender executes
# this script, OpenShot will inject a dictionary of the required parameters
# before this script is executed.
params = {
'title': 'Oh Yeah! OpenShot!',
'Alongtimeago': 'Some cycles ago, in The Grid\nfar, far inside....',
'Episode': 'Episode I.V',
'EpisodeTitle': 'A NEW OPENSHOT',
'TitleSpaceMovie': 'Space\nMovie',
'MainText': 'It is a period of software war. Free software developers have won some battles with free, and open-source applications. They leave the source code available for everybody in the Galaxy, allowing people to access software knowledge and truth.\n\nBut the EULA Galactic Empire is not dead and prepares its revenge with an ultimate weapon: the blue screen of DEATH. This armored system can anihilate an entire device by a simple segfault.\n\nBut the rebel hackers have a secret weapon too: an atomic penguin which protects them from almost all digital injuries...',
'extrude': 0.1,
'bevel_depth': 0.02,
'spacemode': 'CENTER',
'text_size': 1.5,
'width': 1.0,
'fontname': 'Bfont',
'color': [0.8, 0.8, 0.8],
'alpha': 1.0,
'output_path': '/tmp/',
'fps': 24,
'quality': 90,
'file_format': 'PNG',
'color_mode': 'RGBA',
'horizon_color': [0.0, 0.0, 0.0],
'resolution_x': 1920,
'resolution_y': 1080,
'resolution_percentage': 100,
'start_frame': 1,
'end_frame': 2232,
'animation': True,
}
#BEGIN INJECTING PARAMS
params['file_name'] = u'TitleFileName'
params['Alongtimeago'] = u'A long time ago in a video\neditor far, far away...'
params['TitleSpaceMovie'] = u'open\nshot'
params['Episode'] = u'Episode IV'
params['EpisodeTitle'] = u'A NEW OPENSHOT'
params['MainText'] = u'It is a period of software war. Free software developers have won some battles with free, and open-source applications. They leave the source code available for everybody in the Galaxy, allowing people to access software knowledge and truth.\n\nBut the EULA Galactic Empire is not dead and prepares its revenge with an ultimate weapon: the blue screen of DEATH. This armored system can anihilate an entire device by a simple segfault.\n\nBut the rebel hackers have a secret weapon too: an atomic penguin which protects them from almost all digital injuries...'
params['start_frame'] = 1
params['end_frame'] = 2232
params['animation_speed'] = u'1'
params['resolution_x'] = 1280
params['resolution_y'] = 720
params['resolution_percentage'] = 50
params['quality'] = 100
params['file_format'] = u'PNG'
params['color_mode'] = u'RGBA'
params['alpha_mode'] = 1
params['animation'] = True
params['output_path'] = u'/Users/rick/Workspace/GitHub/jenkins-zh/jenkins-open-tutorial/template_assets/blender/LSQTIYN8T3/TitleFileName'
#END INJECTING PARAMS
#ONLY RENDER 1 FRAME FOR PREVIEW
params['start_frame'] = 1116
params['end_frame'] = 1116
#END ONLY RENDER 1 FRAME FOR PREVIEW
# The remainder of this script will modify the current Blender .blend project
# file, and adjust the settings. The .blend file is specified in the XML file
# that defines this template in OpenShot.
# ----------------------------------------------------------------------------
# Modify Text / Curve settings
#print (bpy.data.curves.keys())
bpy.data.objects['Alongtimeago'].data.body = params['Alongtimeago']
bpy.data.objects['Episode'].data.body = params['Episode']
bpy.data.objects['EpisodeTitle'].data.body = params['EpisodeTitle']
bpy.data.objects['TitleSpaceMovie'].data.body = params['TitleSpaceMovie']
bpy.data.objects['MainText'].data.body = params['MainText']
# Set the render options. It is important that these are set
# to the same values as the current OpenShot project. These
# params are automatically set by OpenShot
bpy.context.scene.render.filepath = params["output_path"]
bpy.context.scene.render.fps = params["fps"]
bpy.context.scene.render.image_settings.file_format = params["file_format"]
bpy.context.scene.render.image_settings.color_mode = params["color_mode"]
bpy.context.scene.render.film_transparent = params["alpha_mode"]
bpy.data.worlds[0].color = params["horizon_color"]
bpy.context.scene.render.resolution_x = params["resolution_x"]
bpy.context.scene.render.resolution_y = params["resolution_y"]
bpy.context.scene.render.resolution_percentage = params["resolution_percentage"]
bpy.context.scene.frame_start = params["start_frame"]
bpy.context.scene.frame_end = params["end_frame"]
# Animation Speed (use Blender's time remapping to slow or speed up animation)
animation_speed = int(params["animation_speed"]) # time remapping multiplier
new_length = int(params["end_frame"]) * animation_speed # new length (in frames)
bpy.context.scene.frame_end = new_length
bpy.context.scene.render.frame_map_old = 1
bpy.context.scene.render.frame_map_new = animation_speed
if params["start_frame"] == params["end_frame"]:
bpy.context.scene.frame_start = params["end_frame"]
bpy.context.scene.frame_end = params["end_frame"]
# Render the current animation to the params["output_path"] folder
bpy.ops.render.render(animation=params["animation"])
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册