forked from bookyakuno/Blender-Scramble-Addon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVIEW3D_PT_transform_orientations.py
64 lines (51 loc) · 1.81 KB
/
VIEW3D_PT_transform_orientations.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
# 「3Dビュー」エリア > サイドバー > 「ビュー」タブ > 「トランスフォーム座標系」パネル
# "3D View" Area > Sidebar > "View" Tab > "Transform Orientations" Panel
import bpy
from bpy.ops import *
################
# オペレーター #
################
##########
# パネル #
##########
class VIEW3D_PT_scramble_view3d_orientation(bpy.types.Panel):
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_category = "View"
bl_label = "Transform Orientations"
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
if (IsMenuEnable(__name__.split('.')[-1])):
box = self.layout.box()
box.props_enum(context.scene.transform_orientation_slots[0], "type")
row = self.layout.row()
operator = row.operator("transform.create_orientation", text="", icon='ADD')
operator.use = True
operator.overwrite = True
if context.scene.transform_orientation_slots[0].custom_orientation != None:
row.prop(context.scene.transform_orientation_slots[0].custom_orientation, "name", text="")
row.operator("transform.delete_orientation", text="", icon='PANEL_CLOSE')
if (context.preferences.addons[__name__.partition('.')[0]].preferences.use_disabled_menu):
self.layout.operator('wm.toggle_menu_enable', icon='CANCEL').id = __name__.split('.')[-1]
################
# クラスの登録 #
################
classes = [
VIEW3D_PT_scramble_view3d_orientation,
]
def register():
for cls in classes:
bpy.utils.register_class(cls)
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
################
# メニュー追加 #
################
# メニューのオン/オフの判定
def IsMenuEnable(self_id):
for id in bpy.context.preferences.addons[__name__.partition('.')[0]].preferences.disabled_menu.split(','):
if (id == self_id):
return False
else:
return True