Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2018-11-14 20:19:41 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-11-14 20:21:06 +0300
commita4fccde67a9b4ab23765acba8932e66a46487511 (patch)
treeeb55cc3f86c08e55cc40339d6e9cf94847d573b9 /release/scripts/templates_py
parent844c7440fcbf2aa30d73418f43e6cb42cf27a6ee (diff)
Fix some templates for 2.8.
Diffstat (limited to 'release/scripts/templates_py')
-rw-r--r--release/scripts/templates_py/addon_add_object.py2
-rw-r--r--release/scripts/templates_py/background_job.py10
-rw-r--r--release/scripts/templates_py/custom_nodes.py2
3 files changed, 8 insertions, 6 deletions
diff --git a/release/scripts/templates_py/addon_add_object.py b/release/scripts/templates_py/addon_add_object.py
index d7ee145175f..6e51149e451 100644
--- a/release/scripts/templates_py/addon_add_object.py
+++ b/release/scripts/templates_py/addon_add_object.py
@@ -2,7 +2,7 @@ bl_info = {
"name": "New Object",
"author": "Your Name Here",
"version": (1, 0),
- "blender": (2, 75, 0),
+ "blender": (2, 80, 0),
"location": "View3D > Add > Mesh > New Object",
"description": "Adds a new Mesh Object",
"warning": "",
diff --git a/release/scripts/templates_py/background_job.py b/release/scripts/templates_py/background_job.py
index c64c1de91d1..c28c7275fce 100644
--- a/release/scripts/templates_py/background_job.py
+++ b/release/scripts/templates_py/background_job.py
@@ -17,11 +17,11 @@
#
# See blender --help for details.
+
import bpy
def example_function(text, save_path, render_path):
-
# Clear existing objects.
bpy.ops.wm.read_factory_settings(use_empty=True)
@@ -31,23 +31,25 @@ def example_function(text, save_path, render_path):
# 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
+ scene.collection.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")
cam_ob = bpy.data.objects.new(name="MyCam", object_data=cam_data)
- scene.objects.link(cam_ob) # instance the camera object in the scene
+ scene.collection.objects.link(cam_ob) # instance the camera object in the scene
scene.camera = cam_ob # set the active camera
cam_ob.location = 0.0, 0.0, 10.0
# Light
light_data = bpy.data.lights.new("MyLight", 'POINT')
light_ob = bpy.data.objects.new(name="MyCam", object_data=light_data)
- scene.objects.link(light_ob)
+ scene.collection.objects.link(light_ob)
light_ob.location = 2.0, 2.0, 5.0
+ scene.update()
+
if save_path:
bpy.ops.wm.save_as_mainfile(filepath=save_path)
diff --git a/release/scripts/templates_py/custom_nodes.py b/release/scripts/templates_py/custom_nodes.py
index a2701360c9b..02dcaccbde4 100644
--- a/release/scripts/templates_py/custom_nodes.py
+++ b/release/scripts/templates_py/custom_nodes.py
@@ -43,7 +43,7 @@ class MyCustomSocket(NodeSocket):
# Optional function for drawing the socket input value
def draw(self, context, layout, node, text):
if self.is_output or self.is_linked:
- layout.label(text)
+ layout.label(text=text)
else:
layout.prop(self, "my_enum_prop", text=text)