[Bf-extensions-cvs] [a11ed513] master: Update for API change: scene.cursor_location -> scene.cursor.location

Campbell Barton noreply at git.blender.org
Fri Mar 1 02:59:38 CET 2019


Commit: a11ed513e3d7c589e13d29a4124930ca2aa916a4
Author: Campbell Barton
Date:   Fri Mar 1 12:58:17 2019 +1100
Branches: master
https://developer.blender.org/rBACa11ed513e3d7c589e13d29a4124930ca2aa916a4

Update for API change: scene.cursor_location -> scene.cursor.location

Note that some scripts still used the 3D view cursor which has been
removed for a while.

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

M	add_dimension.py
M	add_mesh_castle/Castle.py
M	add_mesh_space_tree/__init__.py
M	curve_tools/Operators.py
M	exact_edit/xedit_free_rotate.py
M	exact_edit/xedit_set_meas.py
M	mesh_ktools.py
M	np_station/np_float_box.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_instance.py
M	np_station/np_point_move.py
M	np_station/np_point_scale.py
M	np_station/np_roto_move.py
M	object_creaprim.py
M	space_view3d_add_surround_cameras.py
M	space_view3d_align_tools.py
M	space_view3d_cursor_control/cursor_utils.py
M	space_view3d_enhanced_3d_cursor.py
M	space_view3d_library_hide.py
M	space_view3d_paint_bprojection.py
M	space_view3d_panel_measure.py
M	space_view3d_toolshelf_menu.py
M	sun_position/north.py
M	sun_position/properties.py

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

diff --git a/add_dimension.py b/add_dimension.py
index bdcd665d..12994808 100644
--- a/add_dimension.py
+++ b/add_dimension.py
@@ -2667,10 +2667,10 @@ class Dimension(bpy.types.Operator):
     def invoke(self, context, event):
         bpy.context.scene.update()
         if self.Dimension_Change:
-            bpy.context.scene.cursor_location = self.Dimension_startlocation
+            bpy.context.scene.cursor.location = self.Dimension_startlocation
         else:
             if self.Dimension_width_or_location == 'width':
-                self.Dimension_startlocation = bpy.context.scene.cursor_location
+                self.Dimension_startlocation = bpy.context.scene.cursor.location
 
             if self.Dimension_width_or_location == 'location':
                 if (self.Dimension_endlocation[2] - self.Dimension_startlocation[2]) !=  0 :
@@ -2734,7 +2734,7 @@ class DimensionAdd(bpy.types.Panel):
 
         if len(vertex) == 1:
             startvertex = vertex[0]
-            endvertex = bpy.context.scene.cursor_location
+            endvertex = bpy.context.scene.cursor.location
             layout = self.layout
             col = layout.column()
             col.label(text="Note:")
@@ -3000,7 +3000,7 @@ class DimensionPanel(bpy.types.Panel):
 #location update
 def StartLocationUpdate(self, context):
 
-    bpy.context.scene.cursor_location = self.Dimension_startlocation
+    bpy.context.scene.cursor.location = self.Dimension_startlocation
 
     return
 
diff --git a/add_mesh_castle/Castle.py b/add_mesh_castle/Castle.py
index 343e218f..07849f1f 100644
--- a/add_mesh_castle/Castle.py
+++ b/add_mesh_castle/Castle.py
@@ -1199,7 +1199,7 @@ class add_castle(bpy.types.Operator):
         blockArea = [self.properties.cBaseD, self.properties.cBaseW, self.properties.cBaseT, self.properties.blockZ, settings['hv'], self.properties.Grout]
 
         # Block floor uses wall to generate... initialize location values.
-        wallLoc = [castleScene.cursor_location.x, castleScene.cursor_location.y, castleScene.cursor_location.z]
+        wallLoc = [castleScene.cursor.location.x, castleScene.cursor.location.y, castleScene.cursor.location.z]
 
         baseRotate = False  # rotate for blocks...
         if self.properties.CBaseB:  # make floor with blocks.
@@ -1250,7 +1250,7 @@ class add_castle(bpy.types.Operator):
         wallMtl = uMatRGBSet('cWall_mat', self.wallRGB, matMod=True)
 
         # Block floor uses wall to generate... reset location values.
-        wallLoc[1] = castleScene.cursor_location.y
+        wallLoc[1] = castleScene.cursor.location.y
 
         wallLvl = 0  # make per level as selected...
         while wallLvl < self.properties.CLvls:  # make castle levels
@@ -1627,12 +1627,12 @@ class add_castle(bpy.types.Operator):
                 floorObj = makePlaneObj(objName, floorBounds, baseMtl, floorPW)
 
                 # adjust floor location for 3D cursor since parented to Base...
-                yMod = castleScene.cursor_location.y
+                yMod = castleScene.cursor.location.y
                 if floorDisc:  # make a disc shaped floor
                     yMod += self.properties.cBaseD / 2
-                floorObj.location.x -= castleScene.cursor_location.x
+                floorObj.location.x -= castleScene.cursor.location.x
                 floorObj.location.y -= yMod
-                floorObj.location.z -= castleScene.cursor_location.z
+                floorObj.location.z -= castleScene.cursor.location.z
 
                 castleScene.objects.link(floorObj)  # must do for generation/rotation
 
@@ -1670,7 +1670,7 @@ class add_castle(bpy.types.Operator):
             # Make "tower" wall.
             wallLoc[0] = 0
             wallLoc[1] = 0
-            wallLoc[2] = castleScene.cursor_location.z
+            wallLoc[2] = castleScene.cursor.location.z
 
             # generate tower...
             cTower1Obj = makeWallObj(self, castleScene, wallLoc, "CTower1", blockArea, [], wallExtOpts, wallMtl)
@@ -1696,7 +1696,7 @@ class add_castle(bpy.types.Operator):
             settings['Slope'] = True  # force curvature
             settings['sdv'] = 0.12
 
-            wallLoc[0] = castleScene.cursor_location.x
+            wallLoc[0] = castleScene.cursor.location.x
             wallLoc[1] = midWallD
             wallLoc[2] = self.properties.cDomeZ
 
@@ -2058,7 +2058,7 @@ def makePlaneObj(objName, objArea, objMat, objDiv):
     objMesh.materials.append(objMat)
 
     newObj = bpy.data.objects.new(objName, objMesh)
-    newObj.location = bpy.context.scene.cursor_location
+    newObj.location = bpy.context.scene.cursor.location
 
     return newObj
 
diff --git a/add_mesh_space_tree/__init__.py b/add_mesh_space_tree/__init__.py
index 9fc96327..61d32a01 100644
--- a/add_mesh_space_tree/__init__.py
+++ b/add_mesh_space_tree/__init__.py
@@ -98,7 +98,7 @@ def pointInsideMesh(pointrelativetocursor, ob):
     # adapted from http://blenderartists.org/forum/showthread.php?"
     # "195605-Detecting-if-a-point-is-inside-a-mesh-2-5-API&p=1691633&viewfull=1#post1691633
     mat = ob.matrix_world.inverted()
-    orig = mat * (pointrelativetocursor + bpy.context.scene.cursor_location)
+    orig = mat * (pointrelativetocursor + bpy.context.scene.cursor.location)
     count = 0
     axis = Vector((0, 0, 1))
     while True:
@@ -214,7 +214,7 @@ def groupExtends(group):
 
 def createLeaves(tree, probability=0.5, size=0.5, randomsize=0.1,
                  randomrot=0.1, maxconnections=2, bunchiness=1.0, connectoffset=-0.1):
-    p = bpy.context.scene.cursor_location
+    p = bpy.context.scene.cursor.location
 
     verts = []
     faces = []
@@ -266,7 +266,7 @@ def createLeaves(tree, probability=0.5, size=0.5, randomsize=0.1,
 
 def createMarkers(tree, scale=0.05):
     # not used as markers are parented to tree object that is created at the cursor position
-    # p=bpy.context.scene.cursor_location
+    # p=bpy.context.scene.cursor.location
 
     verts = []
     faces = []
@@ -292,7 +292,7 @@ def createObjects(tree, parent=None, objectname=None, probability=0.5, size=0.5,
     if (parent is None) or (objectname is None) or (objectname == 'None'):
         return
 
-    # not necessary, we parent the new objects: p=bpy.context.scene.cursor_location
+    # not necessary, we parent the new objects: p=bpy.context.scene.cursor.location
 
     theobject = bpy.data.objects[objectname]
 
@@ -436,7 +436,7 @@ def createGeometry(tree, power=0.5, scale=0.01, addleaves=False, pleaf=0.5,
 
     timings = Timer()
 
-    p = bpy.context.scene.cursor_location
+    p = bpy.context.scene.cursor.location
     verts = []
     edges = []
     faces = []
@@ -943,7 +943,7 @@ class SCATree(bpy.types.Operator):
             size, minp = groupExtends(self.crownGroup)
             volumefie = partial(
                             groupdistribution, self.crownGroup, self.shadowGroup,
-                            self.randomSeed, size, minp - bpy.context.scene.cursor_location
+                            self.randomSeed, size, minp - bpy.context.scene.cursor.location
                         )
         else:
             volumefie = partial(
@@ -956,7 +956,7 @@ class SCATree(bpy.types.Operator):
         if self.useTrunkGroup:
             if bpy.data.collections.find(self.trunkGroup) >= 0:
                 for ob in bpy.data.collections[self.trunkGroup].objects:
-                    p = ob.location - context.scene.cursor_location
+                    p = ob.location - context.scene.cursor.location
                     startingpoints.append(Branchpoint(p, None))
 
         timings.add('scastart')
diff --git a/curve_tools/Operators.py b/curve_tools/Operators.py
index 6c9eed5a..c7c7b400 100644
--- a/curve_tools/Operators.py
+++ b/curve_tools/Operators.py
@@ -188,13 +188,13 @@ class OperatorOriginToSpline0Start(bpy.types.Operator):
         blSpline = blCurve.data.splines[0]
         newOrigin = blCurve.matrix_world * blSpline.bezier_points[0].co
 
-        origOrigin = bpy.context.scene.cursor_location.copy()
+        origOrigin = bpy.context.scene.cursor.location.copy()
         print("--", "origOrigin: %.6f, %.6f, %.6f" % (origOrigin.x, origOrigin.y, origOrigin.z))
         print("--", "newOrigin: %.6f, %.6f, %.6f" % (newOrigin.x, newOrigin.y, newOrigin.z))
 
-        bpy.context.scene.cursor_location = newOrigin
+        bpy.context.scene.cursor.location = newOrigin
         bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
-        bpy.context.scene.cursor_location = origOrigin
+        bpy.context.scene.cursor.location = origOrigin
 
         self.report({'INFO'}, "TODO: OperatorOriginToSpline0Start")
 
diff --git a/exact_edit/xedit_free_rotate.py b/exact_edit/xedit_free_rotate.py
index 89308175..7151f882 100644
--- a/exact_edit/xedit_free_rotate.py
+++ b/exact_edit/xedit_free_rotate.py
@@ -90,7 +90,7 @@ def backup_blender_settings():
         deepcopy(bpy.context.space_data.pivot_point),
         deepcopy(bpy.context.space_data.transform_orientation),
         deepcopy(bpy.context.space_data.show_manipulator),
-        deepcopy(bpy.context.scene.cursor_location)]
+        deepcopy(bpy.context.scene.cursor.location)]
     return backup
 
 
@@ -111,7 +111,7 @@ def restore_blender_settings(backup):
     bpy.context.space_data.pivot_point = deepcopy(backup[3])
     bpy.context.space_data.transform_orientation = deepcopy(backup[4])
     bpy.context.space_data.show_manipulator = deepcopy(backup[5])
-    bpy.context.scene.cursor_location = deepcopy(backup[6])
+    bpy.context.scene.cursor.location = deepcopy(backup[6])
     return
 
 
@@ -1150,7 +1150,7 @@ class XEditFreeRotate(bpy.types.Operator):
                     curs_loc = self.pts[2].co3d.copy()
                 self.running_transf = True
                 bpy.context.space_data.pivot_point = 'CURSOR'
-                bpy.context.scene.cursor_location = curs_loc
+                bpy.context.scene.cursor.location = curs_loc
                 bpy.ops.transform.rotate('INVOKE_DEFAULT',axis=rot_axis)
 
             #===========================================
diff --git a/exact_edit/xedit_set_meas.py b/exact_edit/xedit_set_meas.py
index e5a9bc79..b1501fd9 100644
--- a/exact_edit/xedit_set_meas.py
+++ b/exact_edit/xedit_set_meas

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list