~ubuntu-branches/debian/sid/openshot/sid

« back to all changes in this revision

Viewing changes to openshot/blender/scripts/neon_curves.py

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Thomas
  • Date: 2010-09-21 03:31:20 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100921033120-4xd019v2zmxp2a2o
Tags: 1.2.0-1
* New upstream release
* Bumped standards version to 3.9.1, no changes required

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#       OpenShot Video Editor is a program that creates, modifies, and edits video files.
 
2
#   Copyright (C) 2009  Jonathan Thomas
 
3
#
 
4
#       This file is part of OpenShot Video Editor (http://launchpad.net/openshot/).
 
5
#
 
6
#       OpenShot Video Editor is free software: you can redistribute it and/or modify
 
7
#       it under the terms of the GNU General Public License as published by
 
8
#       the Free Software Foundation, either version 3 of the License, or
 
9
#       (at your option) any later version.
 
10
#
 
11
#       OpenShot Video Editor is distributed in the hope that it will be useful,
 
12
#       but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
#       GNU General Public License for more details.
 
15
#
 
16
#       You should have received a copy of the GNU General Public License
 
17
#       along with OpenShot Video Editor.  If not, see <http://www.gnu.org/licenses/>.
 
18
 
 
19
 
 
20
# Import Blender's python API.  This only works when the script is being
 
21
# run from the context of Blender.  Blender contains it's own version of Python
 
22
# with this library pre-installed.
 
23
import bpy
 
24
 
 
25
# Debug Info:
 
26
# ./blender -b test.blend -P demo.py
 
27
# -b = background mode
 
28
# -P = run a Python script within the context of the project file
 
29
 
 
30
# Init all of the variables needed by this script.  Because Blender executes
 
31
# this script, OpenShot will inject a dictionary of the required parameters
 
32
# before this script is executed.
 
33
params = {              
 
34
                        'title' : 'Oh Yeah! OpenShot!',
 
35
                        'extrude' : 0.1,
 
36
                        'bevel_depth' : 0.02,
 
37
                        'spacemode' : 'CENTRAL',
 
38
                        'text_size' : 1.5,
 
39
                        'width' : 1.0,
 
40
                        'fontname' : 'Bfont',
 
41
                        
 
42
                        'color' : [0.8,0.8,0.8],
 
43
                        'alpha' : 1.0,
 
44
                        
 
45
                        'line1_color' : [0.8,0.8,0.8],
 
46
                        'line2_color' : [0.8,0.8,0.8],
 
47
                        'line3_color' : [0.8,0.8,0.8],
 
48
                        'line4_color' : [0.8,0.8,0.8],
 
49
                        
 
50
                        'output_path' : '/tmp/',
 
51
                        'fps' : 24,
 
52
                        'quality' : 90,
 
53
                        'file_format' : 'PNG',
 
54
                        'color_mode' : 'RGBA',
 
55
                        'horizon_color' : [0.57, 0.57, 0.57],
 
56
                        'resolution_x' : 1920,
 
57
                        'resolution_y' : 1080,
 
58
                        'resolution_percentage' : 100,
 
59
                        'start_frame' : 20,
 
60
                        'end_frame' : 25,
 
61
                        'animation' : True,
 
62
                }
 
63
 
 
64
#INJECT_PARAMS_HERE
 
65
 
 
66
# The remainder of this script will modify the current Blender .blend project
 
67
# file, and adjust the settings.  The .blend file is specified in the XML file
 
68
# that defines this template in OpenShot.
 
69
#----------------------------------------------------------------------------
 
70
 
 
71
# Modify Text / Curve settings
 
72
#print (bpy.data.curves.keys())
 
73
text_object = bpy.data.curves["Text.001"]
 
74
text_object.extrude = params["extrude"]
 
75
text_object.bevel_depth = params["bevel_depth"]
 
76
text_object.body = params["title"]
 
77
text_object.align = params["spacemode"]
 
78
text_object.size = params["text_size"]
 
79
text_object.space_character = params["width"]
 
80
 
 
81
# Get vector font object (these are defined in the .blend file)
 
82
# Only fonts added to your .blend file can be used here
 
83
font = bpy.data.fonts[params["fontname"]]
 
84
text_object.font = font
 
85
 
 
86
# Change the material settings (color, alpha, etc...)
 
87
material_object = bpy.data.materials["Material.title"]
 
88
material_object.diffuse_color = params["diffuse_color"]
 
89
material_object.specular_color = params["specular_color"]
 
90
material_object.specular_intensity = params["specular_intensity"]
 
91
material_object.alpha = params["alpha"]
 
92
 
 
93
# Change line colors
 
94
material_object = bpy.data.materials["Material.line1"]
 
95
material_object.diffuse_color = params["line1_color"]
 
96
material_object = bpy.data.materials["Material.line2"]
 
97
material_object.diffuse_color = params["line2_color"]
 
98
material_object = bpy.data.materials["Material.line3"]
 
99
material_object.diffuse_color = params["line3_color"]
 
100
material_object = bpy.data.materials["Material.line4"]
 
101
material_object.diffuse_color = params["line4_color"]
 
102
 
 
103
 
 
104
# Set the render options.  It is important that these are set
 
105
# to the same values as the current OpenShot project.  These
 
106
# params are automatically set by OpenShot
 
107
bpy.context.scene.render.filepath = params["output_path"]
 
108
bpy.context.scene.render.fps = params["fps"]
 
109
#bpy.context.scene.render.quality = params["quality"]
 
110
bpy.context.scene.render.file_format = params["file_format"]
 
111
bpy.context.scene.render.color_mode = params["color_mode"]
 
112
#bpy.data.worlds[0].horizon_color = params["horizon_color"]
 
113
bpy.context.scene.render.resolution_x = params["resolution_x"]
 
114
bpy.context.scene.render.resolution_y = params["resolution_y"]
 
115
bpy.context.scene.render.resolution_percentage = params["resolution_percentage"]
 
116
bpy.context.scene.frame_start = params["start_frame"]
 
117
bpy.context.scene.frame_end = params["end_frame"]
 
118
 
 
119
# Render the current animation to the params["output_path"] folder
 
120
bpy.ops.render.render(animation=params["animation"])
 
121