[Bf-extensions-cvs] [059f8cc7] master: addons-contrib: view_layer.objects.active syntax update

NBurn noreply at git.blender.org
Tue Jan 29 02:12:35 CET 2019


Commit: 059f8cc709c5d377241958ef3bb2673328f9849e
Author: NBurn
Date:   Mon Jan 28 20:12:14 2019 -0500
Branches: master
https://developer.blender.org/rBAC059f8cc709c5d377241958ef3bb2673328f9849e

addons-contrib: view_layer.objects.active syntax update

===================================================================

M	add_dimension.py
M	add_mesh_castle/Castle.py
M	add_mesh_clusters/__init__.py
M	add_mesh_space_tree/__init__.py
M	amaranth/render/meshlight_select.py
M	amaranth/scene/debug.py
M	cmu_mocap_browser/makehuman.py
M	io_atomblend_utilities/io_atomblend_utilities.py
M	io_directx_bel/import_x.py
M	io_mesh_xyz/import_xyz.py
M	io_scene_cod/export_xanim.py
M	io_scene_cod/export_xmodel.py
M	mesh_ktools.py
M	np_station/np_float_box.py
M	np_station/np_float_poly.py
M	np_station/np_float_rectangle.py
M	np_station/np_point_align.py
M	np_station/np_point_array.py
M	np_station/np_point_copy.py
M	np_station/np_point_distance.py
M	np_station/np_point_instance.py
M	np_station/np_point_move.py
M	np_station/np_point_scale.py
M	np_station/np_roto_move.py
M	np_station/np_shader_brush.py
M	object_mesh_versions.py
M	object_particle_hair_net.py
M	oscurart_futurism.py
M	oscurart_mesh_cache_tools.py
M	space_view3d_paint_bprojection.py
M	space_view3d_quickPrefs.py

===================================================================

diff --git a/add_dimension.py b/add_dimension.py
index 090f16f2..08b6e097 100644
--- a/add_dimension.py
+++ b/add_dimension.py
@@ -1770,7 +1770,7 @@ def createCurve(vertArray, self, align_matrix):
     bpy.ops.object.select_all(action='DESELECT')
     DimensionCurve.select_set(True)
     DimensionText.select_set(True)
-    bpy.context.scene.objects.active = DimensionCurve
+    bpy.context.view_layer.objects.active = DimensionCurve
     bpy.context.scene.update()
 
     DimensionCurve.Dimension_Name = self.Dimension_Name
diff --git a/add_mesh_castle/Castle.py b/add_mesh_castle/Castle.py
index 465e9c22..343e218f 100644
--- a/add_mesh_castle/Castle.py
+++ b/add_mesh_castle/Castle.py
@@ -1724,7 +1724,7 @@ class add_castle(bpy.types.Operator):
             cDomeObj.parent = castleObj  # Connect to parent
 
         castleObj.select_set(True)
-        context.scene.objects.active = castleObj
+        context.view_layer.objects.active = castleObj
 
         return {'FINISHED'}
 
diff --git a/add_mesh_clusters/__init__.py b/add_mesh_clusters/__init__.py
index 971171e0..ef2a29a0 100644
--- a/add_mesh_clusters/__init__.py
+++ b/add_mesh_clusters/__init__.py
@@ -351,7 +351,7 @@ def DEF_atom_draw_atoms(prop_element,
                             location=(0,0,0), rotation=(0.0, 0.0, 0.0),
                             layers=current_layers)
 
-    ball = bpy.context.scene.objects.active
+    ball = bpy.context.view_layer.objects.active
     ball.scale  = (radii[int(prop_radius_type)]*prop_scale_radius,) * 3
 
     ball.active_material = material
@@ -362,7 +362,7 @@ def DEF_atom_draw_atoms(prop_element,
     # SELECT ALL LOADED OBJECTS
     bpy.ops.object.select_all(action='DESELECT')
     new_atom_mesh.select_set(True)
-    bpy.context.scene.objects.active = new_atom_mesh
+    bpy.context.view_layer.objects.active = new_atom_mesh
 
     return True
 
diff --git a/add_mesh_space_tree/__init__.py b/add_mesh_space_tree/__init__.py
index cf77a437..6938100b 100644
--- a/add_mesh_space_tree/__init__.py
+++ b/add_mesh_space_tree/__init__.py
@@ -569,7 +569,7 @@ def createGeometry(tree, power=0.5, scale=0.01, addleaves=False, pleaf=0.5,
     for ob in bpy.context.scene.objects:
         ob.select_set(False)
     base.select_set(True)
-    bpy.context.scene.objects.active = obj_new
+    bpy.context.view_layer.objects.active = obj_new
     bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
 
     timings.add('createmesh')
@@ -613,9 +613,9 @@ def createGeometry(tree, power=0.5, scale=0.01, addleaves=False, pleaf=0.5,
         obj_leaves = bpy.data.objects.new(mesh.name, mesh)
         base = bpy.context.scene.objects.link(obj_leaves)
         obj_leaves.parent = obj_new
-        bpy.context.scene.objects.active = obj_leaves
+        bpy.context.view_layer.objects.active = obj_leaves
         bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
-        bpy.context.scene.objects.active = obj_new
+        bpy.context.view_layer.objects.active = obj_new
 
     timings.add('leaves')
 
diff --git a/amaranth/render/meshlight_select.py b/amaranth/render/meshlight_select.py
index 00c30717..b7c7c886 100644
--- a/amaranth/render/meshlight_select.py
+++ b/amaranth/render/meshlight_select.py
@@ -40,9 +40,9 @@ class AMTH_OBJECT_OT_select_meshlights(bpy.types.Operator):
         for ob in context.scene.objects:
             if utils.cycles_is_emission(context, ob):
                 ob.select_set(True)
-                context.scene.objects.active = ob
+                context.view_layer.objects.active = ob
 
-        if not context.selected_objects and not context.scene.objects.active:
+        if not context.selected_objects and not context.view_layer.objects.active:
             self.report({"INFO"}, "No meshlights to select")
 
         return {"FINISHED"}
diff --git a/amaranth/scene/debug.py b/amaranth/scene/debug.py
index 4226e9ac..50461feb 100755
--- a/amaranth/scene/debug.py
+++ b/amaranth/scene/debug.py
@@ -322,7 +322,7 @@ class AMTH_SCENE_OT_amaranth_object_select(Operator):
 
         bpy.ops.object.select_all(action="DESELECT")
         obj.select_set(True)
-        context.scene.objects.active = obj
+        context.view_layer.objects.active = obj
 
         return {"FINISHED"}
 
diff --git a/cmu_mocap_browser/makehuman.py b/cmu_mocap_browser/makehuman.py
index 7c8d8432..381d5981 100644
--- a/cmu_mocap_browser/makehuman.py
+++ b/cmu_mocap_browser/makehuman.py
@@ -96,7 +96,7 @@ class CMUMocapAlignArmatures(bpy.types.Operator):
 
         # clear frame poses, leave source selected
         for o in self.dst, self.src:
-            context.scene.objects.active = o
+            context.view_layer.objects.active = o
             bpy.ops.object.mode_set(mode='POSE')
             bpy.ops.pose.select_all(action='SELECT')
             bpy.ops.pose.rot_clear()
@@ -237,7 +237,7 @@ class CMUMocapTransferer(bpy.types.Operator):
         DPB = self.dst.pose.bones
         self.set_inverses()
         context.scene.frame_set(0)
-        context.scene.objects.active = self.dst
+        context.view_layer.objects.active = self.dst
         bpy.ops.object.mode_set(mode='POSE')
         bpy.ops.pose.select_all(action='DESELECT')
         for sb, db, cc in [
diff --git a/io_atomblend_utilities/io_atomblend_utilities.py b/io_atomblend_utilities/io_atomblend_utilities.py
index 71f6c5c6..0d9fd122 100644
--- a/io_atomblend_utilities/io_atomblend_utilities.py
+++ b/io_atomblend_utilities/io_atomblend_utilities.py
@@ -319,7 +319,7 @@ def modify_objects(action_type,
                                                'Sticks_Cylinder' in atom.name or
                                                'Stick_Cylinder' in atom.name):
 
-        bpy.context.scene.objects.active = atom
+        bpy.context.view_layer.objects.active = atom
         bpy.ops.object.mode_set(mode='EDIT', toggle=False)
         bm = bmesh.from_edit_mesh(atom.data)
 
@@ -339,7 +339,7 @@ def modify_objects(action_type,
             v.co[1] = ((v.co[1] - center[1]) / radius) * radius_new + center[1]
 
         bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
-        bpy.context.scene.objects.active = None
+        bpy.context.view_layer.objects.active = None
 
     # Replace atom objects
     if action_type == "ATOM_REPLACE_OBJ" and "Stick" not in atom.name:
@@ -453,14 +453,14 @@ def separate_atoms(scn):
         # duplication, move the new object onto the positions
         bpy.ops.object.select_all(action='DESELECT')
         atom.children[0].select_set(True)
-        bpy.context.scene.objects.active = atom.children[0]
+        bpy.context.view_layer.objects.active = atom.children[0]
         bpy.ops.object.duplicate_move()
-        new_atom = bpy.context.scene.objects.active
+        new_atom = bpy.context.view_layer.objects.active
         new_atom.parent = None
         new_atom.location = location
         new_atom.name = atom.name + "_sep"
 
-    bpy.context.scene.objects.active = atom
+    bpy.context.view_layer.objects.active = atom
 
 
 # Prepare a new material
@@ -636,7 +636,7 @@ def draw_obj(atom_shape, atom):
             rotation=(0, 0, 0),
             layers=current_layers)
 
-    new_atom = bpy.context.scene.objects.active
+    new_atom = bpy.context.view_layer.objects.active
     new_atom.scale = atom.scale + Vector((0.0,0.0,0.0))
     new_atom.name = atom.name + "_tmp"
     new_atom.select_set(True)
@@ -676,7 +676,7 @@ def draw_obj_special(atom_shape, atom):
                                         location=atom.location,
                                         rotation=(0.0, 0.0, 0.0),
                                         layers=current_layers)
-        cube = bpy.context.scene.objects.active
+        cube = bpy.context.view_layer.objects.active
         cube.scale = atom.scale + Vector((0.0,0.0,0.0))
         cube.name = atom.name + "_F2+-center"
         cube.select_set(True)
@@ -710,7 +710,7 @@ def draw_obj_special(atom_shape, atom):
                                         location=atom.location,
                                         rotation=(0.0, 0.0, 0.0),
                                         layers=current_layers)
-        cube = bpy.context.scene.objects.active
+        cube = bpy.context.view_layer.objects.active
         cube.scale = atom.scale + Vector((0.0,0.0,0.0))
         cube.name = atom.name + "_F+-center"
         cube.select_set(True)
@@ -731,7 +731,7 @@ def draw_obj_special(atom_shape, atom):
                                         location=(0.0, 0.0, 0.0),
                                         rotation=(0.0, 0.0, 0.0),
                                         layers=current_layers)
-        electron = bpy.context.scene.objects.active
+        electron = bpy.context.view_layer.objects.active
         electron.scale = scale
         electron.name = atom.name + "_F+_electron"
         electron.parent = cube
@@ -767,7 +767,7 @@ def draw_obj_special(atom_shape, atom):
                                         location=atom.location,
                                         rotation=(0.0, 0.0, 0.0),
                                         layers=current_layers)
-        cube = bpy.context.scene.objects.active
+        cube = bpy.context.view_layer.objects.active
         cube.scale = atom.scale + Vector((0.0,0.0,0.0))
         cube.name = atom.name + "_F0-center"
         cube.select_set(True)
@@ -788,7 +788,7 @@ def draw_obj_special(atom_shape, atom):
                                         location=(scale[0]*1.5,0.0,0.0),
                                         rotation=(0.0, 0.0, 0.0),
                                         layers=current_layers)
-        electron1 = bpy.context.scene.objects.active
+        electron1 = bpy.context.view_layer.objects.active
         electron1.scale = scale
         electron1.name = atom.name + "_F0_electron1"
         electron1.parent = cube
@@ -798,7 +798,7 @@ def draw_obj_special(atom_shape, atom):
                                         location=(-scale[0]*1.5,0.0,0.0),
                                         rotation=(0.0, 0.0, 0.0),
                                         layers=current_layers)
-        electron2 = bpy.context.scene.objects.active
+        electron2 = bpy.context.view_layer.objects.active
         electron2.scale = scale

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list