diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-01-10 09:49:20 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-01-10 09:50:41 +0300 |
commit | 98d89cef6b9727e3cf98f2f69829d897f26bcf7b (patch) | |
tree | f5656144e1139d49857b72b68dd0ae4e10d4c770 /release/scripts/templates_py/background_job.py | |
parent | 6e6b79de35fbe5f4cf0c79dcd854827fc0c95499 (diff) |
Fix background_job template
Update attribute and use empty file operator
Diffstat (limited to 'release/scripts/templates_py/background_job.py')
-rw-r--r-- | release/scripts/templates_py/background_job.py | 14 |
1 files changed, 6 insertions, 8 deletions
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") |