diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-05-14 18:39:21 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-05-14 18:39:21 +0400 |
commit | 24fb2bad55f5fa741d3b5d1df27750a4b7d80eff (patch) | |
tree | a3147b0b6099ecfc8212ed484adbee6df27f2884 /release | |
parent | 0167a75a584549e92935c3d3a27131d95199b08f (diff) |
select camera operator now works with view3d unlocked cameras,
also corrected description.
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_operators/object.py | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/release/scripts/startup/bl_operators/object.py b/release/scripts/startup/bl_operators/object.py index 8268d7a9514..358919ac888 100644 --- a/release/scripts/startup/bl_operators/object.py +++ b/release/scripts/startup/bl_operators/object.py @@ -104,24 +104,29 @@ class SelectPattern(Operator): class SelectCamera(Operator): - '''Select object matching a naming pattern''' + '''Select the active camera''' bl_idname = "object.select_camera" bl_label = "Select Camera" bl_options = {'REGISTER', 'UNDO'} - @classmethod - def poll(cls, context): - return context.scene.camera is not None - def execute(self, context): scene = context.scene - camera = scene.camera - if camera.name not in scene.objects: + view = context.space_data + if view.type == 'VIEW_3D' and not view.lock_camera_and_layers: + camera = view.camera + else: + camera = scene.camera + + if camera is None: + self.report({'WARNING'}, "No camera found") + elif camera.name not in scene.objects: self.report({'WARNING'}, "Active camera is not in this scene") + else: + context.scene.objects.active = camera + camera.select = True + return {'FINISHED'} - context.scene.objects.active = camera - camera.select = True - return {'FINISHED'} + return {'CANCELLED'} class SelectHierarchy(Operator): |