Skip to content

Commit

Permalink
Update for API change: scene.cursor_location -> scene.cursor.location
Browse files Browse the repository at this point in the history
Note that some scripts still used the 3D view cursor which has been
removed for a while.
  • Loading branch information
ideasman42 committed Mar 1, 2019
1 parent dd0dffe commit 9999dad
Show file tree
Hide file tree
Showing 52 changed files with 123 additions and 123 deletions.
4 changes: 2 additions & 2 deletions add_advanced_objects_menu/add_mesh_aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def execute(self, context):
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
Expand Down Expand Up @@ -310,7 +310,7 @@ def execute(self, context):
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]
Expand Down
6 changes: 3 additions & 3 deletions add_curve_extra_objects/add_curve_spirofit_bouncespline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion add_curve_extra_objects/add_curve_torus_knots.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions add_curve_extra_objects/add_surface_plane_cone.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def execute(self, context):
# 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
Expand Down Expand Up @@ -186,7 +186,7 @@ def execute(self, context):
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))

Expand Down Expand Up @@ -266,7 +266,7 @@ def execute(self, context):
# 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
Expand Down Expand Up @@ -334,7 +334,7 @@ def execute(self, context):

# 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
Expand Down
2 changes: 1 addition & 1 deletion add_curve_ivygen.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ def execute(self, context):
# 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)
Expand Down
2 changes: 1 addition & 1 deletion add_curve_sapling/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion add_mesh_extra_objects/Wallfactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ def execute(self, context):
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'}
2 changes: 1 addition & 1 deletion add_mesh_extra_objects/add_empty_as_parent.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def execute(self, context):
pass

if self.locat == 'CURSOR':
loc = sce.cursor_location
loc = sce.cursor.location
elif self.locat == 'ACTIVE':
loc = act.location
else:
Expand Down
2 changes: 1 addition & 1 deletion archimesh/achm_books_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions archimesh/achm_column_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions archimesh/achm_curtain_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

# ------------------
Expand Down Expand Up @@ -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

# ------------------
Expand Down
6 changes: 3 additions & 3 deletions archimesh/achm_door_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion archimesh/achm_kitchen_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion archimesh/achm_lamp_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions archimesh/achm_main_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,9 @@ def execute(self, context):
# ----------------------------
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()
Expand Down
2 changes: 1 addition & 1 deletion archimesh/achm_roof_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion archimesh/achm_room_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion archimesh/achm_shelves_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion archimesh/achm_stairs_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion archimesh/achm_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions archimesh/achm_venetian_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
14 changes: 7 additions & 7 deletions archimesh/achm_window_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -526,7 +526,7 @@ def draw(self, context):
# 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'}:
Expand Down Expand Up @@ -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'}:
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Loading

0 comments on commit 9999dad

Please sign in to comment.