diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-06-22 08:08:44 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-06-22 08:08:44 +0300 |
commit | 793637384cf175404f64f58c67e0ab0997709571 (patch) | |
tree | 9ec7a12b74e8cce33f48a26291179385310c00d1 /camera_turnaround.py | |
parent | 69ffc879644a8edfd9308a889b16f4042e2f0b5e (diff) |
Cleanup: camera_turnaround, remove unnecessary context access
Diffstat (limited to 'camera_turnaround.py')
-rw-r--r-- | camera_turnaround.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/camera_turnaround.py b/camera_turnaround.py index 935f486e..e80dc638 100644 --- a/camera_turnaround.py +++ b/camera_turnaround.py @@ -59,8 +59,8 @@ class CAMERATURN_OT_RunAction(Operator): scene = context.scene turn_camera = scene.turn_camera selectobject = context.active_object - camera = context.scene.camera - savedcursor = bpy.context.scene.cursor.location.copy() # cursor position + camera = scene.camera + savedcursor = scene.cursor.location.copy() # cursor position savedframe = scene.frame_current if turn_camera.use_cursor is False: bpy.ops.view3d.snap_cursor_to_selected() @@ -98,7 +98,7 @@ class CAMERATURN_OT_RunAction(Operator): # create first frame myempty.rotation_euler = (0, 0, 0) myempty.empty_display_size = 0.1 - context.scene.frame_set(scene.frame_start) + scene.frame_set(scene.frame_start) myempty.keyframe_insert(data_path="rotation_euler", frame=scene.frame_start) # Clear the Camera Animations if the option is checked @@ -167,7 +167,7 @@ class CAMERATURN_OT_RunAction(Operator): # back previous configuration context.preferences.edit.keyframe_new_interpolation_type = savedinterpolation - bpy.context.scene.cursor.location = savedcursor + scene.cursor.location = savedcursor # ------------------------- # Back to old selection @@ -175,7 +175,7 @@ class CAMERATURN_OT_RunAction(Operator): bpy.ops.object.select_all(False) selectobject.select_set(True) bpy.context.view_layer.objects.active = selectobject - bpy.context.scene.frame_set(savedframe) + scene.frame_set(savedframe) return {'FINISHED'} @@ -277,7 +277,7 @@ class CAMERATURN_PT_ui(Panel): turn_camera = scene.turn_camera try: - bpy.context.scene.camera.name + scene.camera.name except AttributeError: row = layout.row(align=False) row.label(text="No defined camera for scene", icon="INFO") |