Update for API change: scene.cursor_location -> scene.cursor.location
authorCampbell Barton <ideasman42@gmail.com>
Fri, 1 Mar 2019 01:58:17 +0000 (12:58 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 1 Mar 2019 01:58:17 +0000 (12:58 +1100)
Note that some scripts still used the 3D view cursor which has been
removed for a while.

27 files changed:
add_dimension.py
add_mesh_castle/Castle.py
add_mesh_space_tree/__init__.py
curve_tools/Operators.py
exact_edit/xedit_free_rotate.py
exact_edit/xedit_set_meas.py
mesh_ktools.py
np_station/np_float_box.py
np_station/np_float_rectangle.py
np_station/np_point_align.py
np_station/np_point_array.py
np_station/np_point_copy.py
np_station/np_point_instance.py
np_station/np_point_move.py
np_station/np_point_scale.py
np_station/np_roto_move.py
object_creaprim.py
space_view3d_add_surround_cameras.py
space_view3d_align_tools.py
space_view3d_cursor_control/cursor_utils.py
space_view3d_enhanced_3d_cursor.py
space_view3d_library_hide.py
space_view3d_paint_bprojection.py
space_view3d_panel_measure.py
space_view3d_toolshelf_menu.py
sun_position/north.py
sun_position/properties.py

index bdcd665..1299480 100644 (file)
@@ -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
 
index 343e218..07849f1 100644 (file)
@@ -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
 
index 9fc9632..61d32a0 100644 (file)
@@ -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')
index 6c9eed5..c7c7b40 100644 (file)
@@ -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")
 
index 8930817..7151f88 100644 (file)
@@ -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)
 
             #===========================================
index e5a9bc7..b1501fd 100644 (file)
@@ -92,7 +92,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
 
 
@@ -113,7 +113,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
 
 
@@ -1059,9 +1059,9 @@ def do_translation(new_co, old_co):
 def do_scale(ref_pts, s_fac):
     # back up settings before changing them
     piv_back = deepcopy(bpy.context.space_data.pivot_point)
-    curs_back = bpy.context.scene.cursor_location.copy()
+    curs_back = bpy.context.scene.cursor.location.copy()
     bpy.context.space_data.pivot_point = 'CURSOR'
-    bpy.context.scene.cursor_location = ref_pts[1].co3d.copy()
+    bpy.context.scene.cursor.location = ref_pts[1].co3d.copy()
     ax_multip, cnstrt_bls = (), ()
     if   RotDat.axis_lock is None:
         ax_multip, cnstrt_bls = (s_fac, s_fac, s_fac), (True, True, True)
@@ -1073,7 +1073,7 @@ def do_scale(ref_pts, s_fac):
         ax_multip, cnstrt_bls = (1, 1, s_fac), (False, False, True)
     bpy.ops.transform.resize(value=ax_multip, constraint_axis=cnstrt_bls)
     # restore settings back to their pre "do_scale" state
-    bpy.context.scene.cursor_location = curs_back.copy()
+    bpy.context.scene.cursor.location = curs_back.copy()
     bpy.context.space_data.pivot_point = deepcopy(piv_back)
 
 
@@ -1196,9 +1196,9 @@ def prep_rotation_info(curr_ms_stor, new_ms_stor):
 def do_rotate(self):
     # back up settings before changing them
     piv_back = deepcopy(bpy.context.space_data.pivot_point)
-    curs_back = bpy.context.scene.cursor_location.copy()
+    curs_back = bpy.context.scene.cursor.location.copy()
     bpy.context.space_data.pivot_point = 'CURSOR'
-    bpy.context.scene.cursor_location = self.pts[2].co3d.copy()
+    bpy.context.scene.cursor.location = self.pts[2].co3d.copy()
     
     axis_lock = RotDat.axis_lock
     ops_lock = ()  # axis lock data for bpy.ops.transform
@@ -1217,7 +1217,7 @@ def do_rotate(self):
         editmode_refresh()
 
     # restore settings back to their pre "do_rotate" state
-    bpy.context.scene.cursor_location = curs_back.copy()
+    bpy.context.scene.cursor.location = curs_back.copy()
     bpy.context.space_data.pivot_point = deepcopy(piv_back)
 
 
index 9de506b..699f941 100644 (file)
@@ -1212,7 +1212,7 @@ class drawPoly(bpy.types.Operator):
                 bpy.ops.view3d.cursor3d('INVOKE_DEFAULT')
 
                 obj = bpy.context.active_object
-                vert_co = bpy.context.scene.cursor_location
+                vert_co = bpy.context.scene.cursor.location
                 world = obj.matrix_world.inverted_safe()
 
                 bpy.ops.mesh.select_all(action='DESELECT')
@@ -1245,7 +1245,7 @@ class drawPoly(bpy.types.Operator):
 
                 mesh.vertices[new_vert_id].select = True
                 bpy.ops.object.mode_set(mode='EDIT', toggle=False)
-                bpy.context.scene.cursor_location = self.cursor_co
+                bpy.context.scene.cursor.location = self.cursor_co
 
 
                 if self.vert_count >= 4:
@@ -1425,7 +1425,7 @@ class drawPoly(bpy.types.Operator):
         self.vgrp = bpy.context.object.vertex_groups.active_index
         bpy.context.object.vertex_groups.active.name = "drawPoly_temp"
 
-        self.cursor_co = bpy.context.scene.cursor_location
+        self.cursor_co = bpy.context.scene.cursor.location
 
 
         context.window_manager.modal_handler_add(self)
index 65bd4cd..e6af96c 100644 (file)
@@ -128,7 +128,7 @@ class NPFBGetContext(bpy.types.Operator):
         NP020FB.snap_target = copy.deepcopy(bpy.context.tool_settings.snap_target)
         NP020FB.pivot_point = copy.deepcopy(bpy.context.space_data.pivot_point)
         NP020FB.trans_orient = copy.deepcopy(bpy.context.space_data.transform_orientation)
-        NP020FB.curloc = copy.deepcopy(bpy.context.scene.cursor_location)
+        NP020FB.curloc = copy.deepcopy(bpy.context.scene.cursor.location)
         NP020FB.acob = bpy.context.active_object
         if bpy.context.mode == 'OBJECT':
             NP020FB.edit_mode = 'OBJECT'
index 9ac0c6e..dbef8f8 100644 (file)
@@ -127,7 +127,7 @@ class NPFRGetContext(bpy.types.Operator):
         NP020FR.snap_target = copy.deepcopy(bpy.context.tool_settings.snap_target)
         NP020FR.pivot_point = copy.deepcopy(bpy.context.space_data.pivot_point)
         NP020FR.trans_orient = copy.deepcopy(bpy.context.space_data.transform_orientation)
-        NP020FR.curloc = copy.deepcopy(bpy.context.scene.cursor_location)
+        NP020FR.curloc = copy.deepcopy(bpy.context.scene.cursor.location)
         NP020FR.acob = bpy.context.active_object
         if bpy.context.mode == 'OBJECT':
             NP020FR.edit_mode = 'OBJECT'
index 7744f08..a41cb22 100644 (file)
@@ -86,7 +86,7 @@ class NPPLGetContext(bpy.types.Operator):
         NP020PL.snap_target = copy.deepcopy(bpy.context.tool_settings.snap_target)
         NP020PL.pivot_point = copy.deepcopy(bpy.context.space_data.pivot_point)
         NP020PL.trans_orient = copy.deepcopy(bpy.context.space_data.transform_orientation)
-        NP020PL.curloc = copy.deepcopy(bpy.context.scene.cursor_location)
+        NP020PL.curloc = copy.deepcopy(bpy.context.scene.cursor.location)
         NP020PL.acob = bpy.context.active_object
         if bpy.context.mode == 'OBJECT':
             NP020PL.edit_mode = 'OBJECT'
@@ -580,7 +580,7 @@ class NPPLAlignSelected(bpy.types.Operator):
                 rot_axis = geometry.normal(tome.vertices[0].co, tome.vertices[1].co, (fromme.vertices[1].co + fromob.location))
                 rot_ang = (((fromme.vertices[1].co + fromob.location) - tome.vertices[0].co)).angle((tome.vertices[1].co - tome.vertices[0].co))
                 np_print('rot_axis, rot_ang =', rot_axis, rot_ang)
-                bpy.context.scene.cursor_location = tome.vertices[0].co
+                bpy.context.scene.cursor.location = tome.vertices[0].co
                 bpy.context.space_data.pivot_point = 'CURSOR'
                 bpy.ops.transform.rotate(value = -rot_ang, axis = rot_axis)
                 np_print('fromme.vertices = ', fromme.vertices)
@@ -600,7 +600,7 @@ class NPPLAlignSelected(bpy.types.Operator):
                     rot_axis = tome.vertices[1].co - tome.vertices[0].co
                     rot_ang = ((tome.vertices[2].co - proj_t)).angle(((fromme.vertices[2].co + fromob.location) - proj_f))
                     np_print('rot_axis, rot_ang =', rot_axis, rot_ang)
-                    bpy.context.scene.cursor_location = tome.vertices[1].co
+                    bpy.context.scene.cursor.location = tome.vertices[1].co
                     bpy.ops.transform.rotate(value = -rot_ang, axis = rot_axis)
                     bpy.ops.object.select_all(action = 'DESELECT')
                     fromob.select_set(True)
@@ -636,7 +636,7 @@ class NPPLRestoreContext(bpy.types.Operator):
         bpy.context.tool_settings.snap_target = NP020PL.snap_target
         bpy.context.space_data.pivot_point = NP020PL.pivot_point
         bpy.context.space_data.transform_orientation = NP020PL.trans_orient
-        bpy.context.scene.cursor_location = NP020PL.curloc
+        bpy.context.scene.cursor.location = NP020PL.curloc
 
         NP020PL.flag = 'RUNTRANSF0'
         return {'FINISHED'}
index b8b7e63..8d12a3d 100644 (file)
@@ -150,7 +150,7 @@ class NPPAGetContext(bpy.types.Operator):
         NP020PA.snap_target = copy.deepcopy(bpy.context.tool_settings.snap_target)
         NP020PA.pivot_point = copy.deepcopy(bpy.context.space_data.pivot_point)
         NP020PA.trans_orient = copy.deepcopy(bpy.context.space_data.transform_orientation)
-        NP020PA.curloc = copy.deepcopy(bpy.context.scene.cursor_location)
+        NP020PA.curloc = copy.deepcopy(bpy.context.scene.cursor.location)
         NP020PA.acob = bpy.context.active_object
         if bpy.context.mode == 'OBJECT':
             NP020PA.edit_mode = 'OBJECT'
index 45ee398..969c0cc 100644 (file)
@@ -150,7 +150,7 @@ class NPPCGetContext(bpy.types.Operator):
         NP020PC.snap_target = copy.deepcopy(bpy.context.tool_settings.snap_target)
         NP020PC.pivot_point = copy.deepcopy(bpy.context.space_data.pivot_point)
         NP020PC.trans_orient = copy.deepcopy(bpy.context.space_data.transform_orientation)
-        NP020PC.curloc = copy.deepcopy(bpy.context.scene.cursor_location)
+        NP020PC.curloc = copy.deepcopy(bpy.context.scene.cursor.location)
         NP020PC.acob = bpy.context.active_object
         if bpy.context.mode == 'OBJECT':
             NP020PC.edit_mode = 'OBJECT'
index 56e2dcf..715b754 100644 (file)
@@ -150,7 +150,7 @@ class NPPIGetContext(bpy.types.Operator):
         NP020PI.snap_target = copy.deepcopy(bpy.context.tool_settings.snap_target)
         NP020PI.pivot_point = copy.deepcopy(bpy.context.space_data.pivot_point)
         NP020PI.trans_orient = copy.deepcopy(bpy.context.space_data.transform_orientation)
-        NP020PI.curloc = copy.deepcopy(bpy.context.scene.cursor_location)
+        NP020PI.curloc = copy.deepcopy(bpy.context.scene.cursor.location)
         NP020PI.acob = bpy.context.active_object
         if bpy.context.mode == 'OBJECT':
             NP020PI.edit_mode = 'OBJECT'
index bdf0c1e..e3fac3e 100644 (file)
@@ -125,7 +125,7 @@ class NPPMGetContext(bpy.types.Operator):
         NP020PM.snap_target = copy.deepcopy(bpy.context.tool_settings.snap_target)
         NP020PM.pivot_point = copy.deepcopy(bpy.context.space_data.pivot_point)
         NP020PM.trans_orient = copy.deepcopy(bpy.context.space_data.transform_orientation)
-        NP020PM.curloc = copy.deepcopy(bpy.context.scene.cursor_location)
+        NP020PM.curloc = copy.deepcopy(bpy.context.scene.cursor.location)
         NP020PM.acob = bpy.context.active_object
         if bpy.context.mode == 'OBJECT':
             NP020PM.edit_mode = 'OBJECT'
index 4d642a1..25b6501 100644 (file)
@@ -144,7 +144,7 @@ class NPPSGetContext(bpy.types.Operator):
         NP020PS.snap_target = copy.deepcopy(bpy.context.tool_settings.snap_target)
         NP020PS.pivot_point = copy.deepcopy(bpy.context.space_data.pivot_point)
         NP020PS.trans_orient = copy.deepcopy(bpy.context.space_data.transform_orientation)
-        NP020PS.curloc = copy.deepcopy(bpy.context.scene.cursor_location)
+        NP020PS.curloc = copy.deepcopy(bpy.context.scene.cursor.location)
         NP020PS.acob = bpy.context.active_object
         if bpy.context.mode == 'OBJECT':
             NP020PS.edit_mode = 'OBJECT'
@@ -323,7 +323,7 @@ class NPPSPrepareContext(bpy.types.Operator):
             if flag_con: axis = (False, False, False)
             if flag_cenpivot: curloc = c3d
             if flag_force: bpy.ops.object.transform_apply(location=False,rotation=True,scale=True)
-            bpy.context.scene.cursor_location = curloc
+            bpy.context.scene.cursor.location = curloc
             NP020PS.axis = axis
 
         return{'FINISHED'}
@@ -870,7 +870,7 @@ class NPPSRestoreContext(bpy.types.Operator):
         bpy.context.space_data.pivot_point = NP020PS.pivot_point
         bpy.context.space_data.transform_orientation = NP020PS.trans_orient
         if NP020PS.trans_custom: bpy.ops.transform.delete_orientation()
-        bpy.context.scene.cursor_location = NP020PS.curloc
+        bpy.context.scene.cursor.location = NP020PS.curloc
         if NP020PS.acob is not None:
             bpy.context.view_layer.objects.active = NP020PS.acob
             bpy.ops.object.mode_set(mode = NP020PS.edit_mode)
index dc55a05..e8bb4e3 100644 (file)
@@ -88,7 +88,7 @@ class NPRMGetContext(bpy.types.Operator):
         NP020RM.snap_target = copy.deepcopy(bpy.context.tool_settings.snap_target)
         NP020RM.pivot_point = copy.deepcopy(bpy.context.space_data.pivot_point)
         NP020RM.trans_orient = copy.deepcopy(bpy.context.space_data.transform_orientation)
-        NP020RM.curloc = copy.deepcopy(bpy.context.scene.cursor_location)
+        NP020RM.curloc = copy.deepcopy(bpy.context.scene.cursor.location)
         NP020RM.acob = bpy.context.active_object
         if bpy.context.mode == 'OBJECT':
             NP020RM.edit_mode = 'OBJECT'
@@ -199,7 +199,7 @@ class NPRMPrepareContext(bpy.types.Operator):
             bpy.context.tool_settings.snap_target = 'ACTIVE'
             bpy.context.space_data.pivot_point = 'CURSOR'
             #bpy.context.space_data.transform_orientation = 'GLOBAL'
-            bpy.context.scene.cursor_location = centerloc
+            bpy.context.scene.cursor.location = centerloc
         else:
             for ob in selob:
                 ob.select_set(False)
@@ -934,7 +934,7 @@ class NPRMRestoreContext(bpy.types.Operator):
         bpy.context.tool_settings.snap_target = NP020RM.snap_target
         bpy.context.space_data.pivot_point = NP020RM.pivot_point
         bpy.context.space_data.transform_orientation = NP020RM.trans_orient
-        bpy.context.scene.cursor_location = NP020RM.curloc
+        bpy.context.scene.cursor.location = NP020RM.curloc
         if NP020RM.acob is not None:
             bpy.context.view_layer.objects.active = NP020RM.acob
             bpy.ops.object.mode_set(mode = NP020RM.edit_mode)
index 05febea..ca0e8ff 100644 (file)
@@ -285,7 +285,7 @@ def do_creaprim(self, mesh, objname, addondir):
     strlist.append("        collection = bpy.context.collection\n")
     strlist.append("        scene = bpy.context.scene\n")
     strlist.append("        collection.objects.link(obj)\n")
-    strlist.append("        obj.location = scene.cursor_location\n")
+    strlist.append("        obj.location = scene.cursor.location\n")
     strlist.append("        bm = bmesh.new()\n")
     strlist.append("        bm.from_mesh(mesh)\n")
     strlist.append("\n")
index 91fca56..50f1e99 100644 (file)
@@ -112,7 +112,7 @@ class AddSurroundCamerasOperator(bpy.types.Operator):
             bpy.ops.object.add()
             obj_origin = context.active_object
             obj_origin.name = CAMERA_ORIGIN_NAME
-            obj_origin.location = scene.cursor_location
+            obj_origin.location = scene.cursor.location
 
         for i in range(0,numScreens):
 
index 1b1d5b1..3f962a6 100644 (file)
@@ -272,7 +272,7 @@ def align_function(subject, active_too, consistent, self_or_active, loc_x, loc_y
             ref2_co = [ref_points[2], ref_points[5], ref_points[8]]
             ref2_co = Vector(ref2_co)
         elif ref2 == "4":
-            ref2_co = bpy.context.scene.cursor_location
+            ref2_co = bpy.context.scene.cursor.location
 
         return ref2_co
 
@@ -416,7 +416,7 @@ def align_function(subject, active_too, consistent, self_or_active, loc_x, loc_y
             ref2_co = find_ref2_co(act_obj)
         else:
             if ref2 == "4":
-                ref2_co = bpy.context.scene.cursor_location
+                ref2_co = bpy.context.scene.cursor.location
             else:
                 ref2_co = act_obj.location
 
@@ -510,32 +510,32 @@ def align_function(subject, active_too, consistent, self_or_active, loc_x, loc_y
 
             if ref2 == "0":
                 if loc_x is True:
-                    bpy.context.scene.cursor_location[0] = ref_points[0] + loc_offset[0]
+                    bpy.context.scene.cursor.location[0] = ref_points[0] + loc_offset[0]
                 if loc_y is True:
-                    bpy.context.scene.cursor_location[1] = ref_points[3] + loc_offset[1]
+                    bpy.context.scene.cursor.location[1] = ref_points[3] + loc_offset[1]
                 if loc_z is True:
-                    bpy.context.scene.cursor_location[2] = ref_points[6] + loc_offset[2]
+                    bpy.context.scene.cursor.location[2] = ref_points[6] + loc_offset[2]
             elif ref2 == "1":
                 if loc_x is True:
-                    bpy.context.scene.cursor_location[0] = ref_points[1] + loc_offset[0]
+                    bpy.context.scene.cursor.location[0] = ref_points[1] + loc_offset[0]
                 if loc_y is True:
-                    bpy.context.scene.cursor_location[1] = ref_points[4] + loc_offset[1]
+                    bpy.context.scene.cursor.location[1] = ref_points[4] + loc_offset[1]
                 if loc_z is True:
-                    bpy.context.scene.cursor_location[2] = ref_points[7] + loc_offset[2]
+                    bpy.context.scene.cursor.location[2] = ref_points[7] + loc_offset[2]
             elif ref2 == "2":
                 if loc_x is True:
-                    bpy.context.scene.cursor_location[0] = act_obj.location[0] + loc_offset[0]
+                    bpy.context.scene.cursor.location[0] = act_obj.location[0] + loc_offset[0]
                 if loc_y is True:
-                    bpy.context.scene.cursor_location[1] = act_obj.location[1] + loc_offset[1]
+                    bpy.context.scene.cursor.location[1] = act_obj.location[1] + loc_offset[1]
                 if loc_z is True:
-                    bpy.context.scene.cursor_location[2] = act_obj.location[2] + loc_offset[2]
+                    bpy.context.scene.cursor.location[2] = act_obj.location[2] + loc_offset[2]
             elif ref2 == "3":
                 if loc_x is True:
-                    bpy.context.scene.cursor_location[0] = ref_points[2] + loc_offset[0]
+                    bpy.context.scene.cursor.location[0] = ref_points[2] + loc_offset[0]
                 if loc_y is True:
-                    bpy.context.scene.cursor_location[1] = ref_points[5] + loc_offset[1]
+                    bpy.context.scene.cursor.location[1] = ref_points[5] + loc_offset[1]
                 if loc_z is True:
-                    bpy.context.scene.cursor_location[2] = ref_points[8] + loc_offset[2]
+                    bpy.context.scene.cursor.location[2] = ref_points[8] + loc_offset[2]
         elif self_or_active == "2":
             ref_co = point_in_selection(act_obj, sel_obj)
 
@@ -544,25 +544,25 @@ def align_function(subject, active_too, consistent, self_or_active, loc_x, loc_y
 
             if ref2 == "0":
                 if loc_x is True:
-                    bpy.context.scene.cursor_location[0] = sel_min[0] + loc_offset[0]
+                    bpy.context.scene.cursor.location[0] = sel_min[0] + loc_offset[0]
                 if loc_y is True:
-                    bpy.context.scene.cursor_location[1] = sel_min[1] + loc_offset[1]
+                    bpy.context.scene.cursor.location[1] = sel_min[1] + loc_offset[1]
                 if loc_z is True:
-                    bpy.context.scene.cursor_location[2] = sel_min[2] + loc_offset[2]
+                    bpy.context.scene.cursor.location[2] = sel_min[2] + loc_offset[2]
             elif ref2 == "1":
                 if loc_x is True:
-                    bpy.context.scene.cursor_location[0] = sel_center[0] + loc_offset[0]
+                    bpy.context.scene.cursor.location[0] = sel_center[0] + loc_offset[0]
                 if loc_y is True:
-                    bpy.context.scene.cursor_location[1] = sel_center[1] + loc_offset[1]
+                    bpy.context.scene.cursor.location[1] = sel_center[1] + loc_offset[1]
                 if loc_z is True:
-                    bpy.context.scene.cursor_location[2] = sel_center[2] + loc_offset[2]
+                    bpy.context.scene.cursor.location[2] = sel_center[2] + loc_offset[2]
             elif ref2 == "3":
                 if loc_x is True:
-                    bpy.context.scene.cursor_location[0] = sel_max[0] + loc_offset[0]
+                    bpy.context.scene.cursor.location[0] = sel_max[0] + loc_offset[0]
                 if loc_y is True:
-                    bpy.context.scene.cursor_location[1] = sel_max[1] + loc_offset[1]
+                    bpy.context.scene.cursor.location[1] = sel_max[1] + loc_offset[1]
                 if loc_z is True:
-                    bpy.context.scene.cursor_location[2] = sel_max[2] + loc_offset[2]
+                    bpy.context.scene.cursor.location[2] = sel_max[2] + loc_offset[2]
 
 
 # Classes #
index f91611e..b5f8a94 100644 (file)
@@ -48,11 +48,11 @@ class CursorAccess:
     def setCursor(cls, coordinates):
         spc = cls.findSpace()
         try:
-            spc.cursor_location = coordinates
+            spc.cursor.location = coordinates
         except:
             pass
 
     @classmethod
     def getCursor(cls):
         spc = cls.findSpace()
-        return spc.cursor_location if spc else None
+        return spc.cursor.location if spc else None
index 45ee5d3..42d70e5 100644 (file)
@@ -1546,7 +1546,7 @@ def gather_particles(**kwargs):
     area_type = kwargs.get("area_type", context.area.type)
 
     scene = kwargs.get("scene", context.scene)
-       
+
     view_layer = kwargs.get("view_layer", context.view_layer)
 
     space_data = kwargs.get("space_data", context.space_data)
@@ -4777,7 +4777,7 @@ class CursorMonitor(bpy.types.Operator):
                 # startup location should be added
                 new_pos = curr_pos
 
-        # Seems like scene.cursor_location is fast enough here
+        # Seems like scene.cursor.location is fast enough here
         # -> no need to resort to v3d.cursor_location.
         """
         screen = bpy.context.screen
@@ -5452,7 +5452,7 @@ def get_cursor_location(v3d=None, scene=None):
     if v3d:
         pos = v3d.cursor_location
     elif scene:
-        pos = scene.cursor_location
+        pos = scene.cursor.location
 
     return pos.copy()
 
@@ -5462,12 +5462,12 @@ def set_cursor_location(pos, v3d=None, scene=None):
 
     if v3d:
         scene = bpy.context.scene
-        # Accessing scene.cursor_location is SLOW
+        # Accessing scene.cursor.location is SLOW
         # (well, at least assigning to it).
-        # Accessing v3d.cursor_location is fast.
+        # Accessing v3d.cursor.location is fast.
         v3d.cursor_location = pos
     elif scene:
-        scene.cursor_location = pos
+        scene.cursor.location = pos
 
     if set_cursor_location__reset_stick:
         set_stick_obj(scene, None)
index e88b1c1..dd82c99 100644 (file)
@@ -63,7 +63,7 @@ def pick_object(context, event, pick_objects, ray_max=10000.0):
     ray_origin = view3d_utils.region_2d_to_origin_3d(region, rv3d, coord)
     ray_target = ray_origin + (view_vector * ray_max)
 
-    scene.cursor_location = ray_target
+    scene.cursor.location = ray_target
 
     def visible_objects_and_duplis():
         """Loop over (object, matrix) pairs (mesh only)"""
index a4d5b7e..20bed06 100644 (file)
@@ -73,19 +73,19 @@ def align_to_view(context):
         em.scale = Vector((prop * scale[0], scale[0], 1))
     else:
         em.scale = Vector((prop * scale[0], scale[1], 1))
-    pos_cur = em.location - sd.cursor_location
+    pos_cur = em.location - sd.cursor.location
     rot_cur1 = em.rotation_euler.to_quaternion()
     em.location = v + ob.location
     em.rotation_euler = Quaternion.to_euler(vr * quat)
     if em.custom_c3d:
         if em.custom_old_scale != em.custom_scale:
-            pos_cur = em.location - sd.cursor_location
+            pos_cur = em.location - sd.cursor.location
         rot_cur2 = em.rotation_euler.to_quaternion()
         rot_cur1.invert()
         pos_cur.rotate(rot_cur1)
         pos_cur.rotate(rot_cur2)
         v = em.location - pos_cur
-        sd.cursor_location = v
+        sd.cursor.location = v
 
 
 def applyimage(context):
@@ -214,7 +214,7 @@ def update_Rotation(self, context):
         angle = em.custom_rotation - em.custom_old_rotation
         sd = context.space_data
         vr = sd.region_3d.view_rotation.copy()
-        c = sd.cursor_location - ob.location
+        c = sd.cursor.location - ob.location
         e = bpy.data.objects[BProjection_Empty].location - ob.location
         vo = Vector((0.0, 0.0, 1.0))
         vo.rotate(vr)
@@ -242,7 +242,7 @@ def update_Scale(self, context):
         vr = r3d.view_rotation.copy()
         vr.invert()
         e = em.location - ob.location
-        c = sd.cursor_location - ob.location
+        c = sd.cursor.location - ob.location
         ce = e - c
 
         s = em.custom_scale
@@ -1367,7 +1367,7 @@ class BP_Paint(Operator):
         sd = context.space_data
         l = sd.region_3d
         v_init = Vector((0.0, 0.0, 1.0))
-        context.scene.cursor_location = view3d_utils.region_2d_to_location_3d(
+        context.scene.cursor.location = view3d_utils.region_2d_to_location_3d(
                                                     context.region, l,
                                                     [event.mouse_region_x,
                                                      event.mouse_region_y], v_init
@@ -1677,7 +1677,7 @@ class BP_Rotate(Operator):
         sd = context.space_data
 
         center = view3d_utils.location_3d_to_region_2d(context.region, sd.region_3d, em.location if
-                                                       em.custom_rotc3d else context.scene.cursor_location)
+                                                       em.custom_rotc3d else context.scene.cursor.location)
         vec_init = self.first_mouse - center
         vec_act = Vector((event.mouse_region_x, event.mouse_region_y)) - center
         rot = -vec_init.angle_signed(vec_act) * 180 / pi
index c5fa71d..7cde227 100644 (file)
@@ -190,7 +190,7 @@ def getMeasurePoints(context):
                 # We measure the distance from...
                 # local  ... the object center to the 3D cursor.
                 # global ... the origin to the 3D cursor.
-                cur_loc = sce.cursor_location
+                cur_loc = sce.cursor.location
                 obj_loc = obj.matrix_world.to_translation()
 
                 # Convert to local space, if needed.
@@ -208,7 +208,7 @@ def getMeasurePoints(context):
                 # One vertex selected.
                 # We measure the distance from the
                 # selected vertex object to the 3D cursor.
-                cur_loc = sce.cursor_location
+                cur_loc = sce.cursor.location
                 vert_loc = verts_selected[0].co.copy()
 
                 # Convert to local or global space.
@@ -260,7 +260,7 @@ def getMeasurePoints(context):
         elif obj:
             # One object selected.
             # We measure the distance from the object to the 3D cursor.
-            cur_loc = sce.cursor_location
+            cur_loc = sce.cursor.location
             obj_loc = obj.matrix_world.to_translation()
             return (obj_loc, cur_loc, COLOR_GLOBAL)
 
@@ -268,7 +268,7 @@ def getMeasurePoints(context):
             # Nothing selected.
             # We measure the distance from the origin to the 3D cursor.
             p1 = Vector((0.0, 0.0, 0.0))
-            p2 = sce.cursor_location
+            p2 = sce.cursor.location
             return (p1, p2, COLOR_GLOBAL)
 
         else:
index 117ecd7..c62bb47 100644 (file)
@@ -2799,7 +2799,7 @@ def edgeIntersect(context, operator):
         return
 
     point = line[0].lerp(line[1], 0.5)
-    context.scene.cursor_location = obj.matrix_world * point
+    context.scene.cursor.location = obj.matrix_world * point
 
 
 # Cursor Edge Intersection Operator #
@@ -2847,16 +2847,16 @@ class SetObjectMode2(Operator):
 # Origin To Selected Edit Mode #
 def vfeOrigin(context):
     try:
-        cursorPositionX = context.scene.cursor_location[0]
-        cursorPositionY = context.scene.cursor_location[1]
-        cursorPositionZ = context.scene.cursor_location[2]
+        cursorPositionX = context.scene.cursor.location[0]
+        cursorPositionY = context.scene.cursor.location[1]
+        cursorPositionZ = context.scene.cursor.location[2]
         bpy.ops.view3d.snap_cursor_to_selected()
         bpy.ops.object.mode_set()
         bpy.ops.object.origin_set(type='ORIGIN_CURSOR', center='MEDIAN')
         bpy.ops.object.mode_set(mode='EDIT')
-        context.scene.cursor_location[0] = cursorPositionX
-        context.scene.cursor_location[1] = cursorPositionY
-        context.scene.cursor_location[2] = cursorPositionZ
+        context.scene.cursor.location[0] = cursorPositionX
+        context.scene.cursor.location[1] = cursorPositionY
+        context.scene.cursor.location[2] = cursorPositionZ
         return True
     except:
         return False
@@ -2892,7 +2892,7 @@ class SnapCursSelToCenter2(Operator):
         return (context.area.type == "VIEW_3D" and context.mode == "OBJECT")
 
     def execute(self, context):
-        context.space_data.cursor_location = (0, 0, 0)
+        context.space_data.cursor.location = (0, 0, 0)
         for obj in context.selected_objects:
             obj.location = (0, 0, 0)
         return {'FINISHED'}
index 1075a81..c42a387 100644 (file)
@@ -12,7 +12,7 @@ class NorthClass:
         self.isActive = False
 
     def refresh_screen(self):
-        bpy.context.scene.cursor_location.x += 0.0
+        bpy.context.scene.cursor.location.x += 0.0
 
     def activate(self, context):
 
index 0563526..9fd0ca8 100644 (file)
@@ -30,7 +30,7 @@ class DisplayAction:
 
     def refresh(self):
         # Touching the cursor forces a screen refresh
-        bpy.context.scene.cursor_location.x += 0.0
+        bpy.context.scene.cursor.location.x += 0.0
 
 
 Display = DisplayAction()