Skip to content
Snippets Groups Projects
Commit 07f4730a authored by Campbell Barton's avatar Campbell Barton
Browse files

Cleanup: redundant lookups

parent 4bac8438
Branches
No related tags found
No related merge requests found
...@@ -21,7 +21,7 @@ bl_info = { ...@@ -21,7 +21,7 @@ bl_info = {
"author": "Antonio Vazquez (antonioya)", "author": "Antonio Vazquez (antonioya)",
"version": (0, 2, 5), "version": (0, 2, 5),
"blender": (2, 68, 0), "blender": (2, 68, 0),
"location": "View3D > Toolshelf > Turnaround camera", "location": "View3D > Toolshelf > Animation Tab > Turnaround Camera",
"description": "Add a camera rotation around selected object", "description": "Add a camera rotation around selected object",
"wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/" "wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/"
"Scripts/Animation/TurnaroundCamera", "Scripts/Animation/TurnaroundCamera",
...@@ -58,7 +58,7 @@ class RunAction(Operator): ...@@ -58,7 +58,7 @@ class RunAction(Operator):
scene = context.scene scene = context.scene
turn_camera = scene.turn_camera turn_camera = scene.turn_camera
selectobject = context.active_object selectobject = context.active_object
camera = bpy.data.objects[bpy.context.scene.camera.name] 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 savedframe = scene.frame_current
if turn_camera.use_cursor is False: if turn_camera.use_cursor is False:
...@@ -68,7 +68,7 @@ class RunAction(Operator): ...@@ -68,7 +68,7 @@ class RunAction(Operator):
# Create empty and parent # Create empty and parent
# ------------------------- # -------------------------
bpy.ops.object.empty_add(type='PLAIN_AXES') bpy.ops.object.empty_add(type='PLAIN_AXES')
myempty = bpy.data.objects[bpy.context.active_object.name] myempty = context.active_object
myempty.location = selectobject.location myempty.location = selectobject.location
savedstate = myempty.matrix_world savedstate = myempty.matrix_world
...@@ -89,7 +89,7 @@ class RunAction(Operator): ...@@ -89,7 +89,7 @@ class RunAction(Operator):
# ------------------------- # -------------------------
bpy.ops.object.select_all(False) bpy.ops.object.select_all(False)
myempty.select = True myempty.select = True
bpy.context.scene.objects.active = myempty context.scene.objects.active = myempty
# save current configuration # save current configuration
savedinterpolation = context.user_preferences.edit.keyframe_new_interpolation_type savedinterpolation = context.user_preferences.edit.keyframe_new_interpolation_type
# change interpolation mode # change interpolation mode
...@@ -97,7 +97,7 @@ class RunAction(Operator): ...@@ -97,7 +97,7 @@ class RunAction(Operator):
# create first frame # create first frame
myempty.rotation_euler = (0, 0, 0) myempty.rotation_euler = (0, 0, 0)
myempty.empty_draw_size = 0.1 myempty.empty_draw_size = 0.1
bpy.context.scene.frame_set(scene.frame_start) context.scene.frame_set(scene.frame_start)
myempty.keyframe_insert(data_path='rotation_euler', frame=scene.frame_start) myempty.keyframe_insert(data_path='rotation_euler', frame=scene.frame_start)
# Clear the Camera Animations if the option is checked # Clear the Camera Animations if the option is checked
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment