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.
This commit is contained in:
Campbell Barton 2019-03-01 12:49:17 +11:00
parent dd0dffef42
commit 9999dada60
52 changed files with 123 additions and 123 deletions

View File

@ -247,7 +247,7 @@ class OBJECT_OT_agregate_mesh(Operator):
msv.append(obj.modifiers[i].show_viewport)
obj.modifiers[i].show_viewport = False
cur = scn.cursor_location
cur = scn.cursor.location
for i in range(self.numP):
mes = choice(par).data
@ -310,7 +310,7 @@ class OBJECT_OT_agregate_mesh(Operator):
bpy.ops.object.join()
if self.track:
cur = scn.cursor_location = cpom[1]
cur = scn.cursor.location = cpom[1]
for i in range(len(msv)):
obj.modifiers[i].show_viewport = msv[i]

View File

@ -926,10 +926,10 @@ def move_origin_to_start():
start = active.matrix_world @ spline.points[0].co
start = start[:-1]
cursor = bpy.context.scene.cursor_location.copy()
bpy.context.scene.cursor_location = start
cursor = bpy.context.scene.cursor.location.copy()
bpy.context.scene.cursor.location = start
bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
bpy.context.scene.cursor_location = cursor
bpy.context.scene.cursor.location = cursor
def draw_spline_settings(self):

View File

@ -148,7 +148,7 @@ def align_matrix(self, context):
if self.absolute_location:
loc = Matrix.Translation(Vector((0, 0, 0)))
else:
loc = Matrix.Translation(context.scene.cursor_location)
loc = Matrix.Translation(context.scene.cursor.location)
# user defined location & translation
userLoc = Matrix.Translation(self.location)

View File

@ -123,7 +123,7 @@ class MakeSurfaceWedge(Operator, MakeSurfaceHelpers):
# change name
context.active_object.name = 'SurfaceWedge'
# get the wedge to the 3d cursor.
context.active_object.location = context.scene.cursor_location
context.active_object.location = context.scene.cursor.location
bpy.ops.transform.resize(value=(size, size, size))
# adjust resolution in u and v direction
@ -186,7 +186,7 @@ class MakeSurfaceCone(Operator, MakeSurfaceHelpers):
bpy.ops.object.editmode_toggle()
# bring object to cursor
bpy.ops.object.mode_set(mode='OBJECT')
context.active_object.location = context.scene.cursor_location
context.active_object.location = context.scene.cursor.location
# adjust size
bpy.ops.transform.resize(value=(size, size, size))
@ -266,7 +266,7 @@ class MakeSurfaceStar(Operator, MakeSurfaceHelpers):
# origin to geometry
bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY', center='MEDIAN')
# get object to 3d cursor
context.active_object.location = context.scene.cursor_location
context.active_object.location = context.scene.cursor.location
# change name
ao.name = 'SurfaceStar'
# adjust size
@ -334,7 +334,7 @@ class MakeSurfacePlane(Operator, MakeSurfaceHelpers):
# bring object to 3d cursor
bpy.ops.object.mode_set(mode='OBJECT')
context.active_object.location = context.scene.cursor_location
context.active_object.location = context.scene.cursor.location
bpy.ops.transform.resize(value=(size, size, size))
# adjust resolution in u and v direction

View File

@ -528,7 +528,7 @@ class IvyGen(Operator):
# radius = computeBoundingSphere(ob) # Not needed anymore
# Get the seeding point
seedPoint = context.scene.cursor_location
seedPoint = context.scene.cursor.location
# Fix the random seed
rand_seed(randomSeed)

View File

@ -1603,7 +1603,7 @@ def addTree(props):
treeOb = bpy.data.objects.new('tree', cu)
bpy.context.scene.collection.objects.link(treeOb)
# treeOb.location=bpy.context.scene.cursor_location attractUp
# treeOb.location=bpy.context.scene.cursor.location attractUp
cu.dimensions = '3D'
cu.fill_mode = 'FULL'

View File

@ -877,7 +877,7 @@ class add_mesh_wallb(Operator):
context.view_layer.objects.active = ob_new
ob_new.select_set(True)
ob_new.location = tuple(context.scene.cursor_location)
ob_new.location = tuple(context.scene.cursor.location)
ob_new.rotation_quaternion = [1.0, 0.0, 0.0, 0.0]
return {'FINISHED'}

View File

@ -69,7 +69,7 @@ class P2E(Operator):
pass
if self.locat == 'CURSOR':
loc = sce.cursor_location
loc = sce.cursor.location
elif self.locat == 'ACTIVE':
loc = act.location
else:

View File

@ -184,7 +184,7 @@ def create_book_mesh(self):
# ------------------------------------------------------------------------------
def generate_books(self):
boxes = []
location = bpy.context.scene.cursor_location
location = bpy.context.scene.cursor.location
myloc = copy(location) # copy location to keep 3D cursor position
# Create

View File

@ -605,7 +605,7 @@ def create_circular_column(self, objname, radio_top, radio_mid, radio_bottom, he
mesh = bpy.data.meshes.new(objname)
myobject = bpy.data.objects.new(objname, mesh)
myobject.location = bpy.context.scene.cursor_location
myobject.location = bpy.context.scene.cursor.location
bpy.context.collection.objects.link(myobject)
mesh.from_pydata(myvertex, [], myfaces)
@ -677,7 +677,7 @@ def create_torus(objname, radio_inside, radio_outside, height):
mesh = bpy.data.meshes.new(objname)
myobject = bpy.data.objects.new(objname, mesh)
myobject.location = bpy.context.scene.cursor_location
myobject.location = bpy.context.scene.cursor.location
bpy.context.collection.objects.link(myobject)
mesh.from_pydata(myvertex, [], myfaces)
@ -726,7 +726,7 @@ def create_rectangular_base(self, objname, x, y, z, ramp=False):
mesh = bpy.data.meshes.new(objname)
myobject = bpy.data.objects.new(objname, mesh)
myobject.location = bpy.context.scene.cursor_location
myobject.location = bpy.context.scene.cursor.location
bpy.context.collection.objects.link(myobject)
mesh.from_pydata(myvertex, [], myfaces)
@ -792,7 +792,7 @@ def create_arc(objname, radio, gap, thickness, center):
mesh = bpy.data.meshes.new(objname)
myobject = bpy.data.objects.new(objname, mesh)
myobject.location = bpy.context.scene.cursor_location
myobject.location = bpy.context.scene.cursor.location
bpy.context.collection.objects.link(myobject)
mesh.from_pydata(myvertex, [], myfaces)

View File

@ -266,7 +266,7 @@ def generate_japan(self):
support = []
panel = []
location = bpy.context.scene.cursor_location
location = bpy.context.scene.cursor.location
myloc = copy(location) # copy location to keep 3D cursor position
# ------------------
@ -625,7 +625,7 @@ def create_bezier(objname, points, origin, depth=0.001, fill='FULL'):
# All custom values are passed using self container (self.myvariable)
# ------------------------------------------------------------------------------
def generate_roller(self):
location = bpy.context.scene.cursor_location
location = bpy.context.scene.cursor.location
myloc = copy(location) # copy location to keep 3D cursor position
# ------------------

View File

@ -76,7 +76,7 @@ def create_object(self, context):
# we create main object and mesh
mainmesh = bpy.data.meshes.new("DoorFrane")
mainobject = bpy.data.objects.new("DoorFrame", mainmesh)
mainobject.location = bpy.context.scene.cursor_location
mainobject.location = bpy.context.scene.cursor.location
bpy.context.collection.objects.link(mainobject)
mainobject.DoorObjectGenerator.add()
@ -601,7 +601,7 @@ def create_door_data(self, myframe, width, openside):
mymesh = bpy.data.meshes.new("Door")
myobject = bpy.data.objects.new("Door", mymesh)
myobject.location = bpy.context.scene.cursor_location
myobject.location = bpy.context.scene.cursor.location
bpy.context.collection.objects.link(myobject)
mymesh.from_pydata(verts, [], faces)
@ -653,7 +653,7 @@ def create_handle(self, mydoor, pos, frame_width, openside):
mymesh = bpy.data.meshes.new("Handle_" + pos)
myobject = bpy.data.objects.new("Handle_" + pos, mymesh)
myobject.location = bpy.context.scene.cursor_location
myobject.location = bpy.context.scene.cursor.location
bpy.context.collection.objects.link(myobject)
mymesh.from_pydata(verts, [], faces)

View File

@ -629,7 +629,7 @@ def generate_cabinets(self):
boxes = []
bases = []
location = bpy.context.scene.cursor_location
location = bpy.context.scene.cursor.location
myloc = copy(location) # copy location to keep 3D cursor position
# Fit to floor
if self.fitZ:

View File

@ -412,7 +412,7 @@ def create_light_mesh(self):
# All custom values are passed using self container (self.myvariable)
# ------------------------------------------------------------------------------
def generate_light(self):
location = bpy.context.scene.cursor_location
location = bpy.context.scene.cursor.location
myloc = copy(location) # copy location to keep 3D cursor position
# ---------------------
# Lamp base

View File

@ -341,9 +341,9 @@ class ARCHIMESH_OT_Pencil(Operator):
# ----------------------------
if len(mypoints) > 1 and len(clearangles) > 0:
# Move cursor
bpy.context.scene.cursor_location.x = mypoints[0][0]
bpy.context.scene.cursor_location.y = mypoints[0][1]
bpy.context.scene.cursor_location.z = 0 # always on grid floor
bpy.context.scene.cursor.location.x = mypoints[0][0]
bpy.context.scene.cursor.location.y = mypoints[0][1]
bpy.context.scene.cursor.location.z = 0 # always on grid floor
# Add room mesh
bpy.ops.mesh.archimesh_room()

View File

@ -242,7 +242,7 @@ def create_roof(self):
mymesh = bpy.data.meshes.new("Roof")
myobject = bpy.data.objects.new("Roof", mymesh)
myobject.location = bpy.context.scene.cursor_location
myobject.location = bpy.context.scene.cursor.location
bpy.context.collection.objects.link(myobject)
mymesh.from_pydata(verts, [], faces)

View File

@ -354,7 +354,7 @@ def create_room(self, context):
# we create main object and mesh for walls
roommesh = bpy.data.meshes.new("Room")
roomobject = bpy.data.objects.new("Room", roommesh)
roomobject.location = bpy.context.scene.cursor_location
roomobject.location = bpy.context.scene.cursor.location
bpy.context.collection.objects.link(roomobject)
roomobject.RoomGenerator.add()
roomobject.RoomGenerator[0].walls.add()

View File

@ -278,7 +278,7 @@ def create_shelves_mesh(self):
def generate_shelves(self):
boxes = []
location = bpy.context.scene.cursor_location
location = bpy.context.scene.cursor.location
myloc = copy(location) # copy location to keep 3D cursor position
# Fit to floor
if self.fitZ:

View File

@ -273,7 +273,7 @@ def create_stairs(self, objname):
mesh = bpy.data.meshes.new(objname)
myobject = bpy.data.objects.new(objname, mesh)
myobject.location = bpy.context.scene.cursor_location
myobject.location = bpy.context.scene.cursor.location
bpy.context.collection.objects.link(myobject)
mesh.from_pydata(myvertex, [], myfaces)

View File

@ -922,7 +922,7 @@ def create_control_box(objname, x, y, z, tube=True):
mesh = bpy.data.meshes.new(objname)
myobject = bpy.data.objects.new(objname, mesh)
myobject.location = bpy.context.scene.cursor_location
myobject.location = bpy.context.scene.cursor.location
bpy.context.collection.objects.link(myobject)
mesh.from_pydata(myvertex, [], myfaces)

View File

@ -76,7 +76,7 @@ def create_object(self, context):
# we create main object and mesh
mainmesh = bpy.data.meshes.new("VenetianFrane")
mainobject = bpy.data.objects.new("VenetianFrame", mainmesh)
mainobject.location = bpy.context.scene.cursor_location
mainobject.location = bpy.context.scene.cursor.location
bpy.context.collection.objects.link(mainobject)
mainobject.VenetianObjectGenerator.add()
@ -517,7 +517,7 @@ def create_slat_mesh(objname, width, depth, height, angle, ratio):
mesh = bpy.data.meshes.new(objname)
myobject = bpy.data.objects.new(objname, mesh)
myobject.location = bpy.context.scene.cursor_location
myobject.location = bpy.context.scene.cursor.location
bpy.context.collection.objects.link(myobject)
mesh.from_pydata(myvertex, [], myfaces)
@ -643,7 +643,7 @@ def create_venetian_base(objname, x, y, z):
mesh = bpy.data.meshes.new(objname)
myobject = bpy.data.objects.new(objname, mesh)
myobject.location = bpy.context.scene.cursor_location
myobject.location = bpy.context.scene.cursor.location
bpy.context.collection.objects.link(myobject)
mesh.from_pydata(myvertex, [], myfaces)
@ -808,7 +808,7 @@ def get_venetian_stick(objname, height):
mesh = bpy.data.meshes.new(objname)
myobject = bpy.data.objects.new(objname, mesh)
myobject.location = bpy.context.scene.cursor_location
myobject.location = bpy.context.scene.cursor.location
bpy.context.collection.objects.link(myobject)
mesh.from_pydata(myvertex, [], myfaces)
@ -1374,7 +1374,7 @@ def get_venetian_strings(objname, height):
mesh = bpy.data.meshes.new(objname)
myobject = bpy.data.objects.new(objname, mesh)
myobject.location = bpy.context.scene.cursor_location
myobject.location = bpy.context.scene.cursor.location
bpy.context.collection.objects.link(myobject)
mesh.from_pydata(myvertex, [], myfaces)

View File

@ -76,7 +76,7 @@ def create_object(self, context):
# we create main object and mesh
mainmesh = bpy.data.meshes.new("WindowFrane")
mainobject = bpy.data.objects.new("WindowFrame", mainmesh)
mainobject.location = bpy.context.scene.cursor_location
mainobject.location = bpy.context.scene.cursor.location
bpy.context.collection.objects.link(mainobject)
mainobject.WindowObjectGenerator.add()
@ -526,7 +526,7 @@ class ARCHIMESH_PT_WindowObjectgenerator(Panel):
# Generate rail windows
# ------------------------------------------------------------------------------
def generate_rail_window(myframe, mp, mymesh):
myloc = bpy.context.scene.cursor_location
myloc = bpy.context.scene.cursor.location
alummat = None
if mp.crt_mat and bpy.context.scene.render.engine in {'CYCLES', 'BLENDER_EEVEE'}:
@ -617,7 +617,7 @@ def generate_rail_window(myframe, mp, mymesh):
# Generate leaf windows
# ------------------------------------------------------------------------------
def generate_leaf_window(myframe, mp, mymesh):
myloc = bpy.context.scene.cursor_location
myloc = bpy.context.scene.cursor.location
alummat = None
if mp.crt_mat and bpy.context.scene.render.engine in {'CYCLES', 'BLENDER_EEVEE'}:
@ -1750,7 +1750,7 @@ def create_leaf_handle(objname, mat):
mesh = bpy.data.meshes.new(objname)
myobject = bpy.data.objects.new(objname, mesh)
myobject.location = bpy.context.scene.cursor_location
myobject.location = bpy.context.scene.cursor.location
bpy.context.collection.objects.link(myobject)
mesh.from_pydata(myvertex, [], myfaces)
@ -2091,7 +2091,7 @@ def create_rail_handle(objname, mat):
mesh = bpy.data.meshes.new(objname)
myobject = bpy.data.objects.new(objname, mesh)
myobject.location = bpy.context.scene.cursor_location
myobject.location = bpy.context.scene.cursor.location
bpy.context.collection.objects.link(myobject)
mesh.from_pydata(myvertex, [], myfaces)
@ -2129,7 +2129,7 @@ def create_sill(objname, x, y, z, mat):
mesh = bpy.data.meshes.new(objname)
myobject = bpy.data.objects.new(objname, mesh)
myobject.location = bpy.context.scene.cursor_location
myobject.location = bpy.context.scene.cursor.location
bpy.context.collection.objects.link(myobject)
mesh.from_pydata(myvertex, [], myfaces)
@ -2167,7 +2167,7 @@ def create_blind_box(objname, x, y, z):
mesh = bpy.data.meshes.new(objname)
myobject = bpy.data.objects.new(objname, mesh)
myobject.location = bpy.context.scene.cursor_location
myobject.location = bpy.context.scene.cursor.location
bpy.context.collection.objects.link(myobject)
mesh.from_pydata(myvertex, [], myfaces)

View File

@ -239,7 +239,7 @@ def create_window():
# Link object to scene
bpy.context.collection.objects.link(window_object)
window_object.WindowPanelGenerator.add()
window_object.location = bpy.context.scene.cursor_location
window_object.location = bpy.context.scene.cursor.location
# Shape the mesh.
do_mesh(window_object, window_mesh)
@ -1540,7 +1540,7 @@ def create_ctrl_box(parentobj, objname):
mymesh = bpy.data.meshes.new(objname)
myobj = bpy.data.objects.new(objname, mymesh)
myobj.location = bpy.context.scene.cursor_location
myobj.location = bpy.context.scene.cursor.location
bpy.context.collection.objects.link(myobj)
mymesh.from_pydata(myvertex, [], myfaces)

View File

@ -422,7 +422,7 @@ class ArchipackBoolManager(ArchipackCollectionManager):
# parenting childs to wall reference point
if wall.parent is None:
x, y, z = wall.bound_box[0]
context.scene.cursor_location = wall.matrix_world @ Vector((x, y, z))
context.scene.cursor.location = wall.matrix_world @ Vector((x, y, z))
# fix issue #9
context.view_layer.objects.active = wall
bpy.ops.archipack.reference_point()
@ -505,7 +505,7 @@ class ArchipackBoolManager(ArchipackCollectionManager):
# parenting childs to wall reference point
if wall.parent is None:
x, y, z = wall.bound_box[0]
context.scene.cursor_location = wall.matrix_world @ Vector((x, y, z))
context.scene.cursor.location = wall.matrix_world @ Vector((x, y, z))
# fix issue #9
context.view_layer.objects.active = wall
bpy.ops.archipack.reference_point()

View File

@ -1624,7 +1624,7 @@ class ARCHIPACK_OT_door(ArchipackCreateTool, Operator):
if self.mode == 'CREATE':
bpy.ops.object.select_all(action="DESELECT")
o = self.create(context)
o.location = bpy.context.scene.cursor_location
o.location = bpy.context.scene.cursor.location
o.select_set(state=True)
context.view_layer.objects.active = o
self.manipulate()

View File

@ -1631,7 +1631,7 @@ class ARCHIPACK_OT_fence(ArchipackCreateTool, Operator):
if context.mode == "OBJECT":
bpy.ops.object.select_all(action="DESELECT")
o = self.create(context)
o.location = context.scene.cursor_location
o.location = context.scene.cursor.location
o.select_set(state=True)
context.view_layer.objects.active = o
self.manipulate()

View File

@ -1830,7 +1830,7 @@ class ARCHIPACK_OT_floor(ArchipackCreateTool, Operator):
if context.mode == "OBJECT":
bpy.ops.object.select_all(action="DESELECT")
o = self.create(context)
o.location = context.scene.cursor_location
o.location = context.scene.cursor.location
# activate manipulators at creation time
o.select_set(state=True)
context.view_layer.objects.active = o
@ -1978,7 +1978,7 @@ class ARCHIPACK_OT_floor_cutter(ArchipackCreateTool, Operator):
pd = archipack_floor.datablock(parent)
pd.boundary = o.name
else:
o.location = context.scene.cursor_location
o.location = context.scene.cursor.location
# make manipulators selectable
d.manipulable_selectable = True
self.link_object_to_scene(context, o)

View File

@ -230,7 +230,7 @@ class ARCHIPACK_OT_reference_point(ArchipackCollectionManager, Operator):
row.label(text="Use Properties panel (N) to define parms", icon='INFO')
def create(self, context):
x, y, z = context.scene.cursor_location
x, y, z = context.scene.cursor.location
# bpy.ops.object.empty_add(type='ARROWS', radius=0.5, location=Vector((x, y, 0)))
m = bpy.data.meshes.new(name="Reference")
o = bpy.data.objects.new("Reference", m)

View File

@ -5049,7 +5049,7 @@ class ARCHIPACK_OT_roof(ArchipackCreateTool, Operator):
if context.mode == "OBJECT":
bpy.ops.object.select_all(action="DESELECT")
o = self.create(context)
o.location = context.scene.cursor_location
o.location = context.scene.cursor.location
o.select_set(state=True)
context.view_layer.objects.active = o
self.manipulate()
@ -5101,7 +5101,7 @@ class ARCHIPACK_OT_roof_cutter(ArchipackCreateTool, Operator):
pd = archipack_roof.datablock(parent)
pd.boundary = o.name
else:
o.location = context.scene.cursor_location
o.location = context.scene.cursor.location
# make manipulators selectable
d.manipulable_selectable = True
self.link_object_to_scene(context, o)

View File

@ -1466,7 +1466,7 @@ class ARCHIPACK_OT_slab(ArchipackCreateTool, Operator):
if context.mode == "OBJECT":
bpy.ops.object.select_all(action="DESELECT")
o = self.create(context)
o.location = bpy.context.scene.cursor_location
o.location = bpy.context.scene.cursor.location
o.select_set(state=True)
context.view_layer.objects.active = o
self.manipulate()
@ -1578,7 +1578,7 @@ class ARCHIPACK_OT_slab_from_wall(Operator):
# parenting childs to wall reference point
if wall.parent is None:
x, y, z = wall.bound_box[0]
context.scene.cursor_location = wall.matrix_world @ Vector((x, y, z))
context.scene.cursor.location = wall.matrix_world @ Vector((x, y, z))
# fix issue #9
context.view_layer.objects.active = wall
bpy.ops.archipack.reference_point()
@ -1651,7 +1651,7 @@ class ARCHIPACK_OT_slab_cutter(ArchipackCreateTool, Operator):
pd = archipack_slab.datablock(parent)
pd.boundary = o.name
else:
o.location = context.scene.cursor_location
o.location = context.scene.cursor.location
# make manipulators selectable
d.manipulable_selectable = True
self.link_object_to_scene(context, o)

View File

@ -2768,7 +2768,7 @@ class ARCHIPACK_OT_stair(ArchipackCreateTool, Operator):
if context.mode == "OBJECT":
bpy.ops.object.select_all(action="DESELECT")
o = self.create(context)
o.location = context.scene.cursor_location
o.location = context.scene.cursor.location
o.select_set(state=True)
context.view_layer.objects.active = o
self.manipulate()

View File

@ -333,7 +333,7 @@ class ARCHIPACK_OT_truss(ArchipackCreateTool, Operator):
if context.mode == "OBJECT":
bpy.ops.object.select_all(action="DESELECT")
o = self.create(context)
o.location = bpy.context.scene.cursor_location
o.location = bpy.context.scene.cursor.location
o.select_set(state=True)
context.view_layer.objects.active = o
self.manipulate()

View File

@ -449,7 +449,7 @@ def update_t_part(self, context):
if o.parent is None:
# create a reference point and make it active
x, y, z = w.bound_box[0]
context.scene.cursor_location = w.matrix_world @ Vector((x, y, z))
context.scene.cursor.location = w.matrix_world @ Vector((x, y, z))
# fix issue #9
context.view_layer.objects.active = o
bpy.ops.archipack.reference_point()
@ -1781,7 +1781,7 @@ class ARCHIPACK_OT_wall2(ArchipackCreateTool, Operator):
if context.mode == "OBJECT":
bpy.ops.object.select_all(action="DESELECT")
o = self.create(context)
o.location = bpy.context.scene.cursor_location
o.location = bpy.context.scene.cursor.location
o.select_set(state=True)
context.view_layer.objects.active = o
self.manipulate()
@ -1886,7 +1886,7 @@ class ARCHIPACK_OT_wall2_from_slab(Operator):
# parenting childs to wall reference point
if o.parent is None:
x, y, z = o.bound_box[0]
context.scene.cursor_location = o.matrix_world @ Vector((x, y, z))
context.scene.cursor.location = o.matrix_world @ Vector((x, y, z))
# fix issue #9
context.view_layer.objects.active = o
bpy.ops.archipack.reference_point()

View File

@ -1815,7 +1815,7 @@ class ARCHIPACK_OT_window(ArchipackCreateTool, Operator):
if self.mode == 'CREATE':
bpy.ops.object.select_all(action="DESELECT")
o = self.create(context)
o.location = bpy.context.scene.cursor_location
o.location = bpy.context.scene.cursor.location
o.select_set(state=True)
context.view_layer.objects.active = o
self.manipulate()

View File

@ -59,7 +59,7 @@ class CAMERATURN_OT_RunAction(Operator):
turn_camera = scene.turn_camera
selectobject = context.active_object
camera = context.scene.camera
savedcursor = bpy.context.scene.cursor_location.copy() # cursor position
savedcursor = bpy.context.scene.cursor.location.copy() # cursor position
savedframe = scene.frame_current
if turn_camera.use_cursor is False:
bpy.ops.view3d.snap_cursor_to_selected()
@ -166,7 +166,7 @@ class CAMERATURN_OT_RunAction(Operator):
# back previous configuration
context.preferences.edit.keyframe_new_interpolation_type = savedinterpolation
bpy.context.scene.cursor_location = savedcursor
bpy.context.scene.cursor.location = savedcursor
# -------------------------
# Back to old selection

View File

@ -1072,7 +1072,7 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
elif self.size_mode == 'CAMERA':
x, y = compute_camera_size(
context, context.scene.cursor_location,
context, context.scene.cursor.location,
self.fill_mode, px / py
)

View File

@ -239,7 +239,7 @@ class Ms3dImporter():
FORMAT_GROUP.format(ms3d_model.name))
blender_empty_object = blender_context.blend_data.objects.new(
FORMAT_EMPTY_OBJECT.format(ms3d_model.name), None)
blender_empty_object.location = blender_scene.cursor_location
blender_empty_object.location = blender_scene.cursor.location
blender_collection.objects.link(blender_empty_object)
blender_group.objects.link(blender_empty_object)
@ -288,7 +288,7 @@ class Ms3dImporter():
blender_collection = blender_context.collection
blender_view_layer = blender_context.view_layer
blender_collection.objects.link(blender_mesh_object)
#blender_mesh_object.location = blender_scene.cursor_location
#blender_mesh_object.location = blender_scene.cursor.location
enable_edit_mode(False, blender_context)
select_all(False)
blender_mesh_object.select_set(True)
@ -699,7 +699,7 @@ class Ms3dImporter():
blender_armature_object = blender_context.blend_data.objects.new(
ms3d_armature_object_name, blender_armature)
blender_collection.objects.link(blender_armature_object)
#blender_armature_object.location = blender_scene.cursor_location
#blender_armature_object.location = blender_scene.cursor.location
blender_armature_object.show_in_front = True
##########################

View File

@ -60,7 +60,7 @@ class _Properties:
bd_size = common.get_uvimg_editor_board_size(area)
else:
bd_size = [1.0, 1.0]
loc = space.cursor_location
loc = space.cursor.location
if bd_size[0] < 0.000001:
cx = 0.0
@ -84,7 +84,7 @@ class _Properties:
bd_size = [1.0, 1.0]
cx = bd_size[0] * value[0]
cy = bd_size[1] * value[1]
space.cursor_location = Vector((cx, cy))
space.cursor.location = Vector((cx, cy))
scene.muv_align_uv_cursor_enabled = BoolProperty(
name="Align UV Cursor Enabled",
@ -264,6 +264,6 @@ class MUV_OT_AlignUVCursor(bpy.types.Operator):
cx = cx * bd_size[0]
cy = cy * bd_size[1]
space.cursor_location = Vector((cx, cy))
space.cursor.location = Vector((cx, cy))
return {'FINISHED'}

View File

@ -1824,7 +1824,7 @@ class MEASUREIT_OT_AddNote(Operator):
if context.area.type == 'VIEW_3D':
bpy.ops.object.empty_add(type='PLAIN_AXES')
myempty = bpy.data.objects[bpy.context.active_object.name]
myempty.location = bpy.context.scene.cursor_location
myempty.location = bpy.context.scene.cursor.location
myempty.empty_display_size = 0.01
myempty.name = "Annotation"
# Add properties

View File

@ -49,14 +49,14 @@ class AlignVertices(Operator):
auto_m = context.scene.auto_mirror
bpy.ops.object.mode_set(mode='OBJECT')
x1, y1, z1 = bpy.context.scene.cursor_location
x1, y1, z1 = bpy.context.scene.cursor.location
bpy.ops.view3d.snap_cursor_to_selected()
x2, y2, z2 = bpy.context.scene.cursor_location
x2, y2, z2 = bpy.context.scene.cursor.location
bpy.context.scene.cursor_location[0], \
bpy.context.scene.cursor_location[1], \
bpy.context.scene.cursor_location[2] = 0, 0, 0
bpy.context.scene.cursor.location[0], \
bpy.context.scene.cursor.location[1], \
bpy.context.scene.cursor.location[2] = 0, 0, 0
# Vertices coordinate to 0 (local coordinate, so on the origin)
for vert in bpy.context.object.data.vertices:
@ -69,10 +69,10 @@ class AlignVertices(Operator):
axis = 2
vert.co[axis] = 0
bpy.context.scene.cursor_location = x2, y2, z2
bpy.context.scene.cursor.location = x2, y2, z2
bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
bpy.context.scene.cursor_location = x1, y1, z1
bpy.context.scene.cursor.location = x1, y1, z1
bpy.ops.object.mode_set(mode='EDIT')
return {'FINISHED'}

View File

@ -1332,7 +1332,7 @@ def CreateCutSquare(self, context):
depthLocation = region_2d_to_vector_3d(region, rv3d, coord)
self.ViewVector = depthLocation
if self.snapCursor:
PlanePoint = context.scene.cursor_location
PlanePoint = context.scene.cursor.location
else:
PlanePoint = self.OpsObj.location if self.OpsObj is not None else Vector((0.0, 0.0, 0.0))
@ -1402,7 +1402,7 @@ def CreateCutLine(self, context):
depthLocation = region_2d_to_vector_3d(region, rv3d, coord)
self.ViewVector = depthLocation
PlanePoint = context.scene.cursor_location if self.snapCursor else Vector((0.0, 0.0, 0.0))
PlanePoint = context.scene.cursor.location if self.snapCursor else Vector((0.0, 0.0, 0.0))
PlaneNormal = depthLocation
PlaneNormalised = PlaneNormal.normalized()
@ -1501,7 +1501,7 @@ def CreateCutCircle(self, context):
depthLocation = region_2d_to_vector_3d(region, rv3d, coord)
self.ViewVector = depthLocation
PlanePoint = context.scene.cursor_location if self.snapCursor else Vector((0.0, 0.0, 0.0))
PlanePoint = context.scene.cursor.location if self.snapCursor else Vector((0.0, 0.0, 0.0))
PlaneNormal = depthLocation
PlaneNormalised = PlaneNormal.normalized()
@ -1740,14 +1740,14 @@ def Picking(context, event):
hit_world = matrix * hit
length_squared = (hit_world - ray_origin).length_squared
if best_obj is None or length_squared < best_length_squared:
scene.cursor_location = hit_world
scene.cursor.location = hit_world
best_length_squared = length_squared
best_obj = obj
else:
if best_obj is None:
depthLocation = region_2d_to_vector_3d(region, rv3d, coord)
loc = region_2d_to_location_3d(region, rv3d, coord, depthLocation)
scene.cursor_location = loc
scene.cursor.location = loc
def CreatePrimitive(self, _AngleStep, _radius):
@ -3168,13 +3168,13 @@ class Carver(bpy.types.Operator):
bpy.ops.mesh.normals_make_consistent()
bpy.ops.object.mode_set(mode='OBJECT')
saved_location_0 = context.scene.cursor_location.copy()
saved_location_0 = context.scene.cursor.location.copy()
bpy.ops.view3d.snap_cursor_to_active()
saved_location = context.scene.cursor_location.copy()
saved_location = context.scene.cursor.location.copy()
bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
context.scene.cursor_location = saved_location
context.scene.cursor.location = saved_location
bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
context.scene.cursor_location = saved_location_0
context.scene.cursor.location = saved_location_0
bpy.data.objects[self.CurrentObj.name].select_set(True)
bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')
@ -3203,7 +3203,7 @@ class Carver(bpy.types.Operator):
bpy.ops.view3d.localview()
# Save cursor position
CursorLocation = context.scene.cursor_location.copy()
CursorLocation = context.scene.cursor.location.copy()
ActiveObjList = []
if (self.ObjectMode is False) and (self.ProfileMode is False):
@ -3250,7 +3250,7 @@ class Carver(bpy.types.Operator):
lastSelected = []
for ActiveObj in ActiveObjList:
context.scene.cursor_location = CursorLocation
context.scene.cursor.location = CursorLocation
if len(context.selected_objects) > 0:
bpy.ops.object.select_all(action='TOGGLE')
@ -3322,12 +3322,12 @@ class Carver(bpy.types.Operator):
CreateBevel(context, context.selected_objects[0])
UndoAdd(self, "REBOOL", context.selected_objects[0])
context.scene.cursor_location = ActiveObj.location
context.scene.cursor.location = ActiveObj.location
bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
else:
bpy.ops.object.delete(use_global=False)
context.scene.cursor_location = CursorLocation
context.scene.cursor.location = CursorLocation
if self.ObjectMode:
context.view_layer.objects.active = self.ObjectBrush
@ -3351,7 +3351,7 @@ class Carver(bpy.types.Operator):
# Get the last object selected
lastSelected.append(context.selected_objects[0])
context.scene.cursor_location = CursorLocation
context.scene.cursor.location = CursorLocation
if self.DontApply is False:
# Remove cut object

View File

@ -1065,7 +1065,7 @@ class EdgeRoundifier(Operator):
if parameters["refObject"] == "ORG":
refObjectLocation = [0, 0, 0]
elif parameters["refObject"] == "CUR":
refObjectLocation = bpy.context.scene.cursor_location - objectLocation
refObjectLocation = bpy.context.scene.cursor.location - objectLocation
else:
refObjectLocation = self.calc.getEdgeReference(edge, edgeCenter, parameters["plane"])

View File

@ -93,7 +93,7 @@ class SelVertEdgeFace(Operator):
if self.select_type == 'VERT':
bpy.context.tool_settings.mesh_select_mode = [True, False, False]
ver = obj.data.vertices
loc = context.scene.cursor_location
loc = context.scene.cursor.location
sel = []
for v in ver:
d = v.co - loc

View File

@ -90,7 +90,7 @@ def generate_3PT(pts, obj, nv, mode=1):
if r:
p1, _ = r
cp = mw @ p1
bpy.context.scene.cursor_location = cp
bpy.context.scene.cursor.location = cp
if mode == 0:
pass

View File

@ -468,7 +468,7 @@ def import_object(obname):
instance_groups=True)
for ob in bpy.context.selected_objects:
ob.location = bpy.context.scene.cursor_location
ob.location = bpy.context.scene.cursor.location
class ImportFractureRecorder(bpy.types.Operator):

View File

@ -110,7 +110,7 @@ def main_object(context, obj, level, **kw):
if recursion_chance_select == 'SIZE_MAX':
objects_recurse_input.reverse()
elif recursion_chance_select in {'CURSOR_MIN', 'CURSOR_MAX'}:
c = scene.cursor_location.copy()
c = scene.cursor.location.copy()
objects_recurse_input.sort(key=lambda ob_pair:
(ob_pair[1].location - c).length_squared)
if recursion_chance_select == 'CURSOR_MAX':

View File

@ -69,7 +69,7 @@ class POVRAY_OT_lathe_add(bpy.types.Operator):
layers=[False]*20
layers[0]=True
bpy.ops.curve.primitive_bezier_curve_add(
location=context.scene.cursor_location,
location=context.scene.cursor.location,
rotation=(0, 0, 0),
layers=layers,
)
@ -634,7 +634,7 @@ class POVRAY_OT_box_add(bpy.types.Operator):
def pov_cylinder_define(context, op, ob, radius, loc, loc_cap):
if op:
R = op.R
loc = bpy.context.scene.cursor_location
loc = bpy.context.scene.cursor.location
loc_cap[0] = loc[0]
loc_cap[1] = loc[1]
loc_cap[2] = (loc[2]+2)
@ -697,7 +697,7 @@ class POVRAY_OT_cylinder_add(bpy.types.Operator):
LOC_CAP = ob.pov.imported_cyl_loc_cap
else:
if not props.imported_cyl_loc:
LOC_CAP = LOC = bpy.context.scene.cursor_location
LOC_CAP = LOC = bpy.context.scene.cursor.location
LOC_CAP[2] += 2.0
else:
LOC = props.imported_cyl_loc
@ -738,7 +738,7 @@ class POVRAY_OT_cylinder_update(bpy.types.Operator):
def pov_sphere_define(context, op, ob, loc):
if op:
R = op.R
loc = bpy.context.scene.cursor_location
loc = bpy.context.scene.cursor.location
else:
assert(ob)
R = ob.pov.sphere_radius
@ -799,7 +799,7 @@ class POVRAY_OT_sphere_add(bpy.types.Operator):
LOC = ob.pov.imported_loc
else:
if not props.imported_loc:
LOC = bpy.context.scene.cursor_location
LOC = bpy.context.scene.cursor.location
else:
LOC = props.imported_loc
@ -1327,7 +1327,7 @@ def pov_parametric_define(context, op, ob):
obrot = ob.rotation_euler # In radians
#Parametric addon has no loc rot, some extra work is needed
#in case cursor has moved
curloc = bpy.context.scene.cursor_location
curloc = bpy.context.scene.cursor.location
bpy.ops.object.mode_set(mode="EDIT")

View File

@ -112,13 +112,13 @@ def draw_callback_px():
offset_y = 20
if data_quat:
loc = context.scene.cursor_location.copy()
loc = context.scene.cursor.location.copy()
for key, mat in data_quat.items():
draw_text(key, loc, dy=-offset_y)
offset_y += 20
if data_euler:
loc = context.scene.cursor_location.copy()
loc = context.scene.cursor.location.copy()
for key, mat in data_euler.items():
draw_text(key, loc, dy=-offset_y)
offset_y += 20
@ -143,7 +143,7 @@ def draw_callback_view():
draw_matrices(list(data_matrix.values()), scale, with_bounding_box)
if data_euler or data_quat:
cursor = bpy.context.scene.cursor_location.copy()
cursor = bpy.context.scene.cursor.location.copy()
derived_matrices = []
for quat in data_quat.values():
matrix = quat.to_matrix().to_4x4()

View File

@ -49,7 +49,7 @@ class Snap_CursSelToCenter1(Operator):
return (context.area.type == "VIEW_3D" and context.mode == "OBJECT")
def execute(self, context):
context.space_data.cursor_location = (0, 0, 0)
context.scene.cursor.location = (0, 0, 0)
for obj in context.selected_objects:
obj.location = (0, 0, 0)

View File

@ -49,11 +49,11 @@ class PivotToSelection(Operator):
return context.active_object is not None
def execute(self, context):
saved_location = context.scene.cursor_location.copy()
saved_location = context.scene.cursor.location.copy()
bpy.ops.view3d.snap_cursor_to_selected()
bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
context.scene.cursor_location = saved_location
context.scene.cursor.location = saved_location
return {'FINISHED'}

View File

@ -2738,7 +2738,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 #
@ -2789,16 +2789,16 @@ class SetObjectMode(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
@ -2834,7 +2834,7 @@ class SnapCursSelToCenter(Operator):
return (context.area.type == "VIEW_3D" and context.mode == "OBJECT")
def execute(self, context):
context.space_data.cursor_location = (0, 0, 0)
context.scene.cursor.location = (0, 0, 0)
for obj in context.selected_objects:
obj.location = (0, 0, 0)
return {'FINISHED'}

View File

@ -618,7 +618,7 @@ class TexAtl_MergeObjects(Operator):
me = bpy.data.meshes.new(self.group_name + '_mergedObject')
ob_merge = bpy.data.objects.new(self.group_name + '_mergedObject', me)
ob_merge.location = scene.cursor_location # position object at 3d-cursor
ob_merge.location = scene.cursor.location # position object at 3d-cursor
collection.objects.link(ob_merge) # Link object to collection
me.update()
ob_merge.select_set(False)