-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
102 lines (81 loc) · 2.93 KB
/
Copy path__init__.py
File metadata and controls
102 lines (81 loc) · 2.93 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
from .addon_info import BUG_REPORT_URL, FEATURE_REQUEST_URL, PROJECT_URL
bl_info = {
"name": "Cascadeur Bridge for Blender",
"author": "Aron Nemeth; Robinjeet Singh (2026 compatibility update)",
"version": (2, 5, 0),
"blender": (3, 5, 0),
"location": "View3D > Panels > CSC Bridge",
"description": "Small Cascadeur transfer bridge; Offline Lip Sync is a separate add-on.",
"doc_url": PROJECT_URL,
"tracker_url": PROJECT_URL + "/issues",
"category": "Animation",
}
if "bpy" not in locals():
from . import operators
from . import ui
else:
import importlib
importlib.reload(operators)
importlib.reload(ui)
import bpy
from .utils import config_handling
from .utils.csc_handling import get_default_csc_exe_path
def update_all_tab_names(self, context) -> None:
try:
# Unregister everything
for c in reversed(ui.classes):
bpy.utils.unregister_class(c)
except:
pass
# Set panel name for base class
new_name = bpy.context.preferences.addons[__name__].preferences.csc_tab_name
ui.main_panel.PanelBasics.bl_category = new_name
# Save to file
config_handling.set_config_parameter("Addon Settings", "panel_name", new_name)
# Register everything
for c in ui.classes:
bpy.utils.register_class(c)
class CBB_preferences(bpy.types.AddonPreferences):
bl_idname = __name__
csc_exe_path: bpy.props.StringProperty(
name="Cascadeur executable",
subtype="FILE_PATH",
default=get_default_csc_exe_path(),
)
csc_tab_name: bpy.props.StringProperty(
name="N Panel Name",
description="Name of the add-on on the N Panel",
default=config_handling.get_panel_name(),
update=update_all_tab_names,
)
def draw(self, context):
layout = self.layout
col = layout.column(align=False)
row = col.row()
row.prop(self, "csc_tab_name")
col.separator()
row = col.row()
row.prop(self, "csc_exe_path")
row = col.row()
row.operator(
"cbb.install_required_files",
text="Install Requirements",
icon="MODIFIER",
)
support = col.box()
support.label(text="Help Improve This Bridge", icon="URL")
row = support.row(align=True)
row.operator("wm.url_open", text="Report a Bug", icon="ERROR").url = BUG_REPORT_URL
row.operator(
"wm.url_open", text="Request a Feature", icon="LIGHT"
).url = FEATURE_REQUEST_URL
support.operator("wm.url_open", text="Open Project on GitHub", icon="SCRIPT").url = PROJECT_URL
classes = [CBB_preferences] + operators.classes + ui.classes
def register():
operators.addon_properties.register_props()
for cls in classes:
bpy.utils.register_class(cls)
def unregister():
for cls in reversed(classes):
bpy.utils.unregister_class(cls)
operators.addon_properties.unregister_props()