-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathActive_Camera_menu.py
71 lines (58 loc) · 2.65 KB
/
Active_Camera_menu.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# Add-on info
bl_info = {
"name": "Cameras List",
"author": "APEC",
"version": (0, 1, 0),
"blender": (2, 93, 0),
"location": "View3d > RMB > Active Camera",
"description": "Menu with scene cameras",
"doc_url": "",
"tracker_url": "",
"category": "3D View"
}
import bpy
class VIEW3D_MT_cameras_main(bpy.types.Menu):
"""Main menu for scene Cameras"""
bl_idname = "VIEW3D_MT_cameras_main"
bl_label = "Active Camera"
def draw(self, context):
layout = self.layout
layout.prop(bpy.context.scene, "camera", text="", icon="CAMERA_DATA")
#layout.separator()
###########################################################################################
##################################### UI ############################################
###########################################################################################
def cameras_specials_menu(self, contxt):
ob = bpy.context.object
if ob is not None and ob.type == 'CAMERA':
self.layout.separator()
self.layout.menu(VIEW3D_MT_cameras_main.bl_idname, icon="VIEW_CAMERA")
###########################################################################################
##################################### Register ############################################
###########################################################################################
def register():
bpy.utils.register_class(VIEW3D_MT_cameras_main)
bpy.types.VIEW3D_MT_object_context_menu.prepend(cameras_specials_menu)
#bpy.types.VIEW3D_MT_object_context_menu.append(cameras_specials_menu)
def unregister():
bpy.utils.unregister_class(VIEW3D_MT_cameras_main)
bpy.types.VIEW3D_MT_object_context_menu.remove(cameras_specials_menu)
if __name__ == "__main__":
register()