[Bf-blender-cvs] [38357cd0046] blender-v2.79a-release: Fix background_job template
Campbell Barton
noreply at git.blender.org
Fri Jan 12 05:48:32 CET 2018
Commit: 38357cd00466de29133ce9806bd90d4de79c1414
Author: Campbell Barton
Date: Wed Jan 10 17:49:20 2018 +1100
Branches: blender-v2.79a-release
https://developer.blender.org/rB38357cd00466de29133ce9806bd90d4de79c1414
Fix background_job template
Update attribute and use empty file operator
===================================================================
M release/scripts/templates_py/background_job.py
===================================================================
diff --git a/release/scripts/templates_py/background_job.py b/release/scripts/templates_py/background_job.py
index 2911740abf9..ddd8ce1384e 100644
--- a/release/scripts/templates_py/background_job.py
+++ b/release/scripts/templates_py/background_job.py
@@ -22,20 +22,18 @@ import bpy
def example_function(text, save_path, render_path):
- scene = bpy.context.scene
-
# Clear existing objects.
- scene.camera = None
- for obj in scene.objects:
- scene.objects.unlink(obj)
+ bpy.ops.wm.read_factory_settings(use_empty=True)
+
+ scene = bpy.context.scene
txt_data = bpy.data.curves.new(name="MyText", type='FONT')
# Text Object
txt_ob = bpy.data.objects.new(name="MyText", object_data=txt_data)
- scene.objects.link(txt_ob) # add the data to the scene as an object
- txt_data.body = text # the body text to the command line arg given
- txt_data.align = 'CENTER' # center text
+ scene.objects.link(txt_ob) # add the data to the scene as an object
+ txt_data.body = text # the body text to the command line arg given
+ txt_data.align_x = 'CENTER' # center text
# Camera
cam_data = bpy.data.cameras.new("MyCam")
More information about the Bf-blender-cvs
mailing list