Commit a11ed513 authored by Campbell Barton's avatar Campbell Barton

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.
parent e1ba55d8
......@@ -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
......
......@@ -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
......
......@@ -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')
......
......@@ -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")
......
......@@ -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)
#===========================================
......
......@@ -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)
......
......@@ -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)
......
......@@ -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'
......
......@@ -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'
......
......@@ -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'}
......
......@@ -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'
......
......@@ -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'
......
......@@ -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'
......
......@@ -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'
......
......@@ -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)
......
......@@ -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)
......
......@@ -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")
......
......@@ -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):
......
......@@ -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 #
......
......@@ -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
......@@ -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.