Skip to content

Commit 90f38c0

Browse files
committed
Blender: Use JSON serialization to inject params
1 parent 0b24aed commit 90f38c0

21 files changed

+168
-12
lines changed

src/blender/scripts/blinds.py

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# run from the context of Blender. Blender contains it's own version of Python
2222
# with this library pre-installed.
2323
import bpy
24+
import json
2425

2526

2627
def load_font(font_path):
@@ -81,6 +82,13 @@ def load_font(font_path):
8182
# that defines this template in OpenShot.
8283
# ----------------------------------------------------------------------------
8384

85+
# Process parameters supplied as JSON serialization
86+
try:
87+
injected_params = json.loads(params_json)
88+
params.update(injected_params)
89+
except NameError:
90+
pass
91+
8492
# Modify Text / Curve settings
8593
text_object = bpy.data.curves["Title"]
8694
text_object.extrude = params["extrude"]

src/blender/scripts/blur.py

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# run from the context of Blender. Blender contains it's own version of Python
2222
# with this library pre-installed.
2323
import bpy
24+
import json
2425

2526

2627
def load_font(font_path):
@@ -83,6 +84,13 @@ def load_font(font_path):
8384
# that defines this template in OpenShot.
8485
# ----------------------------------------------------------------------------
8586

87+
# Process parameters supplied as JSON serialization
88+
try:
89+
injected_params = json.loads(params_json)
90+
params.update(injected_params)
91+
except NameError:
92+
pass
93+
8694
# Modify Text / Curve settings
8795
text_object = bpy.data.curves["Text"]
8896
text_object.extrude = params["extrude"]

src/blender/scripts/colors.py

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# run from the context of Blender. Blender contains it's own version of Python
2222
# with this library pre-installed.
2323
import bpy
24+
import json
2425

2526

2627
def load_font(font_path):
@@ -81,6 +82,13 @@ def load_font(font_path):
8182
# that defines this template in OpenShot.
8283
# ----------------------------------------------------------------------------
8384

85+
# Process parameters supplied as JSON serialization
86+
try:
87+
injected_params = json.loads(params_json)
88+
params.update(injected_params)
89+
except NameError:
90+
pass
91+
8492
# Get font object
8593
font = None
8694
if params["fontname"] != "Bfont":

src/blender/scripts/dissolve.py

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# run from the context of Blender. Blender contains its own version of Python
2222
# with this library pre-installed.
2323
import bpy
24+
import json
2425
from math import pi
2526

2627

@@ -255,6 +256,13 @@ def createDissolveText(title, extrude, bevel_depth, spacemode, textsize, width,
255256
# that defines this template in OpenShot.
256257
# ----------------------------------------------------------------------------
257258

259+
# Process parameters supplied as JSON serialization
260+
try:
261+
injected_params = json.loads(params_json)
262+
params.update(injected_params)
263+
except NameError:
264+
pass
265+
258266
# Get font object
259267
font = None
260268
if params["fontname"] != "Bfont":

src/blender/scripts/earth.py

+8
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
# with this library pre-installed.
2323
import math
2424
import bpy
25+
import json
2526

2627

2728
def load_font(font_path):
@@ -102,6 +103,13 @@ def load_font(font_path):
102103
# that defines this template in OpenShot.
103104
# ----------------------------------------------------------------------------
104105

106+
# Process parameters supplied as JSON serialization
107+
try:
108+
injected_params = json.loads(params_json)
109+
params.update(injected_params)
110+
except NameError:
111+
pass
112+
105113
depart = {
106114
"lat_deg": params["depart_lat_deg"],
107115
"lat_min": params["depart_lat_min"],

src/blender/scripts/explode.py

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# run from the context of Blender. Blender contains its own version of Python
2222
# with this library pre-installed.
2323
import bpy
24+
import json
2425
from math import pi
2526

2627

@@ -189,6 +190,13 @@ def createExplodeTxt(title, particle_number, extrude, bevel_depth, spacemode,
189190
# that defines this template in OpenShot.
190191
# ----------------------------------------------------------------------------
191192

193+
# Process parameters supplied as JSON serialization
194+
try:
195+
injected_params = json.loads(params_json)
196+
params.update(injected_params)
197+
except NameError:
198+
pass
199+
192200
# Get font object
193201
font = None
194202
if params["fontname"] != "Bfont":

src/blender/scripts/fly_by_1.py

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# run from the context of Blender. Blender contains it's own version of Python
2222
# with this library pre-installed.
2323
import bpy
24+
import json
2425

2526

2627
def load_font(font_path):
@@ -81,6 +82,13 @@ def load_font(font_path):
8182
# that defines this template in OpenShot.
8283
# ----------------------------------------------------------------------------
8384

85+
# Process parameters supplied as JSON serialization
86+
try:
87+
injected_params = json.loads(params_json)
88+
params.update(injected_params)
89+
except NameError:
90+
pass
91+
8492
# Modify Text / Curve settings
8593
#print (bpy.data.curves.keys())
8694
text_object = bpy.data.curves["txtName1"]

src/blender/scripts/fly_by_two_titles.py

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# run from the context of Blender. Blender contains it's own version of Python
2222
# with this library pre-installed.
2323
import bpy
24+
import json
2425

2526

2627
def load_font(font_path):
@@ -81,6 +82,13 @@ def load_font(font_path):
8182
# that defines this template in OpenShot.
8283
# ----------------------------------------------------------------------------
8384

85+
# Process parameters supplied as JSON serialization
86+
try:
87+
injected_params = json.loads(params_json)
88+
params.update(injected_params)
89+
except NameError:
90+
pass
91+
8492
# Modify Text / Curve settings
8593
#print (bpy.data.curves.keys())
8694
text_object = bpy.data.curves["Text"]

src/blender/scripts/glare.py

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# run from the context of Blender. Blender contains it's own version of Python
2222
# with this library pre-installed.
2323
import bpy
24+
import json
2425

2526

2627
def load_font(font_path):
@@ -81,6 +82,13 @@ def load_font(font_path):
8182
# that defines this template in OpenShot.
8283
# ----------------------------------------------------------------------------
8384

85+
# Process parameters supplied as JSON serialization
86+
try:
87+
injected_params = json.loads(params_json)
88+
params.update(injected_params)
89+
except NameError:
90+
pass
91+
8492
# Modify Text / Curve settings
8593
#print (bpy.data.curves.keys())
8694
text_object = bpy.data.curves["Text"]

src/blender/scripts/glass_slider.py

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# run from the context of Blender. Blender contains it's own version of Python
2222
# with this library pre-installed.
2323
import bpy
24+
import json
2425

2526

2627
def load_font(font_path):
@@ -81,6 +82,13 @@ def load_font(font_path):
8182
# that defines this template in OpenShot.
8283
# ----------------------------------------------------------------------------
8384

85+
# Process parameters supplied as JSON serialization
86+
try:
87+
injected_params = json.loads(params_json)
88+
params.update(injected_params)
89+
except NameError:
90+
pass
91+
8492
# TITLE 1 - Modify Text / Curve settings
8593
text_object1 = bpy.data.curves["Title1"]
8694
text_object1.extrude = params["extrude"]

src/blender/scripts/lens_flare.py

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# run from the context of Blender. Blender contains it's own version of Python
2222
# with this library pre-installed.
2323
import bpy
24+
import json
2425

2526
# Debug Info:
2627
# ./blender -b test.blend -P demo.py
@@ -63,6 +64,13 @@
6364
# that defines this template in OpenShot.
6465
# ----------------------------------------------------------------------------
6566

67+
# Process parameters supplied as JSON serialization
68+
try:
69+
injected_params = json.loads(params_json)
70+
params.update(injected_params)
71+
except NameError:
72+
pass
73+
6674
# Modify the Location of the Wand
6775
sphere_object = bpy.data.objects["Sphere"]
6876
sphere_object.location = [params["start_x"], params["start_y"], params["start_z"]]

src/blender/scripts/magic_wand.py

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# run from the context of Blender. Blender contains it's own version of Python
2222
# with this library pre-installed.
2323
import bpy
24+
import json
2425

2526
# Debug Info:
2627
# ./blender -b test.blend -P demo.py
@@ -72,6 +73,13 @@
7273
# that defines this template in OpenShot.
7374
# ----------------------------------------------------------------------------
7475

76+
# Process parameters supplied as JSON serialization
77+
try:
78+
injected_params = json.loads(params_json)
79+
params.update(injected_params)
80+
except NameError:
81+
pass
82+
7583

7684
def update_curve(curve, start, end):
7785
coords = [

src/blender/scripts/neon_curves.py

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# run from the context of Blender. Blender contains it's own version of Python
2222
# with this library pre-installed.
2323
import bpy
24+
import json
2425

2526

2627
def load_font(font_path):
@@ -86,6 +87,13 @@ def load_font(font_path):
8687
# that defines this template in OpenShot.
8788
# ----------------------------------------------------------------------------
8889

90+
# Process parameters supplied as JSON serialization
91+
try:
92+
injected_params = json.loads(params_json)
93+
params.update(injected_params)
94+
except NameError:
95+
pass
96+
8997
# Modify Text / Curve settings
9098
text_object = bpy.data.curves["Text.001"]
9199
text_object.extrude = params["extrude"]

src/blender/scripts/picture_frames_4.py

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# run from the context of Blender. Blender contains it's own version of Python
2222
# with this library pre-installed.
2323
import bpy
24+
import json
2425

2526
# Debug Info:
2627
# ./blender -b test.blend -P demo.py
@@ -74,6 +75,13 @@ def get_scale_values(height, width):
7475
# that defines this template in OpenShot.
7576
# ----------------------------------------------------------------------------
7677

78+
# Process parameters supplied as JSON serialization
79+
try:
80+
injected_params = json.loads(params_json)
81+
params.update(injected_params)
82+
except NameError:
83+
pass
84+
7785
# Split the picture information
7886
picture1 = params["project_files1"].split("|")
7987
if len(picture1) > 1:

src/blender/scripts/rotate_360.py

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# run from the context of Blender. Blender contains it's own version of Python
2222
# with this library pre-installed.
2323
import bpy
24+
import json
2425

2526

2627
def load_font(font_path):
@@ -81,6 +82,13 @@ def load_font(font_path):
8182
# that defines this template in OpenShot.
8283
# ----------------------------------------------------------------------------
8384

85+
# Process parameters supplied as JSON serialization
86+
try:
87+
injected_params = json.loads(params_json)
88+
params.update(injected_params)
89+
except NameError:
90+
pass
91+
8492
# Modify Text / Curve settings
8593
#print (bpy.data.curves.keys())
8694
text_object = bpy.data.curves["Text"]

src/blender/scripts/slide_left_to_right.py

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# run from the context of Blender. Blender contains it's own version of Python
2222
# with this library pre-installed.
2323
import bpy
24+
import json
2425

2526

2627
def load_font(font_path):
@@ -81,6 +82,13 @@ def load_font(font_path):
8182
# that defines this template in OpenShot.
8283
# ----------------------------------------------------------------------------
8384

85+
# Process parameters supplied as JSON serialization
86+
try:
87+
injected_params = json.loads(params_json)
88+
params.update(injected_params)
89+
except NameError:
90+
pass
91+
8492
# Modify Text / Curve settings
8593
#print (bpy.data.curves.keys())
8694
text_object = bpy.data.curves["txtName1"]

src/blender/scripts/snow.py

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# run from the context of Blender. Blender contains it's own version of Python
2222
# with this library pre-installed.
2323
import bpy
24+
import json
2425

2526
# Debug Info:
2627
# ./blender -b test.blend -P demo.py
@@ -63,6 +64,13 @@
6364
# that defines this template in OpenShot.
6465
# ----------------------------------------------------------------------------
6566

67+
# Process parameters supplied as JSON serialization
68+
try:
69+
injected_params = json.loads(params_json)
70+
params.update(injected_params)
71+
except NameError:
72+
pass
73+
6674
# Modify the Location of the Wand
6775
wand_object = bpy.data.objects["Wand"]
6876

src/blender/scripts/spacemovie_intro.py

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# run from the context of Blender. Blender contains it's own version of Python
2222
# with this library pre-installed.
2323
import bpy
24+
import json
2425

2526

2627
def load_font(font_path):
@@ -87,6 +88,13 @@ def load_font(font_path):
8788
# that defines this template in OpenShot.
8889
# ----------------------------------------------------------------------------
8990

91+
# Process parameters supplied as JSON serialization
92+
try:
93+
injected_params = json.loads(params_json)
94+
params.update(injected_params)
95+
except NameError:
96+
pass
97+
9098
# Modify Text / Curve settings
9199
#print (bpy.data.curves.keys())
92100
bpy.data.objects['Alongtimeago'].data.body = params['Alongtimeago']

0 commit comments

Comments
 (0)